Forum Discussion
Roark_Fisher_29
Nimbostratus
May 01, 2006Outbound routing based upon source IP
I hope the intellects here may be able to help me with a confusing setup. I worked for 3 days with F5 tech support on this and they finally sent me here.
I have about a dozen T1 lines tha...
Rodrigo_EV_7869
Nimbostratus
Oct 19, 2006I'd like to propose another scenario we got in a customer:
Suppose we have the Wildcard Virtual Server (0.0.0.0:0) pointed to a Default Gateway Pool with my two ISP routers (200.1.0.1 and 200.2.0.1).
I want the outbound connection for specific internal servers to use another IP other than SelfIP/SNAT Automap (let's say Static SNAT Addresses 200.1.0.10 and 200.2.0.10).
With the iRule described above I can get this result, but the destination router will be selected by the SNAT, not leveraging the router/link status in a Link Controller Box.
The best would be to let the pool select the better router based on its metrics and then execute the iRule to SNAT to the proper static address.
class class_static_snat_servers {
host 10.0.0.10
host 10.0.0.11
}
class class_static_snat_gateways {
"200.1.0.1 200.1.0.10"
"200.2.0.1 200.2.0.10"
}
when CLIENT_ACCEPTED {
set static_snat_server [IP::client_addr]
}
when LB_SELECTED {
if {$::static_snat_server eq $::class_static_snat_servers]} {
set selected_gateway [findclass [LB::server addr] $::class_static_snat_gateways " "]
if { $selected_gateway ne "" } {
snat $selected_gateway
}
}
}
Or, in a short way:
when LB_SELECTED {
if {[matchclass [IP::client_addr] eq $::class_static_snat_servers]} {
set my_gw [findclass [LB::server addr] $::class_static_snat_gateways " "]
if { $my_gw ne "" } {
snat $my_gw
}
}
}
I didn't tested this iRules, but this second could result in an error: the [IP::client_addr] variable could have already being translated by the SNAP Automap, not fetching the $::class_static_snat_servers correctly.
Then we can start mapping single internal servers to single snat addresses with little modifications in this iRule.
Am I right in my logic?
Thanks,
-Rodrigo
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