Forum Discussion
Joe_Frost_43072
Nimbostratus
May 08, 2007Single host SNAT iRule
Hello all-
I have a simple apache pool with 3 internal hosts and 1 host that lives outside of my network in which i want to SNAT exclusively in order to bypass the asymetrical routing issue. How would i write an iRule to only SNAT my one external pool node?
Thanks
- hoolio
Cirrostratus
Hi,when LB_SELECTED { if {[IP::addr "[IP::client_addr]/24" equals "[LB::server addr]/24"]} { snat 192.168.100.12 } }
- Joe_Frost_43072
Nimbostratus
This is what i tried but when i apply it, i get connection reset on my Virtual. Any suggestions? - hoolio
Cirrostratus
Do you see an error in /var/log/ltm?when LB_SELECTED { log local0. "\[LB::server\]: [LB::server], \[IP::client_addr\]: [IP::client_addr]" if { [matchclass [LB::server] equals $::Hosts]} { snat automap } }
- Joe_Frost_43072
Nimbostratus
class address_class_test {
Also, LB::server will return the IP address of the selected node. I assume the node is the client in the scenario you're testing now?
- hoolio
Cirrostratus
It looks like there might be something else in your class, other than just the IP address, which is being interpreted as a netmask.when CLIENT_ACCEPTED { SNAT requests if client_addr is defined in the class if { [matchclass [IP::client_addr] equals $::Hosts]} { snat automap } }
- Joe_Frost_43072
Nimbostratus
I would like to use client_accepted but i need to do it for every client instance when my Hosts class is matched. - hoolio
Cirrostratus
The CLIENT_ACCEPTED event is triggered every time a client makes a TCP connection. The SNAT would be performed throughout the life of the connection.when CLIENT_ACCEPTED { log local0. "\[IP::client_addr\]: [IP::client_addr]" SNAT requests if client_addr is defined in the class if { [matchclass [IP::client_addr] equals $::Hosts]} { log local0. "matched for [IP::client_addr]" snat automap } }
when CLIENT_ACCEPTED { log local0. "\[IP::client_addr\]: [IP::client_addr]" SNAT requests if client_addr matches this IP if { [IP::addr [IP::client_addr]/24 equals 1.2.3.4]} { log local0. "matched for [IP::client_addr]" snat automap } }
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