麻烦与Windows持久路由

我有一台笔记本电脑,使用DHCP无线连接到192.168.1.0/24networking,并且连接到10.10.10.0/24networking静态设置,并且设置了默认网关(NO DEFAULT GATEWAY)。

目标是使用无线networking(192.168.1.1)和内部networking(10.10.10.0/24,10.10.20.0/24等… 10.10.60.0/24)上的默认网关访问外部地址有线网卡。 所以我添加了下面的持久路由:

=========================================================================== Persistent Routes: Network Address Netmask Gateway Address Metric 10.10.60.0 255.255.255.0 10.10.10.1 1 10.10.50.0 255.255.255.0 10.10.10.1 1 10.10.40.0 255.255.255.0 10.10.10.1 1 10.10.20.0 255.255.255.0 10.10.10.1 1 10.10.30.0 255.255.255.0 10.10.10.1 11 10.10.10.0 255.255.255.0 10.10.10.1 1 =========================================================================== The routing table is the following: IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.110 2 10.10.10.0 255.255.255.0 On-link 10.10.10.27 266 10.10.10.0 255.255.255.0 10.10.10.1 10.10.10.27 11 10.10.10.27 255.255.255.255 On-link 10.10.10.27 266 10.10.10.255 255.255.255.255 On-link 10.10.10.27 266 10.10.30.0 255.255.255.0 10.10.10.1 10.10.10.27 21 10.10.50.0 255.255.255.0 10.10.10.1 10.10.10.27 11 127.0.0.0 255.0.0.0 On-link 127.0.0.1 331 127.0.0.1 255.255.255.255 On-link 127.0.0.1 331 127.255.255.255 255.255.255.255 On-link 127.0.0.1 331 192.168.1.0 255.255.255.0 On-link 192.168.1.110 257 192.168.1.110 255.255.255.255 On-link 192.168.1.110 257 192.168.1.255 255.255.255.255 On-link 192.168.1.110 257 224.0.0.0 240.0.0.0 On-link 127.0.0.1 331 224.0.0.0 240.0.0.0 On-link 10.10.10.27 266 224.0.0.0 240.0.0.0 On-link 192.168.1.110 257 255.255.255.255 255.255.255.255 On-link 127.0.0.1 331 255.255.255.255 255.255.255.255 On-link 10.10.10.27 266 255.255.255.255 255.255.255.255 On-link 192.168.1.110 257 

但是,毕竟这些数据包是错误的:

 C:\WINDOWS\system32>tracert -d 10.10.60.1 Tracing route to 10.10.60.1 over a maximum of 30 hops 1 5 ms 3 ms 3 ms 192.168.1.1 ============================================== ^C C:\WINDOWS\system32> 

为什么数据包采取192.168.1.1的方式?

数据包不应该持续路由(10.10.10.1)?

你重新启动networking或启用/禁用适配器? 您可能需要重新启动TCP堆栈才能识别新的路由select。 只是一个想法。

我通常做的是以下

 route add 10.0.0.0 mask 255.0.0.0 10.28.15.201 -p 

除了上面的内容外,你应该总是添加接口号(如果你以后不打算交换接口的话)

 route add 10.0.0.0 mask 255.0.0.0 10.28.15.201 -p IF 12 

(接口列表在路由打印中显示)

我只是添加了两个接口的网关,Windows给了我警告,有网关冲突,我只是说好,然后在特定的接口添加路线,它为我工作。

这是我用上面提到的路由添加实现的

 C:\Users\Administrator>route print =========================================================================== Interface List 23...00 25 90 f5 61 66 ......Hyper-V Virtual Ethernet Adapter #3 21...00 25 90 f5 61 67 ......Hyper-V Virtual Ethernet Adapter #2 15...00 25 90 f5 61 69 ......Intel(R) I350 Gigabit Network Connection #4 12...00 25 90 f5 61 68 ......Intel(R) I350 Gigabit Network Connection 1...........................Software Loopback Interface 1 16...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 18...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter 49...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 174.xx.xxx.xxx 174.xx.xxx.yyy 261 0.0.0.0 0.0.0.0 10.28.147.1 10.28.147.4 261 10.0.0.0 255.0.0.0 10.28.147.1 10.28.147.4 6 10.28.147.0 255.255.255.192 On-link 10.28.147.4 261 10.28.147.4 255.255.255.255 On-link 10.28.147.4 261 10.28.147.63 255.255.255.255 On-link 10.28.147.4 261 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 174.xx.xx.zzz 255.255.255.248 On-link 174.xx.xxx.yyy 261 174.xx.xxx.yyy 255.255.255.255 On-link 174.xx.xxx.yyy 261 174.xx.xx.255 255.255.255.255 On-link 174.xx.xxx.yyy 261 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 174.xx.xxx.yyy 261 224.0.0.0 240.0.0.0 On-link 10.28.147.4 261 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 174.xx.xxx.yyy 261 255.255.255.255 255.255.255.255 On-link 10.28.147.4 261 =========================================================================== Persistent Routes: Network Address Netmask Gateway Address Metric 10.0.0.0 255.0.0.0 10.28.147.1 1 0.0.0.0 0.0.0.0 174.xx.xxx.xxx Default 0.0.0.0 0.0.0.0 174.xx.xxx.xxx 256 0.0.0.0 0.0.0.0 10.28.147.1 Default 0.0.0.0 0.0.0.0 10.28.147.4 Default =========================================================================== IPv6 Route Table =========================================================================== =========================================================================== Persistent Routes: None C:\Users\Administrator>tracert -d 10.28.147.53 Tracing route to 10.28.147.53 over a maximum of 30 hops 1 <1 ms <1 ms <1 ms 10.28.147.53 Trace complete. C:\Users\Administrator>