我为网络 10.0.0.0 添加了一条使用 10.84.202.1 的路由。但是 tracert 显示它使用的是 192.168.1.1。
路由器上插入了热点适配器。主机仍然需要将所有 10.* 流量路由到公司路由器,但它始终选择热点适配器。
> route ADD 10.0.0.0 MASK 255.255.254.0 10.84.202.1 METRIC 1 IF 11
OK!
> tracert 10.138.33.55
Tracing route to 10.138.33.55 over a maximum of 30 hops
1 2 ms 2 ms 2 ms 192.168.1.1
2 *
> route PRINT
===========================================================================
Interface List
11...f4 ee 08 53 17 f0 ......Broadcom NetXtreme Gigabit Ethernet #2
18...f4 ee 08 53 17 ef ......Broadcom NetXtreme Gigabit Ethernet
24...78 8c b5 17 ba 81 ......TP-Link Wireless USB Adapter
13...f4 ee 08 53 17 ec ......Remote NDIS Compatible Device
20...00 ff c6 3c e0 60 ......TeamViewer VPN Adapter
22...7a 8c b5 17 ba 81 ......Microsoft Wi-Fi Direct Virtual Adapter #3
3...78 8c b5 17 ba 81 ......Microsoft Wi-Fi Direct Virtual Adapter #4
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.84.202.1 10.84.202.202 257
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.99 10
10.0.0.0 255.255.254.0 10.84.202.1 10.84.202.202 2
10.84.202.0 255.255.254.0 On-link 10.84.202.202 257
10.84.202.202 255.255.255.255 On-link 10.84.202.202 257
10.84.203.255 255.255.255.255 On-link 10.84.202.202 257
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
169.254.1.0 255.255.255.0 On-link 169.254.1.2 281
169.254.1.2 255.255.255.255 On-link 169.254.1.2 281
169.254.1.255 255.255.255.255 On-link 169.254.1.2 281
192.168.1.0 255.255.255.0 On-link 192.168.1.99 261
192.168.1.99 255.255.255.255 On-link 192.168.1.99 261
192.168.1.255 255.255.255.255 On-link 192.168.1.99 261
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 192.168.1.99 261
224.0.0.0 240.0.0.0 On-link 10.84.202.202 257
224.0.0.0 240.0.0.0 On-link 169.254.1.2 281
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 192.168.1.99 261
255.255.255.255 255.255.255.255 On-link 10.84.202.202 257
255.255.255.255 255.255.255.255 On-link 169.254.1.2 281
===========================================================================
Persistent Routes:
Network Address Netmask Gateway Address Metric
0.0.0.0 0.0.0.0 10.84.202.1 Default
===========================================================================
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
1 331 ::1/128 On-link
1 331 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
> route -p ADD 10.0.0.0 MASK 255.255.254.0 10.84.202.1 METRIC 1
OK!
> tracert 10.138.33.55
Tracing route to 10.138.33.55 over a maximum of 30 hops
1 2 ms 4 ms 2 ms 192.168.1.1
2
答案1
255.255.254.0
为什么在添加的路线中使用掩码?
如果你要添加这条路线10.0.0.0 MASK 255.255.254.0
,那么仅适用于对于从10.0.0.1
-开始的地址10.0.1.254
。如果您确实想要整个10.0.0.0
-10.255.255.255
范围,那么您的掩码应该是255.0.0.0
。