Created
March 12, 2012 17:29
-
-
Save fishnix/2023509 to your computer and use it in GitHub Desktop.
exchange snat pool irule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| when RULE_INIT { | |
| # Use a local array to configure SNAT addresses. | |
| # These addresses do not need to be defined in a SNAT pool or elsewhere; | |
| # they simply need to be free IP addresses LTM can use to as a source | |
| # for server-side connections, and are typically on the same subnet as | |
| # the pool members. In this example, we use three addresses. Replace | |
| # these with free IP addresses appropriate to your network topology. | |
| # Follow the pattern of the existing addresses to add more than three. | |
| set static::snat_ips(0) 10.0.0.1 | |
| set static::snat_ips(1) 10.0.0.2 | |
| set static::snat_ips(2) 10.0.0.3 | |
| } | |
| when CLIENT_ACCEPTED { | |
| # Calculate the crc32 checksum of the client IP. | |
| # Use the modulo of the checksum and the number of SNAT IPs in the array | |
| # to select a SNAT IP address. | |
| snat $static::snat_ips([expr {[crc32 [IP::client_addr]] % [array size static::snat_ips]}]) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment