2010年12月6日 星期一

VPN 對外路由 (routing ) 設定

一般來說很多VPN 連上去以後,

就不能連到外網,

這個教學是為了讓我自己不要忘記如何設定,

連上VPN 以後又可以連到外網同時工作。

如果有任何問題可以寄Mail 給我,歡迎大家討論。

一. 先將原本的 routing 印出,等等會用到

C:\Documents and Settings\Administrator>netstat -r

Route Table
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 1f e1 e4 af a2 ...... 藍芽 LAN 存取伺服器驅動程式 - Wireless Intermed
ate Driver
0x3 ...00 1f 3b 90 11 11 ...... Intel(R) Wireless WiFi Link 4965AG - Wireless I
termediate Driver
0x4 ...00 1d 72 90 17 1e ...... Intel(R) 82566MM Gigabit Network Connection - W
reless Intermediate Driver
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.123.254 192.168.123.10 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.123.0 255.255.255.0 192.168.123.10 192.168.123.10 25
192.168.123.10 255.255.255.255 127.0.0.1 127.0.0.1 25
192.168.123.255 255.255.255.255 192.168.123.10 192.168.123.10 25
224.0.0.0 240.0.0.0 192.168.123.10 192.168.123.10 25
255.255.255.255 255.255.255.255 192.168.123.10 4 1
255.255.255.255 255.255.255.255 192.168.123.10 2 1
255.255.255.255 255.255.255.255 192.168.123.10 192.168.123.10 1
Default Gateway: 192.168.123.254
===========================================================================
Persistent Routes:
None

C:\Documents and Settings\Administrator>

二.連接上 VPN

三.將連接上VPN 後的 routing 印出

C:\Documents and Settings\Administrator>netstat -r

Route Table
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 1f e1 e4 af a2 ...... 藍芽 LAN 存取伺服器驅動程式 - Wireless Intermedi
ate Driver
0x3 ...00 1f 3b 90 11 11 ...... Intel(R) Wireless WiFi Link 4965AG - Wireless In
termediate Driver
0x4 ...00 1d 72 90 17 1e ...... Intel(R) 82566MM Gigabit Network Connection - Wi
reless Intermediate Driver
0x110006 ...00 53 45 00 00 00 ...... WAN (PPP/SLIP) Interface
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.1.11.217 10.1.11.217 1
0.0.0.0 0.0.0.0 192.168.123.254 192.168.123.10 2
10.1.11.217 255.255.255.255 127.0.0.1 127.0.0.1 50
10.255.255.255 255.255.255.255 10.1.11.217 10.1.11.217 50
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.123.0 255.255.255.0 192.168.123.10 192.168.123.10 25
192.168.123.10 255.255.255.255 127.0.0.1 127.0.0.1 25
192.168.123.255 255.255.255.255 192.168.123.10 192.168.123.10 25
211.xxx.xxx.xxx 255.255.255.255 192.168.123.254 192.168.123.10 1
224.0.0.0 240.0.0.0 192.168.123.10 192.168.123.10 25
224.0.0.0 240.0.0.0 10.1.11.217 10.1.11.217 1
255.255.255.255 255.255.255.255 10.1.11.217 10.1.11.217 1
255.255.255.255 255.255.255.255 192.168.123.10 2 1
255.255.255.255 255.255.255.255 192.168.123.10 4 1
255.255.255.255 255.255.255.255 192.168.123.10 192.168.123.10 1
Default Gateway: 10.1.11.217
===========================================================================
Persistent Routes:
None

C:\Documents and Settings\Administrator>

四. 先刪除全部的 default route

C:\Documents and Settings\Administrator>route DELETE 0.0.0.0

C:\Documents and Settings\Administrator>

五. 增加對外網路的 default route ( 可參考第一次的 routing , 每個人的對外 gateway 都不同請自行判斷 )

C:\Documents and Settings\Administrator>route add 0.0.0.0 MASK 0.0.0.0 192.168.1
23.254 METRIC 25

C:\Documents and Settings\Administrator>

六.設定 VPN subnet 的 default route ( 可參考第二次的 routing , 每個人的vpn取得的ip與對外 gateway 都可能不同,請自行判斷 )

C:\Documents and Settings\Administrator>route add 10.1.0.0 MASK 255.255.0.0 10.1
.11.217 METRIC 1

C:\Documents and Settings\Administrator>

七. 應該可以同時對外又可以連VPN,可以快樂使用。

沒有留言: