Forum Discussion

liccccboeh_3569's avatar
Icon for Nimbostratus rankNimbostratus
Mar 27, 2018

wildcard VS and SNAT


I'm trying to write a SNAT irule for a wildcard virtual server(Forwarding IP), so if it's RFC1918 address don't do snat and when it's any other then snat outside interface float ip. The F5 "snat automap" doesn't work really well - so it sometimes works, sometimes doesn't.

This is what i've come up to this point. Is this kinda thing even possible what I'm trying to achieve?

  switch [IP::remote_addr] { {
        snat none } { 
        snat none } {
        snat none } 
    default {
        snat  }


1 Reply

  • Certainly the solution you are trying to achieve is possible. Your current approach needs some tweaking though in order to get it to work. You cannot make a comparison of a raw IP address with a network address range without incorporating the IP::addr command. For example [IP::addr [IP::client_addr] equals] checks to see if the client's IP address is in the network. It will probably be easier to do this check from an IF statement rather than a SWITCH. Something like this perhaps:

        if { [IP::addr [IP::client_addr] equals] ||
             [IP::addr [IP::client_addr] equals] ||
             [IP::addr [IP::client_addr] equals] } {
            snat none
        } else {