你好我配置了以下内容持久路由在我的Windows Server上。
route -p ADD 10.32.1.40 MASK 255.255.255.255 172.16.8.254
route -p ADD 10.192.1.40 MASK 255.255.255.255 172.16.8.254
它们最初工作正常,但当我重新启动时,它们不再工作,并且不再显示为活动路由。这是怎么回事?
我的路线打印输出如下所示
Tracing route to 10.192.1.40
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 10.129.81.11
2 <1 ms <1 ms <1 ms 10.222.129.5
3 17 ms 4 ms 4 ms 10.48.1.121
4 1 ms 1 ms 1 ms 10.222.13.13
5 4 ms 4 ms 4 ms 10.222.13.14
6 * * * Request timed out.
7 * * * Request timed out.
8 * * * Request timed out.
9 * * * Request timed out.
10 * * * Request timed out.
11 PS C:\Users\Administrator> route print
===========================================================================
Interface List
12 ...00 50 56 bb 76 d2 ...... Intel(R) PRO/1000 MT Network Connection #2
11 ...00 50 56 bb 47 c4 ...... Intel(R) PRO/1000 MT Network Connection
1 ........................... Software Loopback Interface 1
14 ...00 00 00 00 00 00 00 e0 isatap.{B96D2DBB-444E-4452-ADD3-E20B7A534D11}
13 ...00 00 00 00 00 00 00 e0 isatap.{7D99C8C8-276A-4232-A137-BA84ACBD738D}
10 ...02 00 54 55 4e 01 ...... Teredo Tunneling Pseudo-Interface
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.129.81.10 10.129.81.234 266
10.10.110.0 255.255.255.0 172.16.6.254 172.16.6.234 11
10.129.81.0 255.255.255.0 On-link 10.129.81.234 266
10.129.81.234 255.255.255.255 On-link 10.129.81.234 266
10.129.81.255 255.255.255.255 On-link 10.129.81.234 266
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
172.16.0.0 255.255.0.0 172.16.6.254 172.16.6.234 11
172.16.6.0 255.255.255.0 On-link 172.16.6.234 266
172.16.6.234 255.255.255.255 On-link 172.16.6.234 266
172.16.6.255 255.255.255.255 On-link 172.16.6.234 266
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 172.16.6.234 266
224.0.0.0 240.0.0.0 On-link 10.129.81.234 266
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 172.16.6.234 266
255.255.255.255 255.255.255.255 On-link 10.129.81.234 266
===========================================================================
Persistent Routes:
Network Address Netmask Gateway Address Metric
10.10.110.0 255.255.255.0 172.16.6.254 1
172.16.0.0 255.255.0.0 172.16.6.254 1
10.32.1.40 255.255.255.255 172.16.8.254 1
10.192.1.40 255.255.255.255 172.16.8.254 1
0.0.0.0 0.0.0.0 10.129.81.10 Default
===========================================================================
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
1 306 ::1/128 On-link
1 306 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
根据这个帖子最具体的子网掩码应优先考虑。我确信我不能得到比 255.255.255.255 更具体的子网掩码
更多信息:我可以 ping 我正在尝试操纵的网关
PS C:\Users\Administrator> ping 172.16.8.254
Pinging 172.16.8.254 with 32 bytes of data:
Reply from 172.16.8.254: bytes=32 time=3ms TTL=255
Reply from 172.16.8.254: bytes=32 time=1ms TTL=255
Reply from 172.16.8.254: bytes=32 time=4ms TTL=255
Reply from 172.16.8.254: bytes=32 time=2ms TTL=255
tracert的结果:
PS C:\Users\Administrator> tracert 10.32.1.40
Tracing route to pen-srv1 [10.32.1.40]
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 10.129.81.11
2 <1 ms <1 ms <1 ms 10.222.129.5
3 1 ms 1 ms 1 ms 172.29.150.10
4 2 ms 1 ms 1 ms 172.29.150.9
5 * * * Request timed out.
它不断跳转到错误的网络。
答案1
因此,在尝试使用子网掩码、接口参数、更改其他路由的度量等之后,我放弃了,删除了持久路由,并编写了一个简单的批处理脚本,在服务器启动时将路由(非持久)添加到路由表中。
有时software name
只是存在software name
。
因此,我创建了一个包含 2 个路由 ADD 命令的 .bat 文件(不带 -p 参数,这会使它们持久化)。将其保存到C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup
文件夹中,然后将 .bat 脚本添加到启动脚本。
.bat 文件的内容非常简单:
route ADD 10.32.1.40 MASK 255.255.255.255 172.16.8.254
route ADD 10.192.1.40 MASK 255.255.255.255 172.16.8.254
感谢@harrymc 的建议。悬赏已颁发!
答案2
持久路线有时不会持续,且没有任何解释。
尝试将接口参数添加到路由命令,但如果问题仍然出现,您可以考虑添加重新建立这些路由的启动脚本。