Added external IP to port forwarding.
parent
dc2d35f95d
commit
5a3e6086b0
|
@ -29,8 +29,6 @@ if [ $COMPAT_CONFIG == "1" ]; then
|
||||||
MODPROBE=`which modprobe`
|
MODPROBE=`which modprobe`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ANSI color sequences
|
# ANSI color sequences
|
||||||
BLUE="\E[34m"
|
BLUE="\E[34m"
|
||||||
GREEN="\E[32m"
|
GREEN="\E[32m"
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Config file version. Don't change this. Will be used some day to
|
||||||
|
# figure out if we need to alert the user that they need to redo their
|
||||||
|
# config file.
|
||||||
|
CONFIG_VERSION=0.9
|
||||||
|
|
||||||
# This is for testing purposes.
|
# This is for testing purposes.
|
||||||
IPTABLES=/bin/true
|
IPTABLES=/bin/true
|
||||||
IP6TABLES=/bin/true
|
IP6TABLES=/bin/true
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Format is:
|
# Format is:
|
||||||
# External interface:External port:internal ip:internal port
|
# External interface:External IP:External port:Internal ip:Internal port
|
||||||
#eth0:8080:tcp:192.168.0.100:80
|
#eth0:4.2.2.1:8080:tcp:192.168.0.100:80
|
||||||
|
|
12
rc.firewall
12
rc.firewall
|
@ -333,12 +333,12 @@ 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 ${PORTADD[0]} -p ${PORTADD[2]} \
|
$IPTABLES -A PREROUTING -t nat -i ${PORTADD[0]} -p ${PORTADD[3]} \
|
||||||
--dport ${PORTADD[1]} -j DNAT --to \
|
--dport ${PORTADD[2]} -d {PORTADD[1]} -j DNAT --to \
|
||||||
${PORTADD[3]}:${PORTADD[4]}
|
${PORTADD[4]}:${PORTADD[5]}
|
||||||
$IPTABLES -A INPUT -p ${PORTADD[2]} -m state --state NEW \
|
$IPTABLES -A INPUT -p ${PORTADD[3]} -m state --state NEW \
|
||||||
--dport ${PORTADD[1]} -i ${PORTADD[0]} -j ACCEPT
|
--dport ${PORTADD[2]} -i ${PORTADD[0]} -j ACCEPT
|
||||||
echo -en "${GREEN}${PORTADD[0]}:${PURPLE}${PORTADD[1]}:${PORTADD[2]}${AQUA}->${BLUE}${PORTADD[3]}:${PORTADD[4]} "
|
echo -en "${GREEN}${PORTADD[0]}:${PURPLE}${PORTADD[1]}:${PORTADD[2]}:${PORTADD[3]}${AQUA}->${BLUE}${PORTADD[4]}:${PORTADD[5]} "
|
||||||
done
|
done
|
||||||
reset_color
|
reset_color
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue