Moxa W321-LX Руководство по программной части онлайн [56/80] 171179

Moxa W321-LX Руководство по программной части онлайн [56/80] 171179
W321/341 Linux
-17
# openvpn --genkey --secret secrouter.key
Copy the file that is generated to the OpenVPN machine. Be sure that both two of the devices have the
same key.
2. Generate a script file named openvpn-bridge on each OpenVPN machine. This script reconfigures
interface “eth1” as IP-less, creates logical bridge(s) and TAP interfaces, loads modules, enables IP
forwarding, etc.
#---------------------------------Start-----------------------------
#!/bin/sh
iface=eth1 # defines the internal interface
maxtap=`expr 1` # defines the number of tap devices. I.e., # of tunnels
IPADDR=
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

Содержание

Похожие устройства

Скачать
Случайные обсуждения