19,12 → 19,24 |
private_prefix=`/bin/ipcalc -p $private_ip_mask|cut -d"=" -f2` # LAN prefix (ie. 24) |
PRIVATE_NETWORK_MASK=$private_network/$private_prefix # Lan IP address + prefix (192.168.182.0/24) |
public_ip_mask=`grep ^PUBLIC_IP= $CONF_FILE|cut -d"=" -f2` # ALCASAR WAN IP address |
if [[ "$public_ip_mask" == "dhcp" ]] |
then |
PTN="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([012]?[0-9]|3[0-2])\b" |
$public_ip_mask=`ip addr show $EXTIF | egrep -o $PTN` |
dns1=`grep ^nameserver /etc/resolv.conf|cut -d" " -f2|head -n 1` |
nb_dns=`grep ^nameserver /etc/resolv.conf|wc -l` |
if [ $nb_dns == 2 ] |
then |
dns2=`grep ^nameserver /etc/resolv.conf|cut -d" " -f2|tail -n 1` |
fi |
else |
dns1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2` |
dns2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2` |
fi |
PUBLIC_IP=`echo $public_ip_mask | cut -d"/" -f1` |
dns1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2` # first public DNS server |
dns1=${dns1:=208.67.220.220} |
dns2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2` # second public DNS server |
dns2=${dns2:=208.67.222.222} |
DNSSERVERS="$dns1,$dns2" # first and second DNS IP servers addresses |
DNSSERVERS="$dns1,$dns2" # first and second public DNS servers |
PROTOCOLS_FILTERING=`grep ^PROTOCOLS_FILTERING= $CONF_FILE|cut -d"=" -f2` # Network protocols filter (on/off) |
PROTOCOLS_FILTERING=${PROTOCOLS_FILTERING:=off} |
BL_IP_CAT="/usr/local/share/iptables-bl-enabled" # categories files of the BlackListed IP |