Forum Discussion
Kai_Wilke
Sep 05, 2017MVP
Hi Destiny,
Stanislas has shown you a setup based
[array]
information and gateway pools. Let me show you a less integrated and complex setup based on a L2-Forwarding Virtual Server and a slightly less complicated iRule.
Prequisite:
- Establish a L2-Forwarding Virtual Server and a default route-table for your environment.
- Figure out all the required exemption of this default route-table (sort of PBR thinkering)
- Customize the iRule below to selectively overwrite your default routing table.
iRule:
when CLIENT_CONNECTED {
if { ( [IP::addr [IP::local_addr] equals "10.0.0.0/8"] )
or ( [IP::addr [IP::local_addr] equals "172.16.0.0/12"] )
or ( [IP::addr [IP::local_addr] equals "192.168.0.0/16"] ) } then {
This is the section for traffic destined to internal IPs
The traffic is handled by the regular routing table.
} elseif { [getfield [IP::client_addr] "%" 1] equals "192.168.10.101" } then {
This is the section for traffic orginating from IP 192.168.10.101
Set the SNAT IP to 178.102.1.105
snat 178.102.1.105
Set the next-hop to 178.102.1.104
next-hop 178.102.1.104
} elseif { [getfield [IP::client_addr] "%" 1] equals "192.168.10.102" } then {
This is the section for traffic orginating from IP 192.168.10.102
Set the SNAT IP to 178.102.1.105
snat 178.102.1.105
Set the next-hop to 178.102.1.104
next-hop 178.102.1.104
} else {
This is the section for the remaining traffic
Set the SNAT IP to 122.255.27.145
snat 122.255.27.145
Don't overwrite the next-hop to rely on the routing table
}
}
Cheers, Kai