if [ "x$CHECK_BR" = "x" ]
then
echo "$BR does not exist! create it"
- BASEIPADDR=`ip addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1`
+ #BASEIPADDR=`ip addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1`
brctl addbr $BR
else
BASEIPADDR=`ip addr show $BR | awk '/inet / {print $2}' | cut -d/ -f1`
fi
brctl addif $BR $1
+#######
+if [ "x$BASEIPADDR" = "x" ]
+then
+ echo "Default BASEIPADDR: 192.168.7.1"
+ BASEIPADDR=192.168.7.1
+fi
+#######
+
echo "Add the default route."
if [ "x$NETMASK" = "x" ];then
echo "netmask is NULL"
fi
NET=`netstat -rn | grep ^0.0.0.0 | awk '{print $8}'`
echo "NET: $NET"
+
+##############
+sudo iptables -I FORWARD 1 -i $BR -j ACCEPT
+sudo iptables -I FORWARD 1 -o $BR -j ACCEPT
+sudo iptables -I INPUT 1 -i $BR -j ACCEPT
+sudo iptables -I OUTPUT 1 -o $BR -j ACCEPT
+sudo iptables -A FORWARD -o $NET -j ACCEPT
+sudo iptables -t nat -A POSTROUTING -o $NET -j MASQUERADE
+#############
+
if [ "$NET" != "$BR" ]
then
echo "route add default gw $GW"