Port forwarding format change

master
bbruns 2010-08-21 17:32:08 +00:00
parent 725ad9f0f5
commit a65ee701a8
3 changed files with 10 additions and 9 deletions

View File

@ -6,6 +6,7 @@
- Fix DHCP rule
- Obsoleted NATRANGE, NATEXTIP, NATEXTIF
- 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>
- Misc tweaks and reorg

View File

@ -1,3 +1,3 @@
# Format is:
# External port:internal ip:internal port
8080:tcp:192.168.0.100:80
# External interface:External port:internal ip:internal port
#eth0:8080:tcp:192.168.0.100:80

View File

@ -276,14 +276,14 @@ if [ $PORTFW ] && [ $NAT ]; then
display_c YELLOW "Adding port forward for: " N
for i in `grep -v "\#" $PORTFW`; do
PORTADD=( ${i//:/ } )
$IPTABLES -A PREROUTING -t nat -i $NATEXTIF -p ${PORTADD[1]} \
--dport ${PORTADD[0]} -j DNAT --to \
${PORTADD[2]}:${PORTADD[3]}
$IPTABLES -A INPUT -p ${PORTADD[1]} -m state --state NEW \
--dport ${PORTADD[0]} -i $NATEXTIF -j ACCEPT
echo -en "\E[32m${PORTADD[0]}\E[37m/\E[35m${PORTADD[1]}\E[37m->${PORTADD[2]}:${PORTADD[3]} "
$IPTABLES -A PREROUTING -t nat -i ${PORTADD[0]} -p ${PORTADD[2]} \
--dport ${PORTADD[1]} -j DNAT --to \
${PORTADD[3]}:${PORTADD[4]}
$IPTABLES -A INPUT -p ${PORTADD[2]} -m state --state NEW \
--dport ${PORTADD[1]} -i ${PORTADD[0]} -j ACCEPT
display_c PURPLE "${PORTADD[0]}:${PORTADD[1]}:${PORTADD[2]}->${PORTADD[3]}:${PORTADD[4]} " N
done
echo -ne "\n"
reset_color
fi
if [ $LANDHCPSERVER ]; then