diff options
author | Florian Fainelli <florian@openwrt.org> | 2007-10-29 11:00:33 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2007-10-29 11:00:33 +0000 |
commit | 2166cc1ae800060978cd57cadcf972e14bb336c5 (patch) | |
tree | def9696bbee08c9826e2f4eabf6f2842836c1775 /package/iptables | |
parent | f57bf774e84f15af296146f150da2d2c4b20aece (diff) | |
download | master-187ad058-2166cc1ae800060978cd57cadcf972e14bb336c5.tar.gz master-187ad058-2166cc1ae800060978cd57cadcf972e14bb336c5.tar.bz2 master-187ad058-2166cc1ae800060978cd57cadcf972e14bb336c5.zip |
Only masquerade LAN, other settings need manual tweaking
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9461 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iptables')
-rwxr-xr-x | package/iptables/files/firewall.init | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/package/iptables/files/firewall.init b/package/iptables/files/firewall.init index 9d8a405ab0..e1013fb8e7 100755 --- a/package/iptables/files/firewall.init +++ b/package/iptables/files/firewall.init @@ -11,6 +11,9 @@ start() { config_get WAN wan ifname config_get WANDEV wan device config_get LAN lan ifname + config_get LAN_MASK lan netmask + config_get LAN_IP lan ipaddr + LAN_NET=$(/bin/ipcalc.sh $LAN_IP $LAN_MASK | grep NETWORK | cut -d= -f2) ## CLEAR TABLES for T in filter nat; do @@ -105,10 +108,8 @@ start() { iptables -t nat -A PREROUTING -j prerouting_rule [ -z "$WAN" ] || iptables -t nat -A PREROUTING -i "$WAN" -j prerouting_wan iptables -t nat -A POSTROUTING -j postrouting_rule - ### Only RFC1918 addresses - [ -z "$WAN" ] || iptables -t nat -A POSTROUTING --src 192.168.0.0/16 -o $WAN -j MASQUERADE - [ -z "$WAN" ] || iptables -t nat -A POSTROUTING --src 172.16.0.0/12 -o $WAN -j MASQUERADE - [ -z "$WAN" ] || iptables -t nat -A POSTROUTING --src 10.0.0.0/8 -o $WAN -j MASQUERADE + ### Only LAN + [ -z "$WAN" ] || iptables -t nat -A POSTROUTING --src $LAN_NET/$LAN_MASK -o $WAN -j MASQUERADE iptables -t nat -A NEW -m limit --limit 50 --limit-burst 100 -j RETURN && \ iptables -t nat -A NEW -j DROP |