|
楼主你好,非常感谢你的教程。
我用E3200,刷的固件是Tomato Firmware 1.28.0000 MIPSR2-100 K26 USB AIO。
按你的教程我已经把virtual**up、virtual**down两个文件修改好了,但有几个问题请教:
【问题1】
在openvirtual**拨号中加入up/down脚本后,在路由表中的主机访问都正常,不在表中的都访问不了。
拨号时,如果不运行up/down脚本,默认网关是 5.5.0.1;如果运行脚本则默认网关是virtual**客户端的ip地址5.5.xxx.xxx。
不知道是什么原因,很可能这个导致不能访问静态路由表以外的所有主机。
【问题2】
不加入脚本则所有网站都可以访问(应该是通过virtual**)。但traceroute的第一条很奇怪,按说应该是virtual**的ip,可实际上第一条bogon不在路由表中,不知道是什么情况。
traceroute to www.facebook.com (66.220.146.94), 30 hops max, 38 byte packets
1 bogon (10.9.112.1) 359.925 ms 348.454 ms 345.793 ms
2 225.32.255.149.static.swiftway.net (149.255.32.225) 355.515 ms 351.947 ms 362.930 ms
3 ip81.208-100-42.static.steadfastdns.net (208.100.42.81) 353.758 ms 351.720 ms 338.528 ms
4 ip45.208-100-32.static.steadfastdns.net (208.100.32.45) 703.387 ms 730.909 ms 731.989 ms
5 ip42.208-100-32.static.steadfastdns.net (208.100.32.42) 320.830 ms 322.894 ms 328.814 ms
【问题3】
virtual**up原脚本最后执行 restart_dns,在tomato中没有这个命令,是否需要用service dnsmasq restart这个命令来代替,是否必须?
【问题4】
加入up/down脚本后,不知道为什么连接1分钟左右就超时了,断线重拨。如果不加脚本,则很稳定。
Aug 31 16:15:45 TOMATO daemon.notice openvirtual**[1601]: Initialization Sequence Completed(拨号成功)
Aug 31 16:16:49 TOMATO authpriv.info dropbear[5313]: Child connection from 192.168.1.45:4663
Aug 31 16:16:53 TOMATO authpriv.notice dropbear[5313]: Password auth succeeded for 'root' from 192.168.1.45:4663
Aug 31 16:17:14 TOMATO daemon.notice openvirtual**[1601]: [Openvirtual**_Server] Inactivity timeout (--ping-restart), restarting(超时)
【问题5】
如果不运行脚本,系统应该调用自己的updown.sh,脚本内容在后面。这个脚本的功能是否就是重新刷新DNS?这个脚本是否必须执行,特别是virtual**在down的时候?
【日志看来正常】
[INFO#8025] 31/Aug/2012:15:44:43 virtual**up.sh started
[INFO#8025] 31/Aug/2012:15:44:43 make gw 10.10.200.254
[INFO#8025] 31/Aug/2012:15:44:43 delete default gw 10.10.200.254
[INFO#8025] 31/Aug/2012:15:44:43 add default gw 5.5.219.60
[INFO#8025] 31/Aug/2012:15:44:43 adding the static routes, this may take a while.
[INFO#8025] 31/Aug/2012:15:45:06 preparing the exceptional routes
[INFO#8025] 31/Aug/2012:15:45:06 exceptional routes disabled.
[INFO#8025] 31/Aug/2012:15:45:06 exceptional routes features detail: http://goo.gl/fYfJ
[INFO#8025] 31/Aug/2012:15:45:06 virtual**up.sh ended
[INFO#8025] 31/Aug/2012:15:45:06 restarting DNS
路由表如下:
【原始的】
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.200.254 * 255.255.255.255 UH 0 0 0 eth1
10.10.200.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 10.10.200.254 0.0.0.0 UG 0 0 0 eth1
【openvirtual**拨号后,不运行up/down脚本】
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.200.254 * 255.255.255.255 UH 0 0 0 eth1
208.43.214.36 10.10.200.254 255.255.255.255 UGH 0 0 0 eth1
10.10.200.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
5.5.0.0 * 255.255.0.0 U 0 0 0 tun11
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 5.5.0.1 128.0.0.0 UG 0 0 0 tun11
128.0.0.0 5.5.0.1 128.0.0.0 UG 0 0 0 tun11
default 10.10.200.254 0.0.0.0 UG 0 0 0 eth1
【openvirtual**拨号后,运行up/down脚本】
route | grep "tun11"
5.5.0.0 * 255.255.0.0 U 0 0 0 tun11
default 5.5.219.60 0.0.0.0 UG 0 0 0 tun11
route | grep "default"
default 5.5.219.60 0.0.0.0 UG 0 0 0 tun11
【updown.sh】
#!/bin/sh
filedir=/etc/openvirtual**/dns
filebase=`echo $filedir/$dev | sed 's/\(tun\|tap\)1/client/;s/\(tun\|tap\)2/server/'`
conffile=$filebase\.conf
resolvfile=$filebase\.resolv
fileexists=
if [ ! -d $filedir ]; then mkdir $filedir; fi
if [ -f $conffile ]; then rm $conffile; fileexists=1; fi
if [ -f $resolvfile ]; then rm $resolvfile; fileexists=1; fi
if [ $script_type == 'up' ]
then
for optionname in `set | grep "^foreign_option_" | sed "s/^\(.*\)=.*$/\1/g"`
do
option=`eval "echo \\$$optionname"`
if echo $option | grep "dhcp-option WINS "; then echo $option | sed "s/ WINS /=44,/" >> $conffile; fi
if echo $option | grep "dhcp-option DNS"; then echo $option | sed "s/dhcp-option DNS/nameserver/" >> $resolvfile; fi
if echo $option | grep "dhcp-option DOMAIN"; then echo $option | sed "s/dhcp-option DOMAIN/search/" >> $resolvfile; fi
done
fi
if [ -f $conffile -o -f $resolvfile -o -n "$fileexists" ]; then service dnsmasq restart; fi
rmdir $filedir
rmdir /etc/openvirtual**
exit 0
|
|