Port forwarding format change
parent
725ad9f0f5
commit
a65ee701a8
|
@ -6,6 +6,7 @@
|
||||||
- Fix DHCP rule
|
- Fix DHCP rule
|
||||||
- Obsoleted NATRANGE, NATEXTIP, NATEXTIF
|
- Obsoleted NATRANGE, NATEXTIP, NATEXTIF
|
||||||
- Added NAT_RANGE which can take SNAT/MASQ rules
|
- Added NAT_RANGE which can take SNAT/MASQ rules
|
||||||
|
- Changed port forwarding rules to include external interface
|
||||||
|
|
||||||
0.9.3 - Brielle Bruns <bruns@2mbit.com>
|
0.9.3 - Brielle Bruns <bruns@2mbit.com>
|
||||||
- Misc tweaks and reorg
|
- Misc tweaks and reorg
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Format is:
|
# Format is:
|
||||||
# External port:internal ip:internal port
|
# External interface:External port:internal ip:internal port
|
||||||
8080:tcp:192.168.0.100:80
|
#eth0:8080:tcp:192.168.0.100:80
|
||||||
|
|
14
rc.firewall
14
rc.firewall
|
@ -276,14 +276,14 @@ if [ $PORTFW ] && [ $NAT ]; then
|
||||||
display_c YELLOW "Adding port forward for: " N
|
display_c YELLOW "Adding port forward for: " N
|
||||||
for i in `grep -v "\#" $PORTFW`; do
|
for i in `grep -v "\#" $PORTFW`; do
|
||||||
PORTADD=( ${i//:/ } )
|
PORTADD=( ${i//:/ } )
|
||||||
$IPTABLES -A PREROUTING -t nat -i $NATEXTIF -p ${PORTADD[1]} \
|
$IPTABLES -A PREROUTING -t nat -i ${PORTADD[0]} -p ${PORTADD[2]} \
|
||||||
--dport ${PORTADD[0]} -j DNAT --to \
|
--dport ${PORTADD[1]} -j DNAT --to \
|
||||||
${PORTADD[2]}:${PORTADD[3]}
|
${PORTADD[3]}:${PORTADD[4]}
|
||||||
$IPTABLES -A INPUT -p ${PORTADD[1]} -m state --state NEW \
|
$IPTABLES -A INPUT -p ${PORTADD[2]} -m state --state NEW \
|
||||||
--dport ${PORTADD[0]} -i $NATEXTIF -j ACCEPT
|
--dport ${PORTADD[1]} -i ${PORTADD[0]} -j ACCEPT
|
||||||
echo -en "\E[32m${PORTADD[0]}\E[37m/\E[35m${PORTADD[1]}\E[37m->${PORTADD[2]}:${PORTADD[3]} "
|
display_c PURPLE "${PORTADD[0]}:${PORTADD[1]}:${PORTADD[2]}->${PORTADD[3]}:${PORTADD[4]} " N
|
||||||
done
|
done
|
||||||
echo -ne "\n"
|
reset_color
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $LANDHCPSERVER ]; then
|
if [ $LANDHCPSERVER ]; then
|
||||||
|
|
Loading…
Reference in New Issue