* Corrected Freifunk NAT rules

This commit is contained in:
Steven Barth 2008-04-28 07:15:16 +00:00
parent beea3eae0f
commit 5266a8c01c
2 changed files with 14 additions and 4 deletions

View file

@ -19,8 +19,8 @@ iface_add() {
eval "$(ipcalc.sh $ipaddr $netmask)" eval "$(ipcalc.sh $ipaddr $netmask)"
iptables -t nat -A luci_splash -i "$iface" -s "$IP/$PREFIX" -j luci_splash_portal iptables -t nat -A luci_splash -i "$iface" -s "$NETWORK/$PREFIX" -j luci_splash_portal
iptables -t nat -A luci_splash_portal -i "$iface" -s "$IP/$PREFIX" -d "$ipaddr" -p tcp -m multiport --dports 22,80,443 -j RETURN iptables -t nat -A luci_splash_portal -i "$iface" -s "$NETWORK/$PREFIX" -d "$ipaddr" -p tcp -m multiport --dports 22,80,443 -j RETURN
} }
blacklist_add() { blacklist_add() {

View file

@ -29,14 +29,24 @@ start() {
### Lan to Freifunk ### Lan to Freifunk
[ -n "$lanif" ] && { [ -n "$lanif" ] && {
config_get ipaddr lan ipaddr
config_get netmask lan netmask
eval "$(ipcalc.sh $ipaddr $netmask)"
iptables -A forwarding_rule -i "$lanif" -o "$ffif" -j ACCEPT iptables -A forwarding_rule -i "$lanif" -o "$ffif" -j ACCEPT
iptables -t nat -A postrouting_rule -i "$lanif" -o "$ffif" -j MASQUERADE iptables -t nat -A postrouting_rule -s "$NETWORK/$PREFIX" -o "$ffif" -j MASQUERADE
} }
### Freifunk to Wan ### Freifunk to Wan
[ "$internet" -gt 0 ] && { [ "$internet" -gt 0 ] && {
config_get ipaddr ff ipaddr
config_get netmask ff netmask
eval "$(ipcalc.sh $ipaddr $netmask)"
iptables -A forwarding_rule -i "$ffif" -o "$wanif" -j ACCEPT iptables -A forwarding_rule -i "$ffif" -o "$wanif" -j ACCEPT
iptables -t nat -A postrouting_rule -i "$ffif" -o "$wanif" -j MASQUERADE iptables -t nat -A postrouting_rule -s "$NETWORK/$PREFIX" -o "$wanif" -j MASQUERADE
} }
} }