Forum Discussion

aziegelb_7634's avatar
aziegelb_7634
Icon for Nimbostratus rankNimbostratus
Aug 31, 2011

SNAT based on source address

Is it possible or even recommended to set up SNAT to translate based on the source address? For example, all of our clients have an IP address of 10.20.x.y and we'd like to have the source address translated to 10.21.x.y to make troubleshooting easier.

 

  • You could do this pretty efficiently and easily with an iRule like this:

    
    when CLIENT_ACCEPTED {
    
        scan the client IP into separate octets
       scan [IP::client_addr] {%*d.%*d.%d.%d} a b
    
        Apply SNAT using the last two client IP octets
       snat 10.20.$a.$b
    }
    

    Aaron