Forum Discussion
wtwagon_99154
Nimbostratus
Mar 10, 2010Destination Based SNAT / NO SNAT
I wanted to see if it was possible to create an iRule that I could apply to an IP forwarding VIP to remove a SNAT.
Example:
Say Network 172.16.0.0/24 wants to talk to 10.32.0.0/24. Right now, there is a default SNAT that will SNAT all traffic from the 172.16.0.0/24 network to a particular IP address.
I have created an IP Forwarding VIP to 10.32.0.0/24, but the IP address will always show up as the previous particular IP address when accessing the 10.32.0.0/24 network.
Is there a way I can apply an iRule to the IP Forwarding VIP that will simply remove the SNAT when destined to these particular networks?
I was thinking something along the lines of this:
http://devcentral.f5.com/Wiki/default.aspx/iRules/SelectiveSNAT.html
However, not quite sure how I would format it. Any suggestions would be fantastic. Thanks!
- hoolio
Cirrostratus
Hi,class allowed_clients_class { network 172.16.0.0/24 }
class allowed_destination_ports { 22 80 110 }
when CLIENT_ACCEPTED { Check if client IP is allowed if { [matchclass [IP::client_addr] equals $::allowed_clients_class]} { Check if the requested port is allowed if { [matchclass [TCP::local_port] equals $::allowed_destination_ports]} { Disable SNAT for this connection snat none } else { Take some action for disallowed destination ports? drop } } else { Take some action for disallowed client IPs? drop } }
- wtwagon_99154
Nimbostratus
Just following up on this. - hoolio
Cirrostratus
A SNAT can provide similar functionality to a VIP and iRule, but the iRule gives you more granularity (source and destination hosts/subnets and ports), the ability to log connections and more specific statistics (b virtual show all versus b snat show all). If the SNAT functionality works for your requirements it is a simpler config option and is probably more efficient than a VIP and iRule.
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