電訊茶室's Archiver

gfx86674 發表於 2015-1-7 18:23

使用筑波大學VPN瀏覽日本網站

[i=s] 本帖最後由 gfx86674 於 2015-1-11 19:06 編輯 [/i]

[img]http://i.imgur.com/u40rmW4.jpg[/img]
透過[url=http://www.vpngate.net/cn/]築波大學VPN[/url],可以借由自願者提供的VPN Server,讓個人用戶翻網至目的地.

而透過RouterOS的VPN-Client ,除可代替電腦VPN撥號連線Share給更多人使用
[img]http://i.imgur.com/mLBg4Kc.png[/img]
再搭配地址清單 ,透過Address-list ([url=https://dl.dropboxusercontent.com/u/34743921/JapanIPList.rsc]jp[/url] ;[url=https://dl.dropboxusercontent.com/u/34743921/ChinaIPList.rsc] cn[/url])
如瀏覽日本 ,才透過VPN將封包送至遠端 ;
而本國還是續用Default Routing ,這樣瀏覽網路效率才會高.無需在重複開/關VPN.

以L2TP over IPSec 為例 ,設定用戶瀏覽日本時的相關策略.[code]/ip ipsec policy
add comment="\B5\AE\AAi\A4j\BE\C7VPN" dst-address=121.2.77.177/32 protocol=udp \
    sa-dst-address=121.2.77.177 sa-src-address=192.168.2.7 src-address=\
    192.168.2.7/32

/ip ipsec peer
add address=121.2.77.177/32 comment="\B5\AE\AAi\A4j\BE\C7VPN" dpd-interval=\
    disable-dpd enc-algorithm=3des secret=vpn send-initial-contact=no

/interface l2tp-client
add add-default-route=no allow=mschap2 comment="\B5\AE\AAi\A4j\BE\C7VPN" \
    connect-to=121.2.77.177 dial-on-demand=no disabled=no keepalive-timeout=\
    60 max-mru=1452 max-mtu=1452 mrru=disabled name=VPN_Gate password=vpn \
    profile=default-encryption user=vpn

/ip route
add comment="\B5\AE\AAi\A4j\BE\C7VPN" distance=4 gateway=VPN_Gate \
    routing-mark=to_vpngate

/ip firewall nat
add action=masquerade chain=srcnat comment="\B5\AE\AAi\A4j\BE\C7VPN" \
    out-interface=VPN_Gate

/ip firewall mangle
add action=mark-routing chain=prerouting comment="\B5\AE\AAi\A4j\BE\C7VPN" \
    dst-address-list=JapanIPList dst-port=80 new-routing-mark=to_vpngate \
    passthrough=no protocol=tcp
add action=mark-routing chain=output dst-address-list=JapanIPList \
    new-routing-mark=to_vpngate passthrough=no protocol=icmp
[/code]但問題是VPN Server是自願者提供的 ,伺服器有可能隨時被回收無法使用{:5_214:}
就算順利的掛上VPN  ,連線只要超過一分鐘沒送出封包就會被判定timeout ,
想要再使用得先再斷線再重新連線,諸多問題不如想像中的簡單...

所以還是得請出Script幫忙 ,流程如下:
建立[color=Red]筑波大學VPN的伺服器清單[/color] ,透過腳本自動挑選可用的連線.
[img]http://i.imgur.com/G05Fa3m.png[/img]
當VPN斷線後 ,腳本重新連接時即從ping 伺服器開始 ,
通過ping測試的伺服器 ,Router才會試著連接.

VPN連接後腳本會每隔12秒透過VPN通道ping日本主機 ,以免timeout被踢出伺服器.

假如伺服器清單的伺服器都無法使用 ,或者是可ping但仍無法連接...
則讓Scripit休息50循環(每次循環是12秒 ,所以50循環即是10分鐘) ,
等第51次循環(10分鐘)後再重新連結.
[img]http://i.imgur.com/OC3i0Ps.png[/img]

fems 發表於 2015-1-8 00:11

方法是不错,谢谢分享,这种资源留给有需要的人吧

czjlj 發表於 2015-2-9 10:38

[i=s] 本帖最後由 czjlj 於 2015-2-9 12:31 編輯 [/i]

希望楼主能放出Script代码,非常感谢!
另外用SSTP方式无法连接呢?用windows自带的就可以。还有ovpn的方式连接,能提供相关指导么?

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.