Use the route command-line tool to view and edit the IP routing table for your computer. The Route command and syntax are as follows:
Route [-F] [-P] [command][destination] [Mask Netmask] [Gateway] [metric metric] [if Interface]]
Use the route command-line tool to view and edit the IP routing table for your computer. The Route command and syntax are as follows:
Route [-F] [-P] [command][destination] [Mask Netmask] [Gateway] [metric metric] [if Interface]]
-F Clears the routing table for all gateway portals. If this parameter is used in combination with a command, the routing table is cleared before the command is run.
-P is used with the add command to make the route permanent. When used with the add command, this parameter will cause the route to persist between the system boot programs. By default, routes are not preserved when the system restarts. When used with the Print command, displays a list of registered persistent routes.
Ignore all other commands that always affect the corresponding persistent route.
command to specify the commands you want to run (add/change/delete/print).
Route type:
There are three kinds of routes
1. Host routes are mapped from one host to another on the local network
Command format:
Route Add-host Destination_ip Local_ip-interface interface
eg
We want to add a route between the local host interface HME0 (204.12.17.1) and another host (204.12.16.100) on the adjacent Class C network
#route add-host 204.12.16.100 204.12.17.1-interface HME0
2. Network routing allows packets to be transferred from the local host to other hosts on the local network
Add a direct route to another network
Command format:
Route add-net Destination_network_ip Local_ip-netmask Mask
eg
If we want to add a route (204.12.16.0 network) to the C-class netmask between the local host (204.12.17.1) and the network we indicated above, we can use the following command:
#route add-net 204.12.16.0 204.12.17.1-netmask 255.255.255.0
3. The default route will look for a routed task to be routed to a router. The default route can be used by both RIP and Rdisc daemons.
Command format:
Route add default Hostname-interface interface
Eg: Adds a default route to the local router (204.54.56.1), typically used to add a gateway and takes effect immediately
#route Add default 204.54.56.1-interface hme1
DESTINATION Specifies the network destination for this route.
The mask Netmask Specifies the network mask (also known as the subnet mask) that is associated with the network destination. If not specified, the 255.255.255.255 will be used
The Gateway specifies the address set and subnet mask defined by the network destination to reach the forward or next hop IP address.
The metric metric specifies an integer cost value for the route (from 1 to 9999) that can be used when the routing table (which matches the destination address of the forwarded packet) is selected in multiple routes.
The If Interface specifies the interface index for the interface that can access the target. That is, the data sent to a is used for interface A, the interface B is destined for B. This is useful for applications where a network card is bundled with multiple IPs of the same network segment. For example, if you bundle the *.1 and *.2 two addresses, you can specify that a host route is made with *.1, and a certain piece is made with *.2. Otherwise, by default, one IP is sent to the same subnet.
To obtain a list of interfaces and their corresponding interface indexes, use the display function of the route print command. You can use decimal or hexadecimal values for interface indexing.
/? Displays help at the command prompt.
Both the network database file named Networks and the computer name database file named Hosts all refer to the
The name of the symbol used by destination or gateway. If the command is print or delete, the destination and the gateway
You can also use wildcard characters, or omit gateway parameters.
Example
To display the entire contents of the IP routing table, type:
Route print
To display the 10. Start the route in the IP routing table, type:
Route print 10.*
To add a default route with the 192.168.12.1 default gateway address, type:
Route add 0.0.0.0 Mask 0.0.0.0 192.168.12.1
To add a route to a 10.41.0.0 destination with a 255.255.0.0 subnet mask and a 10.27.0.1 next-hop address, type:
Route add 10.41.0.0 Mask 255.255.0.0 10.27.0.1
To add a permanent route to the 10.41.0.0 destination with the 255.255.0.0 subnet mask and the 10.27.0.1 next-hop address, type:
Route-p Add 10.41.0.0 mask 255.255.0.0 10.27.0.1
To add a route to a 10.41.0.0 destination with a 255.255.0.0 subnet mask, a 10.27.0.1 next-hop address, and a cost value of 7, type:
Route add 10.41.0.0 Mask 255.255.0.0 10.27.0.1 metric 7
To add a route to the 10.41.0.0 destination with the 255.255.0.0 subnet mask, 10.27.0.1 next-hop address, and use the 0x3 interface index, type:
Route add 10.41.0.0 Mask 255.255.0.0 10.27.0.1 if 0x3
To remove a route to the 10.41.0.0 destination with the 255.255.0.0 subnet mask, type:
Route Delete 10.41.0.0 Mask 255.255.0.0
To remove the 10. Start all routes in the IP routing table, type:
Route Delete 10.*
To change the next-hop address with the 10.41.0.0 target and the 255.255.0.0 subnet mask from 10.27.0.1 to 10.27.0.25, type:
Route change 10.41.0.0 Mask 255.255.0.0 10.27.0.25
Previous: command prompt has been disabled by the system administrator. Please press any key to continue ... The Treatment method
Next:FileZilla client in Win7 to obtain the FTP directory information Error resolution method
Come from:http://www.jbxue.com/article/2955.html
Window route command