Forum Discussion

agehring_229714's avatar
agehring_229714
Icon for Nimbostratus rankNimbostratus
Aug 04, 2016

iRule to modify part of IP::client_addr

I'm trying to use an iRule to modify the client_addr to use as the snat.

client IP = 10.10.10.201 desired NAT = 192.168.1.201

Something like:

if { [matchclass [IP::client_addr] equals NAT_Clients]} {

      snat using this source address
     snat 192.168.1.$current_host_ip_last_octet

How would one go about doing that? using set and concat?

  • set lastoctet [getfield [IP::client_addr] "." 4]

     

    Should do the trick for you

     

  • Hi Agehring,

    you may try the syntax below...

    snat "192.168.1.[getfield [IP::client_addr] "." 4]"

    Cheers, Kai