Created
July 13, 2014 23:47
-
-
Save sandromello/36b35945c2413bcab7c7 to your computer and use it in GitHub Desktop.
Round Robin iptables
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
#!/bin/bash | |
#FLUSH | |
iptables -F | |
iptables -t nat -F | |
iptables -F REGRAS_SNAT | |
iptables -X REGRAS_SNAT | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
iptables -t nat -I POSTROUTING -s 172.22.9.0/24 -o eth1 -j MASQUERADE | |
iptables -t nat -N REGRAS_SNAT | |
iptables -t nat -I POSTROUTING -j REGRAS_SNAT | |
iptables -t nat -A REGRAS_SNAT -d 172.22.9.0/24 -j RETURN | |
iptables -t nat -A REGRAS_SNAT -o eth1 -s 200.20.228.6/32 -p tcp --dport 25 -j SNAT --to 200.20.228.11-200.20.228.12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment