Forum Discussion
Logan_Ramirez_5
Dec 08, 2005Nimbostratus
conditional SNAT
We have a relatively simple environment: two data centers, one web server in each, one bigip in each. Basic pool in each office for web servers consists of (a) local web server and (b) other data center virtual server containing the other web server.
So, if local web down --> send to BIGIP in other DC to get serviced.
Recently, however, deployed an MPLS network with a couple of additional routers which has stopped this functionality from working (because I cannot, or do not know, how to get all of those routers to change their default gateway based on a web server failure).
While I could solve this by SNATTING all requests to the web server (the issue is the return path to the customer does not make it out because of incorrect default gateways in all intermediate routers), we use the IP logs for security auditing, etc.
What would be great is if when a external web request gets serviced by BIGIP, if it send the packet to the local web server, it does not SNAT, however, if it needs to send it to the other web server in the 2nd DC, it SNATS.
Being fairly new to iRules, I have no idea how to write this...would love some help...
- Logan_Ramirez_5NimbostratusIndeed, that search tool is very useful and I have been doing some excellent reading, many posts by yourself (Colin), however, I suppose I left off some data:
- Logan_Ramirez_5NimbostratusWhile I am not sure how you inserted the HTML link (is it just the commands?), the link you sent sounded exactly like the issue I am having, however, there was no resolution on it! Some very good steps were taken (most of which I repeated on my box), but still not working like we need it to.
when LB_SELECTED { if {[IP::addr [IP::remote_addr] equals "192.168.197.0/24"]} { LB:reselect snat none log "In LB_SELECTED, using server:" log [IP::remote_addr] } }
- Logan_Ramirez_5NimbostratusLeveraging the LOGs and considering that perhaps my logic is bad (that is, the SNAT may not be failing, but actually just not applying to the condition I set, because the remote_addr variable I am expecting is ACTUALLY something different), I set up this rule:
when LB_SELECTED { if {[IP::addr [IP::client_addr] equals "192.168.1.1"]} { log "remote_addr: [IP::remote_addr]" log "local_addr: [IP::local_addr]" log "client_addr: [IP::client_addr]" log "server_addr: [IP::server_addr]" } }
Rule test_snat : remote_addr: 192.168.1.1 Rule test_snat : local_addr: 192.168.201.100 Rule test_snat : client_addr: 192.168.1.1 TCL error: Rule test_snat - Error: No serverside connection established (line 5) invoked from within "IP::server_addr"
- Colin_Walker_12Historic F5 AccountThe reason you're not seeing anything set for IP::server_addr is just like it says in the rule, there is no server side connection established.
- Logan_Ramirez_5NimbostratusOk, changed the iRule to:
when SERVER_CONNECTED { set client 192.168.1.1 if {[IP::client_addr] == $client} { log "local_addr: [IP::local_addr]" log "remote_addr: [IP::remote_addr]" log "client_addr: [IP::client_addr]" log "server_addr: [IP::server_addr]" } }
Dec 9 08:57:28 tmm tmm[703]: 01220001:3: TCL error: Rule test_snat - Error: No connection established IP::client_addr needs an established connection! (line 2) invoked from within "IP::client_addr"
virtual test_snat { destination 192.168.201.100:any snat automap pool test_snat_pool rule test_snat vlans internal enable }
pool test_snat_pool { min active members 1 monitor all gateway_icmp member 192.168.197.100:any priority 12 member 192.168.198.100:any priority 5 monitor none }
- JRahmAdminSome other alternatives in the event you can't get this working.
- Logan_Ramirez_5NimbostratusThanks.
- Logan_Ramirez_5NimbostratusOk, tried this rule, but do not see anything different in my IIS logs:
when HTTP_REQUEST { log "CLIENT_ADDR added as IP - [IP::client_addr]" HTTP::header insert client [IP::client_addr] }
- Logan_Ramirez_5NimbostratusGood morning, F5...
- unRuleY_95363Historic F5 AccountTry using [LB::server addr] in LB_SELECTED.
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