demonnico / autoddvpn

Automatically exported from code.google.com/p/autoddvpn
1 stars 0 forks source link

路由表可能會被清空成預設的問題 #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
WAN是dhcp的情況,用一陣子之後會突然間路由表被清空,還不�
��道原因,這時必須手動執行
rc_firewall才能解決。

需要想一個辦法。

Original issue reported on code.google.com by pahud...@gmail.com on 2 Jun 2010 at 1:24

GoogleCodeExporter commented 9 years ago
剛剛又出現路由表被清空的情況
癥狀是:所有外部網路都突然連不上,只有內部網路還正常

SSH一進去以後,先檢查路由表,發現默認的vpn gw果然被清空
不管怎麼添加vpn gateway,路由器都不理
接著我加入192.168.1.1為默認(這時候可以加入)
接著刪除192.168.1.1,再加入vpn gw,此時才正常

下面是完整的SSH操作過程log
==========================================================

____  ___    __        ______ _____         ____  _  _ 
| _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || | 
|| | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_ 
||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _| 
|___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_| 

                      DD-WRT v24-sp2
                  http://www.dd-wrt.com

==========================================================

BusyBox v1.13.4 (2010-04-23 05:10:14 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

root@AirStation:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 eth0
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 eth0
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AirStation:~# route add default gw 192.168.199.1
root@AirStation:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 eth0
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 eth0
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AirStation:~# route add default gw 192.168.199.1
root@AirStation:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 eth0
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 eth0
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AirStation:~# route add default gw 192.168.1.1  
root@AirStation:~# route | tail -n 20
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 eth0
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 eth0
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
root@AirStation:~# route del default gw 192.168.1.1
root@AirStation:~# route add default gw 192.168.199.1
root@AirStation:~# route | tail -n 20
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 eth0
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 eth0
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 eth0
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 eth0
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 eth0
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 eth0
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.199.1   0.0.0.0         UG    0      0        0 ppp0
root@AirStation:~# 

Original comment by jkgd...@gmail.com on 2 Jun 2010 at 3:03

GoogleCodeExporter commented 9 years ago
不知道可不可以使用dd-wrt裡面的cron來監控路由表
一發現故障,就趕快自我修復

Original comment by jkgd...@gmail.com on 2 Jun 2010 at 3:04

GoogleCodeExporter commented 9 years ago
找到問題根源之前,恐怕也只能這樣了,我來試試看

Original comment by pahud...@gmail.com on 2 Jun 2010 at 3:06

GoogleCodeExporter commented 9 years ago
另外一台刷了13064的機器,使用Dev的ddautovpn也出現同樣的情況
下面是完整的手動SSH修理記錄

DD-WRT v24-sp2 std (c) 2009 NewMedia-NET GmbH
Release: 10/10/09 (SVN revision: 13064)
root@192.168.3.1's password: 
==========================================================

 ____  ___    __        ______ _____         ____  _  _ 
 | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || | 
 || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_ 
 ||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _| 
 |___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_| 

                       DD-WRT v24-sp2
                   http://www.dd-wrt.com

==========================================================

BusyBox v1.13.4 (2009-10-10 02:04:00 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

root@AntiGFW:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AntiGFW:~# cat /tmp/autoddvpn.log 
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#442] failed to get PPTPDEV, retry in 3 seconds
[INFO#442] got PPTPDEV as ppp0, set into nvram
[INFO#442] got PPTPGW as 192.168.199.1 , set into nvram
[INFO#442] VPN is UP, trying to modify the routing table
[INFO#558] OLDGW is 192.168.1.1
[INFO#558] delete default gw 192.168.1.1
[INFO#558] add default gw 192.168.199.1 
[INFO#558] adding the static routes, this may take a while.
[INFO#558] final check the default gw
[DEBUG#558] my current gw is 192.168.199.1
[INFO#558] static routes added
[DEBUG#442] return 0
[DEBUG#442] break
[DEBUG#1818] failed to get PPTPDEV, retry in 3 seconds
[INFO#1818] got PPTPDEV as ppp0, set into nvram
[INFO#1818] got PPTPGW as 192.168.199.1 , set into nvram
[INFO#1818] VPN is UP, trying to modify the routing table
[INFO#1886] OLDGW is 192.168.1.1
[INFO#1886] delete default gw 192.168.1.1
[INFO#1886] add default gw 192.168.199.1 
[INFO#1886] adding the static routes, this may take a while.
[INFO#1886] final check the default gw
[DEBUG#1886] my current gw is 192.168.199.1
[INFO#1886] static routes added
[DEBUG#1818] return 0
[DEBUG#1818] break
root@AntiGFW:~# route add default gw 192.168.199.1
root@AntiGFW:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AntiGFW:~# route add default gw 192.168.199.1
root@AntiGFW:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AntiGFW:~# route add default gw 192.168.1.1  
root@AntiGFW:~# route | tail -n 20
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 vlan1
root@AntiGFW:~# route del default gw 192.168.1.1
root@AntiGFW:~# route | tail -n 20
219.128.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
root@AntiGFW:~# route add default gw 192.168.199.1
root@AntiGFW:~# route | tail -n 20
112.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
114.224.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
122.64.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
110.192.0.0     192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
60.0.0.0        192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
58.32.0.0       192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
180.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
182.96.0.0      192.168.1.1     255.224.0.0     UG    0      0        0 vlan1
111.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
61.128.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
117.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
59.192.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
183.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
113.64.0.0      192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
116.128.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
120.192.0.0     192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
112.0.0.0       192.168.1.1     255.192.0.0     UG    0      0        0 vlan1
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.199.1   0.0.0.0         UG    0      0        0 ppp0
root@AntiGFW:~#

Original comment by jkgd...@gmail.com on 5 Jun 2010 at 1:51

GoogleCodeExporter commented 9 years ago
看到了,其實都是兩個gw跳掉,但是其他路由表沒有跳掉對吧
?
我在思考監控邏輯要怎麼設計,是default 
gw沒了就自動補回來就好?

Original comment by pahud...@gmail.com on 5 Jun 2010 at 2:05

GoogleCodeExporter commented 9 years ago
嗯,只有default gw消失了,其他的還在

比較奇怪的是,我是先嘗試補VPN gw,但是補不上
要先補上192.168.1.1為default gw,再刪除
才可以補上VPN gw

Original comment by jkgd...@gmail.com on 5 Jun 2010 at 2:11

GoogleCodeExporter commented 9 years ago
我已經寫好CRON script, 
正在自己測試中,如果今明兩天沒甚麼問題就丟出來給大家��
�看看。

這個CRON會有智慧型的自動修復功能。

Original comment by pahud...@gmail.com on 12 Jun 2010 at 3:12

GoogleCodeExporter commented 9 years ago
附上CRON的設置方式,check.sh可以在這邊找到
http://autoddvpn.googlecode.com/svn/trunk/cron/check.sh
請自行抓下之後scp到/tmp/下面即可。

我先這樣運行幾天看看,可以的話我再包裝一下。

Original comment by pahud...@gmail.com on 12 Jun 2010 at 7:24

Attachments:

GoogleCodeExporter commented 9 years ago
修復完成的log是這樣

root@DD-WRT:~# cat /tmp/last_check.log 
Sat Jun 12 15:31:00 UTC 2010
[DEBUG#9846] my current gw is 192.168.172.254
current default GW is not 192.168.199.1
rebuild the routing tables now
[INFO#9866] OLDGW is 192.168.172.254
[INFO#9866] delete default gw 192.168.172.254
[INFO#9866] add default gw 192.168.199.1
[INFO#9866] adding the static routes, this may take a while.
[INFO#9866] final check the default gw
[DEBUG#9866] my current gw is 192.168.199.1
[INFO#9866] static routes added
[DEBUG#9846] my current gw is 192.168.199.1
everything is GOOD, let's go back to sleep

如果正常的話則是這樣

root@DD-WRT:~# cat /tmp/last_check.log 
Sat Jun 12 15:32:00 UTC 2010
[DEBUG#10905] my current gw is 192.168.199.1
everything is GOOD, let's go back to sleep

Original comment by pahud...@gmail.com on 12 Jun 2010 at 7:32

GoogleCodeExporter commented 9 years ago
我昨晚到现在共有四次自动修复

Sat Jun 12 18:34:00 UTC 2010
[DEBUG#19241] my current gw is 192.168.172.254
current default GW is not 192.168.199.1
rebuild the routing tables now
[INFO#19280] OLDGW is 192.168.172.254
[INFO#19280] delete default gw 192.168.172.254
[INFO#19280] add default gw 192.168.199.1
[INFO#19280] adding the static routes, this may take a while.
--
Sat Jun 12 19:23:00 UTC 2010
[DEBUG#21955] my current gw is *
current default GW is not 192.168.199.1
rebuild the routing tables now
[INFO#21975] OLDGW is 192.168.172.254
[INFO#21975] delete default gw 192.168.172.254
[INFO#21975] add default gw 192.168.199.1
[INFO#21975] adding the static routes, this may take a while.
--
Sat Jun 12 21:53:00 UTC 2010
[DEBUG#28005] my current gw is *
current default GW is not 192.168.199.1
rebuild the routing tables now
[INFO#28025] OLDGW is 192.168.172.254
[INFO#28025] delete default gw 192.168.172.254
[INFO#28025] add default gw 192.168.199.1
[INFO#28025] adding the static routes, this may take a while.
--
Sun Jun 13 08:44:00 UTC 2010
[DEBUG#18375] my current gw is *
current default GW is not 192.168.199.1
rebuild the routing tables now
[INFO#18410] OLDGW is 192.168.172.254
[INFO#18410] delete default gw 192.168.172.254
[INFO#18410] add default gw 192.168.199.1
[INFO#18410] adding the static routes, this may take a while.

Original comment by pahud...@gmail.com on 13 Jun 2010 at 2:58

GoogleCodeExporter commented 9 years ago
CRON那邊請先用這樣寫法

* * * * * root /bin/sh /tmp/check.sh >> /tmp/last_check.log
使用>>的話會把log append到/tmp/last_check.log, 
而不會抹掉之前的。

等過一段時間之後可以scp出來Mac/Linux, 然後用這個指令來查詢

macbook:tmp macbook$ grep -c adding last_check.log 
4  
(表示四次自動修復)
macbook:tmp macbook$ grep -B7 adding last_check.log  > xxx.log
(把自動修復的記錄寫入新的xxx.log)

Original comment by pahud...@gmail.com on 13 Jun 2010 at 3:01

GoogleCodeExporter commented 9 years ago
上周测试已经OK。刚刚封装好脚本,再最后测试一下。

目前rc_firewall只要设置这样即可

test -f /tmp/rc_fw_done || ( echo $$ >> /tmp/rc_fw_done; test $$ -eq $(head -n1 
/tmp/rc_fw_done) && cd /tmp; sleep 10; wget 
http://autoddvpn.googlecode.com/svn/trunk/run-dev.sh -O /tmp/run-dev.sh && 
/bin/sh run-dev.sh )

不用另外在web  UI上面打开cron, 脚本会自行打开cron监控。

log大约是这样

root@DD-WRT:/tmp/cron.d# cat /tmp/autoddvpn.log 
[INFO#432] log starts
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[DEBUG#432] failed to get PPTPDEV, retry in 3 seconds
[INFO#432] got PPTPDEV as ppp0, set into nvram
[INFO#432] got PPTPGW as 192.168.199.1, set into nvram
[INFO#432] VPN is UP, trying to modify the routing table
[INFO#1144] OLDGW is 192.168.172.254
[INFO#1144] delete default gw 192.168.172.254
[INFO#1144] add default gw 192.168.199.1
[INFO#1144] adding the static routes, this may take a while.
[INFO#1144] final check the default gw
[DEBUG#1144] my current gw is 192.168.199.1
[INFO#1144] static routes added
[DEBUG#432] return 0
[INFO#432] preparing the self-fix script
[INFO#432] preparing the cron_job
[DEBUG#432] break

Original comment by pahud...@gmail.com on 21 Jun 2010 at 6:29

GoogleCodeExporter commented 9 years ago
這個bug已經在今天正式修復

http://twitter.com/autoddvpn/status/16764005466

Original comment by pahud...@gmail.com on 22 Jun 2010 at 11:02