Forum Discussion
SNAT Using iRule and Variables
I want to SNAT traffic based on following criteria:
1) If source network is 10.10.1.x/24 and 2) If destination network is 10.13.71.x THEN 3) SNAT source IP to 192.168.20.x and forward to pool.
What I want to be able to do is have the iRule pull the last octect out of the 10.10.1.x address and plug it into the last octect of the 192.168.20.x subnet. How would I go about doing this?
Thanks!
Eric
2 Replies
- Arnaud_Lemaire
Employee
You could use something like that :
set myip 1.2.3.4 scan $myip %d.%d.%d.%d ip1 ip2 ip3 ip4 set newip [IP::addr 192.168.20.$ip4 mask 255.255.255.255] log local0. "$newip" - Eric_Watters_25
Nimbostratus
Thanks for the response Arnaud.........follow up.......how does your solution above address the fact that I ONLY want this rule to SNAT if the source of the traffic is 10.10.1.x /24? I plan to apply this to various VIPs on the the LTMs.
Thanks a lot!
Eric
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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