One to One client to server mapping

Problem this snippet solves:

Customer request during Cisco ACE to F5 LTM migration requires for one-to-one mapping between client and back end server.

How to use this snippet:

Need a Data Group as below to simply identify the clientside source address and select the IP address of the pool member to use on the serverside.

All serverside IP addresses in the DataGroup should be in the Pool associated with the Virtual Server.

ltm data-group internal ONE_TO_ONE_DATAGROUP {
    records {
        172.16.0.1/32 {
            data 192.168.10.1
        }
        172.16.0.2/32 {
            data 192.168.10.2
        }
        172.16.0.2/32 {
            data 192.168.10.2
        }
    }
    type ip
}

Code :

when CLIENT_ACCEPTED {
    # Run pool command using data group lookup as the value inside of a catch statement
    if { [catch { 
            pool [LB::server pool] member [class match -value -- [IP::client_addr] equals ONE_TO_ONE_DATAGROUP]
          }]
       } {
        # If data group lookup or pool command raises an error the catch returns true and the default VS configured pool is selected
        pool [LB::server pool]
    }
}

Tested this on version:

11.5
Updated Jun 06, 2023
Version 2.0

Was this article helpful?

No CommentsBe the first to comment