wuantony0701 / autoddvpn

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

嘗試直接修改ip_up ip_down的方式 #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
今天嘗試一種新方法,直接讓rc_firewall來修改這兩個file

/tmp/pptpd_client/ip_up
/tmp/pptpd_client/ip_down

如此一來VPN撥上或斷線就會自動執行必要的動作,這樣的配��
�可能會比全部在rc_firewall裡面做還可靠。

rc_firewall內容如下

cd /tmp;wget http://autoddvpn.googlecode.com/svn/trunk/run-dev.sh && ( /bin/sh 
/tmp/run-dev.sh & )

開機之後執行log如下

root@DD-WRT:/tmp# tail -f autoddvpn.log 
[INFO#458] 01/Jan/1970:00:00:24 log starts
[INFO#458] 01/Jan/1970:00:00:24 fetch vpnup.sh
[INFO#458] 01/Jan/1970:00:00:25 fetch vpndown.sh
[INFO#458] 01/Jan/1970:00:00:26 fetch check.sh
[INFO#458] 01/Jan/1970:00:00:27 modifying /tmp/pptpd_client/ip-up
/tmp/pptpd_client/ip-up not exists, sleep 10sec.
/tmp/pptpd_client/ip-up not exists, sleep 10sec.
/tmp/pptpd_client/ip-up not exists, sleep 10sec.
[INFO#458] 19/Jul/2010:00:40:55 /tmp/pptpd_client/ip-up modified
[INFO#458] 19/Jul/2010:00:40:55 modifying /tmp/pptpd_client/ip-down
[INFO#458] 19/Jul/2010:00:40:55 /tmp/pptpd_client/ip-down modified
[INFO#458] 19/Jul/2010:00:40:55 ALL DONE. Let's wait for VPN being connected.

接著只需要用ifconfig ppp0 or ifconfig ppp1  
看看是否pptp連上,如果連上之後會自動執行/tmp/vpnup.sh 
如果斷線則會自動執行 /tmp/vpndown.sh

目前看起來還不錯。

Original issue reported on code.google.com by pahud...@gmail.com on 18 Jul 2010 at 4:44

GoogleCodeExporter commented 8 years ago
目前這個方法唯一的缺點就是wget有時候會卡住抓不下來file,
而ddwrt的wget似乎沒有提供timeout參數可以使用。

Original comment by pahud...@gmail.com on 18 Jul 2010 at 4:45

GoogleCodeExporter commented 8 years ago
這個問題即將在這裡獲得解決
http://code.google.com/p/autoddvpn/issues/detail?id=13

Original comment by pahud...@gmail.com on 18 Jul 2010 at 8:03

GoogleCodeExporter commented 8 years ago
JFFS方式也獲得了解決
http://code.google.com/p/autoddvpn/wiki/jffs

Original comment by pahud...@gmail.com on 19 Jul 2010 at 9:22

GoogleCodeExporter commented 8 years ago

Original comment by pahud...@gmail.com on 19 Jul 2010 at 9:23