window route cli

最後更新: 2020-10-23

目錄

  • Add Route
  • Delete Route

 


Add Route

 

Usage

route add <dest> mask <mask> <gw> [metric <cost>]

i.e.

route add 10.0.0.0 mask 255.0.0.0 192.168.0.1 metric 2

Persistent route:

-p      # persistent route

i.e.

route add 8.8.8.8 mask 255.255.255.255 192.168.88.5 -p

route add 192.168.2.0 mask 255.255.255.0 192.168.3.254 -p

Registry

# Win 10

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes

String Value

8.8.8.8,255.255.255.255,192.168.88.5,1

 


Delete Route

 

route add 8.8.8.8 mask 255.255.255.255 192.168.88.5 -p

route print

...
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0     192.168.88.1  Default
          8.8.8.8  255.255.255.255     192.168.88.5       1
...

route delete 8.8.8.8