The route_ws2008 command in Windows

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

The route_ws2008 command helps display and modify items in the local IP routing table. If used without parameters, the route_ws2008 command will show help.To learn more about how to use this command, see the example section below.

Syntax of route_ws2008 command

 route [/ f] [/ p] [  [] [mask] [] [metric]] [if]] 

Parameters

Describe

/ f

Delete the routing table of all entries (entries) that are not server routes (host routes - routes with netmask of 255.255.255.255), loop network (loopback network route - routes available) The destination point is 127.0.0.0 and the netmask is 255.0.0.0) or a multicast route (multicast route - routes with destination points are 224.0.0.0 and netmask is 240.0.0.0).If this parameter is used with one of the commands (such as adding, changing or deleting), the routing table will be deleted before running the command.

/ p

When used with the add command, the specified route will be added to the registry and used to initialize the IP routing table whenever the TCP / IP protocol is launched.By default, the added routes will not be preserved when the TCP / IP protocol starts.When used with the print command, the Persistent route list is displayed.As for other commands, this parameter will be dropped.Continuous and stable routes will be stored at: HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet ServicesTcpip Parameters PersistentRoutes.

 

Specify the command you want to run.The following list lists valid commands:

- add: Add a route.

- change: Modify an existing route.

- delete: Delete a route or route.

- print: Print one or more routes.

 

Specify network destination points of routes.The destination can be an IP network address (where the storage bits of the network address are set to 0), an IP address for the server route, or 0.0.0.0 for the default route.

mask

Specify network destination points of routes.The destination can be an IP network address (where the storage bits of the network address are set to 0), an IP address for the server route, or 0.0.0.0 for the default route.

 

Specify the next forwarding IP address or hop that the set of addresses is determined by the destination network (network destination) and the accessible Netmask.For locally attached subnet routes, the gateway address is the IP address assigned to the subnet (subnet) assignment.For remote routes, available on one or more routers, the gateway address is the directly accessible IP address assigned to the neighboring router.

metric

Specify an integer cost metric (from 1 to 9999) for routes.This data is used when it is necessary to select a fire between different routes in the routing table that best matches the destination address of the packet being forwarded.The route with the lowest index will be selected.Data can reflect the number of hops, path speed, path reliability, path throughput, or administrative properties.

if

Specify the interface index for the interface through which the destination can be accessed.For a list of interface and corresponding interface index, use the print command display.You can use decimal or hexadecimal values ​​for the interface index.For hexadecimal values, set '0x' before the hexadecimal number.When the if parameter is omitted, the interface will be determined from the default gateway address.

/?

Show help at thecommand prompt.

Route_ws2008 command comment

  1. Large values ​​(metrics) in the metric column of the routing table are the result of allowing TCP / IP to automatically determine the data for routes in the routing table based on the IP address configuration, subnet mask and port default for each LAN interface.The auto-interface interface feature (enabled by default) determines the speed of each interface and adjusts the routes data for each interface, thereby, making the fastest interfaces available. create routes with the lowest index.To remove large values, you must disable automatic interface metrics from the advanced properties of the TCP / IP protocol for each LAN connection.
  2. The name can be used for the destination if an appropriate entry exists in the local network file stored in the systemrootSystem32Drivers Etc. folder.Names can also be used for ports as long as they can be resolved into IP addresses through standard host name resolution techniques such as Domain Name System (DNS) queries, use Local server files are stored in the systemrootsystem32driversetc and NetBIOS name resolution (NetBIOS name resolution).
  3. If the command is printed or deleted, the Gateway parameter can be omitted and wildcards can be used for destination and port.The target value can be a wildcard value specified by an asterisk (*).If the target value is specified with an asterisk (*) or a question mark (?), It means that the target value is treated as a wildcard and only matching destination routes are printed or deleted.The asterisk will match the strings and the question mark will be matched with the menu.Example: 10. *.1, 192.168.*, 127. * and * 224 * are all valid use values ​​of wildcards as asterisks.
  4. The use of an invalid combination between the target value and the netmask will show an error message: "Route: bad gateway address netmask".This error message appears when the destination point contains one or more bits set to a bit position, in which the corresponding netmask bit is set to 0. To test this condition, denote the destination and netmask by signature. binary brand.The binary symbol Netmask consists of a series of 1 bits (to represent the network address part of the destination) and a sequence of 0 bits (to indicate the host address of the destination).Check to determine if the server address has any bits in the destination set to 1 (as used for netmask).
  5. The / p parameter is only supported on the route command (route command) for Windows NT 4.0, Windows 2000, Windows Millennium edition, Windows XP and Windows Server 2003. This parameter will not be supported by the route command in Windows 95 or Windows 98.
  6. This command can only be used if the Internet Protocol (TCP / IP) protocol is installed as a component in the properties of the network adapter in Network Connections.

Example route_ws2008 command

To display the entire contents of the IP routing table, enter:

 route print 

To display the routes in the IP routing table starting with 10, enter:

 route print 10. * 

To add a default route with the default gateway address of 192.168.12.1, enter:

 route add 0.0.0.0 mask 0.0.0.0 192.168.12.1 

To add a route to destination 10.41.0.0 with a subnet mask of 255.255.0.0 and the next hop address is 10.27.0.1, enter:

 route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 

To add a persistent route to destination 10.41.0.0 with a subnet mask of 255.255.0.0 and the next hop address is 10.27.0.1, enter:

 route / p add 10.41.0.0 mask 255.255.0.0 10.27.0.1 

To add a route to destination destination 10.41.0.0 with a subnet mask of 255.255.0.0, the next hop address is 10.27.0.1 and the cost-metric is 7, enter:

 route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7 

To add a route to destination destination 10.41.0.0 with a subnet mask of 255.255.0.0, the next hop address is 10.27.0.1, and using the index interface 0x3, enter:

 route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3 

To delete a route to destination 10.41.0.0 with a subnet mask of 255.255.0.0, enter:

 route delete 10.41.0.0 mask 255.255.0.0 

To delete all routes in the IP routing table starting with 10, enter:

 route delete 10. * 

To change the next hop address of the route with the destination of 10.41.0.0 and the subnet mask of 255.255.0.0 from 10.27.0.1 to 10.27.0.25, enter:

 route change 10.41.0.0 mask 255.255.0.0 10.27.0.25 

See more:

  1. Summary of 20 common Run commands on Windows operating system
  2. Summary of shortcuts to know in Windows 10
  3. Basic Linux commands everyone needs to know
  4. Table summarizes the basic PowerShell commands
5 ★ | 1 Vote