Files
Knowledge/sunyard/自定义路由配置.md

63 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
route ADD -p 172.1.4.32 MASK 255.255.255.255 172.1.41.252 IF 17
route ADD -p 172.1.40.0 MASK 255.255.254.0 172.1.41.252 IF 17
route ADD -p 172.1.0.0 MASK 255.255.0.0 172.1.41.252 IF 17
tracert 172.1.4.32
IPv4 路由表
===========================================================================
活动路由:
网络目标 网络掩码 网关 接口 跃点数
0.0.0.0 0.0.0.0 172.1.41.254 172.1.40.147 200
0.0.0.0 0.0.0.0 192.168.123.250 192.168.123.131 115
127.0.0.0 255.0.0.0 在链路上 127.0.0.1 331
127.0.0.1 255.255.255.255 在链路上 127.0.0.1 331
127.255.255.255 255.255.255.255 在链路上 127.0.0.1 331
172.1.0.0 255.255.0.0 172.1.41.254 172.1.40.147 150
172.1.4.32 255.255.255.255 172.1.41.252 172.1.40.147 110
172.1.40.147 255.255.255.255 在链路上 172.1.40.147 356
172.21.192.0 255.255.240.0 在链路上 172.21.192.1 271
172.21.192.1 255.255.255.255 在链路上 172.21.192.1 271
172.21.207.255 255.255.255.255 在链路上 172.21.192.1 271
192.168.123.0 255.255.255.0 在链路上 192.168.123.131 356
192.168.123.131 255.255.255.255 在链路上 192.168.123.131 356
192.168.123.255 255.255.255.255 在链路上 192.168.123.131 356
224.0.0.0 240.0.0.0 在链路上 127.0.0.1 331
224.0.0.0 240.0.0.0 在链路上 172.1.40.147 356
224.0.0.0 240.0.0.0 在链路上 192.168.123.131 356
224.0.0.0 240.0.0.0 在链路上 172.21.192.1 271
255.255.255.255 255.255.255.255 在链路上 127.0.0.1 331
255.255.255.255 255.255.255.255 在链路上 172.1.40.147 356
255.255.255.255 255.255.255.255 在链路上 192.168.123.131 356
255.255.255.255 255.255.255.255 在链路上 172.21.192.1 271
===========================================================================
永久路由:
网络地址 网络掩码 网关地址 跃点数
172.1.0.0 255.255.0.0 172.1.41.254 50
172.1.4.32 255.255.255.255 172.1.41.252 10
===========================================================================
@echo off
netsh interface ipv4 delete destinationcache
# 删除所有可能冲突的路由
route DELETE 172.1.0.0
route DELETE 172.1.4.32 2>nul
# 添加172.1.0.0/16路由,强制走172.1.41.254
route ADD -p 172.1.0.0 MASK 255.255.0.0 172.1.41.254 METRIC 50
# 如果需要172.1.4.32走特定网关
route ADD -p 172.1.4.32 MASK 255.255.255.255 172.1.41.252 METRIC 10
# 调整默认路由优先级(确保非172.1.0.0/16走192.168.123.250)
route CHANGE 0.0.0.0 MASK 0.0.0.0 192.168.123.250 METRIC 100
route CHANGE 0.0.0.0 MASK 0.0.0.0 172.1.41.254 METRIC 200
# 刷新
ipconfig /flushdns