Forum Discussion
J_Peterman_4266
Jul 18, 2012Nimbostratus
Having trouble with destination based SNAT irule
We are looking to implement destination based SNAT via iRule where all traffic destined to RFC 1918 space does not get SNAT outbound and it retains its private addressing, all other traffic destined to public addressing gets SNAT outbound for internet specific connectivity. The problem is that the iRule that I have created and applied to a basic IP forwarding Virtual Server is not matching and performing "snat none" or simply "forward" and instead all traffic outbound is getting SNAT. Can anyone point out what might be going on?
[IP addressing has been changed to protect the innocent]
Here is my iRule:
when CLIENT_ACCEPTED {
Check if the remote address is part of the private_nosnat data group
if { [class match [IP::remote_addr] equals private_nosnat]} {
don't do anything
log local0. "MATCH NO SNAT CLASS"
snat none
} else {
snat behind this address
snat 1.1.1.1
}
}
the datagroup private_nosnat includes three networks defined:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
Again, this is applied to a virtual server that just matches all destinations and forwards on. The problem is that the first if statement isn't working and all traffic is getting SNAT on the final else statement.
Any insight is greatly appreciated.
- Brian_Van_StoneNimbostratusAre you on v11?
- J_Peterman_4266NimbostratusWe were supposed to be on v11 shipped to us, but they arrived v10 and we've just been setting them up on v10 prior to upgrading. So I see that this is noted as a bug in v10, was this fixed in v11 so that we can use route domains in the group? Seems like a pretty big issue when you can't define route domains in a group, and a vast limitation.
- Brian_Van_StoneNimbostratusStill listed as a known issue in 11.2.0
- J_Peterman_4266NimbostratusSo, uhm...
- J_Peterman_4266NimbostratusWorking with our reps and support teams at F5 to get the latest info on being able to use these features within route domains.
- Brian_Van_StoneNimbostratusDoesn't help with the general case that much but I think this can solve this specific problem.
- Brian_Van_StoneNimbostratusIt won't let me edit my post and that's quit unreadable. Sorry...take two...
when CLIENT_ACCEPTED { set local [IP::local_addr] switch -glob $local { 10.* { log local0. "MATCH NO SNAT CLASS" snat none } 172.1[6-9].* - 172.2[0-9].* - 172.3[0-1].* { log local0. "MATCH NO SNAT CLASS" snat none } 192.168.* { log local0. "MATCH NO SNAT CLASS" snat none } default { log local0. "MATCH AND SNAT" snat 1.1.1.1 } } }
- hooleylistCirrostratusThanks for the example Brian. But I think it would be more efficient to strip the route domain off of the client IP and have a route domain-specific data group like in this example versus using string comparisons with switch.
- J_Peterman_4266NimbostratusThe recommendation from F5 is to do the very same thing, to create an irule that strips the route-domain off the destination address (remote_addr) before making a comparison against the strings in the data group.
- hooleylistCirrostratusI agree that this should be fixed. It looks like the escalation requesting a fix is progressing.
Recent Discussions
Related Content
Â
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects