Add a route under windows

1.  First, enter cmd in the "Run" window (press WIN+R to open the run window), and then press Enter to enter the command line.

2. Enter the route command on the command line, and a corresponding prompt will appear.

ROUTE [-f] [-p] [-4|-6] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]

  -f Clear the routing table of all gateway entries. If used in conjunction with a command, the                routing table should be cleared
               before running the command .   -p When used with the ADD command, sets the route to                persist during system boot. By default,                routes are not saved when the system is restarted. All other commands are ignored,                which always affects the corresponding permanent route. Windows 95                does not support this option.   -4 Forces use of IPv4.   -6 Forces the use of IPv6.   One of the commands:                  PRINT print route                  ADD add route                  DELETE delete route                  CHANGE modify the existing route   destination   specifies the network address of the destination host or destination network segment .















  MASK specifies that the next parameter is the "netmask" value.
  netmask       specifies the subnet mask value of this routing item (the subnet mask of the destination host or destination network segment) .
               If not specified, it defaults to 255.255.255.255.
  gateway Specifies the gateway (next hop).
  interface Specifies the interface number of the route.
  METRIC specifies the number of metric, such as the cost of the goal.


Example:

1. View all routing table information

route print

2. Add a routing entry

route add 157.0.0.0 MASK 255.0.0.0  157.55.80.1 

route add 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3

route add 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2

3. Add a permanent route entry ( -p means permanent route, it will not be lost after restart )

route -p add 157.0.0.0 MASK 255.0.0.0  157.55.80.1 

4. Delete the routing entry

route delete 157.0.0.0

5. Modify routing entries ( CHANGE is only used to modify gateway and/or metric )

route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324079574&siteId=291194637