发新话题
打印

Windows下VPN连接后再添加路由

Windows下VPN连接后再添加路由

let's show how to use route add command under windows xp or 2003 to add a gateway on vpn connections.

firstly , supposing the default gateway on vpn connection is unchecked. ( i prefer this way )

and then rasdial to connect the vpn.

and then
route print -4
to show the table, as below:

C:\Users\Administrator>route print -4
===========================================================================
Interface List
19...........................clochase
12...e8 9a 8f c9 22 17 ......Qualcomm Atheros AR8151 PCI-E Gigabit Ethernet Con
troller (NDIS 6.20)
11...78 92 9c 57 c2 92 ......Intel(R) Centrino(R) Wireless-N 100
16...08 00 27 00 24 bc ......VirtualBox Host-Only Ethernet Adapter
  1...........................Software Loopback Interface 1
13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
18...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
===========================================================================

clearly the number before the vpn connection name is the interface id, which is used to add on-link route

let's issue a command like below
route add 192.168.3.0 mask 255.255.255.0 0.0.0.0 IF 19

ok! it's done. let's print again.

C:\Users\Administrator>route add 192.168.3.0 mask 255.255.255.0 0.0.0.0 if 19
OK!

C:\Users\Administrator>route print -4
===========================================================================
Interface List
19...........................clochase
12...e8 9a 8f c9 22 17 ......Qualcomm Atheros AR8151 PCI-E Gigabit Ethernet Con
troller (NDIS 6.20)
11...78 92 9c 57 c2 92 ......Intel(R) Centrino(R) Wireless-N 100
16...08 00 27 00 24 bc ......VirtualBox Host-Only Ethernet Adapter
  1...........................Software Loopback Interface 1
13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
18...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.2    192.168.1.105     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.1.0    255.255.255.0         On-link     192.168.1.105    281
    192.168.1.105  255.255.255.255         On-link     192.168.1.105    281
    192.168.1.255  255.255.255.255         On-link     192.168.1.105    281
      192.168.2.0    255.255.255.0    192.168.3.254    192.168.2.254     26
    192.168.2.254  255.255.255.255         On-link     192.168.2.254    281
      192.168.3.0    255.255.255.0         On-link     192.168.2.254     26
    192.168.3.255  255.255.255.255         On-link     192.168.2.254    281
     192.168.56.0    255.255.255.0         On-link      192.168.56.1    276
     192.168.56.1  255.255.255.255         On-link      192.168.56.1    276
   192.168.56.255  255.255.255.255         On-link      192.168.56.1    276
   222.247.55.130  255.255.255.255      192.168.1.2    192.168.1.105     26
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link      192.168.56.1    276
        224.0.0.0        240.0.0.0         On-link     192.168.1.105    281
        224.0.0.0        240.0.0.0         On-link     192.168.2.254    281
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link      192.168.56.1    276
  255.255.255.255  255.255.255.255         On-link     192.168.1.105    281
  255.255.255.255  255.255.255.255         On-link     192.168.2.254    281
===========================================================================
Persistent Routes:
  None

原文: https://licanli.wordpress.com/2014/04/11/route-add-on-link/

TOP

发新话题