Add more support code for auto detection

master
bbruns 2010-12-18 21:33:50 +00:00
parent d06561ac98
commit b73ab90219
2 changed files with 22 additions and 7 deletions

View File

@ -67,5 +67,7 @@ IPTABLES_MULTIPORT=auto
RULE_CACHE=$BASEDIR/cache/ipt-rules RULE_CACHE=$BASEDIR/cache/ipt-rules
RULE_CACHE_V6=$BASEDIR/cache/ipt6-rules RULE_CACHE_V6=$BASEDIR/cache/ipt6-rules
EXTIP="auto"
EXTIF="auto" EXTIF="auto"
EXTIF_FIND=`ip route | awk '/^default/{print $3}'` EXTIF_FIND=`ip route | awk '/^default/{print $3}'`
EXTIP_FIND=$(expr "`ifconfig ${EXTIF}`" : '.*inet addr:\([^ ]*\).*')

View File

@ -52,14 +52,27 @@ POSTRUN="$BASEDIR/conf/postrun"
# first. # first.
EXTIF="auto" EXTIF="auto"
# Pattern for finding the default external interface # Primary external IP address
# Pick one or create your own if the firewall script # Can be an IP address or auto, which will try to detect
# has problems figuring it out. # the primary external IP using the information from EXTIF
EXTIP="auto"
# Pattern for finding the default external interface IP address
# Only used if EXTIP is set to auto
# #
# Common patterns for getting default route: # Thanks to the people at:
# netstat -rn | awk '/^0.0.0.0/{print $8}' # http://www.linuxquestions.org/questions/programming-9/using-grep-and-awk-to-get-ip-address-627626/
# ip route | awk -F '/^default/{print $3}' #
# Uncomment one of these if the default doesn't work
#EXTIP_FIND=$(expr "`ifconfig ${EXTIF}`" : '.*inet addr:\([^ ]*\).*')
#EXTIP_FIND=`ifconfig ${EXTIF}| awk -F ' *|:' '/inet addr/{print $4}'`
# Pattern for finding the default external interface
# Only used if EXTIF is set to auto
#
# Uncomment one of these if the default doesn't work
#EXTIF_FIND=`ip route | awk '/^default/{print $3}'` #EXTIF_FIND=`ip route | awk '/^default/{print $3}'`
#EXTIF_FIND=`netstat -rn | awk '/^0.0.0.0/{print $8}'`
# Internal Interface # Internal Interface
#INTINF=ppp+ #INTINF=ppp+