Moxa Technologies THINKCORE W341 User Manual

Page 68

Advertising
background image

ThinkCore W311/321/341 Linux User’s Manual

Managing Communications

4-28

NETMASK=
BROADCAST=

# it is not a great idea but this system doesn’t support
# /etc/sysconfig/network-scripts/ifcfg-eth1
ifcfg_vpn()
{
while read f1 f2 f3 f4 r3
do
if [ “$f1” = “iface” -a “$f2” = “$iface” -a “$f3” = “inet” -a “$f4” = “static” ];then
i=`expr 0`
while :
do
if [ $i -gt 5 ]; then
break
fi

i=`expr $i + 1`
read f1 f2
case “$f1” in
address ) IPADDR=$f2
;;

netmask ) NETMASK=$f2

;;
broadcast ) BROADCAST=$f2
;;
esac
done

break

fi
done < /etc/network/interfaces
}

# get the ip address of the specified interface
mname=
module_up()
{
oIFS=$IFS
IFS=‘

FOUND=“no”
for LINE in `lsmod`
do
TOK=`echo $LINE | cut -d’ ‘ -f1`
if [ “$TOK” = “$mname” ]; then
FOUND=“yes”;
break;
fi
done
IFS=$oIFS

if [ “$FOUND” = “no” ]; then
modprobe $mname
fi
}

start()
{
ifcfg_vpn
if [ ! \( -d “/dev/net” \) ]; then
mkdir /dev/net
fi

if [ ! \( -r “/dev/net/tun” \) ]; then
# create a device file if there is none
mknod /dev/net/tun c 10 200
fi


# load modules “tun” and “bridge”

Advertising
This manual is related to the following products: