Windows command-route

Source: Internet
Author: User

Windows Route Command

Add a permanent gateway:
Route add 0.0.0.0 Mask 0.0.0.0 192.168.2.1-p

Specific functions

This command is used to display and modify entries in the local IP routing table. Use a route without parameters to display help. 2. Explanation of grammarroute [-f] [-p] [command [destination] [mask netmask] [gateway] [metric metric] [if interface]3. Parameter Description- Fclears all routes that are not the primary (the subnet mask is 255.255.255.255), the loopback network route (target is 127.0.0.0, the subnet mask is 255.255.255.0), or multicast routing ( The route table for the entry of the target is 224.0.0.0, the subnet mask is 240.0.0.0. If it is used in conjunction with one of the commands (for example, add, change, or delete), the table is cleared before the command is run. - Pwhen used in conjunction with the Add command, specifies that the route is added to the registry and initializes the IP routing table when the TCP/IP protocol is started. By default, the added route is not saved when the TCP/IP protocol is started, and a permanent route list is displayed when used with the Print command. This parameter is ignored by all other commands. The location where the permanent route is stored in the registry is hkey_local_machsystemcurrentcontrolsetservicestcpipparameterspersistentroutes. command to specify the commands to run. The following table lists the valid commands. DestinationSpecifies the network destination address of the route. The destination address can be an IP network address (where the host address bit of the network address is set to 0), the IP address for the host route, and 0.0.0.0 for the default route. MaskSubnetMaskSpecifies the netmask (also known as the subnet mask) associated with the network destination address. The subnet mask can be an appropriate subnet mask for the IP network address, which is 255.255.255.255 for host routing, for the default route is 0.0.0.0. If omitted, the subnet mask 255.255.255.255 is used. When defining a route, the destination address cannot be more detailed than its corresponding subnet mask due to the relationship between the destination address and the subnet mask. In other words, if one of the subnet masks is 0, the corresponding bit in the destination address cannot be set to 1. Gatewayspecifies a previous or next hop IP address that exceeds the attainable set of addresses defined by the network destination and subnet mask. For locally connected subnets, the gateway address is the IP address assigned to the subnet interface. For remote routes to be available through one or more routers, the gateway address is a directly-accessible IP address assigned to the neighboring router. Metric MetricSpecifies the integer value of the required metric for the route (in the range 1~9999), which is used to select the route that most closely matches the destination address in the forwarding packet in multiple routes in the routing table. The selected route has a minimum number of hops. The metric can reflect the number of hops, the speed of the path, path reliability, path throughput, and administrative properties. The If interface specifies the interface index of the interface to which the target can reach. Using the routeThe Print command can display a list of interfaces and their corresponding interface indexes. You can use a decimal or hexadecimal value for an interface index. For hexadecimal values, precede the hexadecimal number with 0x. When the If parameter is ignored, the interface is determined by the gateway address. Note: The larger value of the metric column in the routing table is due to the fact that TCP/IP is allowed to automatically determine the number of hops in the route table based on the IP address, subnet mask, and default gateway configuration of each LAN interface. The auto-determined interface metric that is started by default determines the speed of each interface, adjusts the number of route hops per interface, so the fastest interface creates a route with the lowest metric. To remove large hops, disable the automatic determination of the interface metric in the advanced properties of the TCP/IP protocol for each LAN connection. if an appropriate entry exists in the local network file of the Systemrootsystem32driversetc folder, the name can be used for destination. As long as the name can be decomposed into an IP address through a standard hostname resolution technique such as a domain Name System (DNS) query, it can be used for GATEWAY,DNS queries that are stored in systemrootsystem32driversetcLocal Host file and NetBIOS name resolution under the folder. if it is a print or delete command, you can omit the gateway parameter and use wildcards to represent the target and the gateway. The value of the destination can be a wildcard character specified by an asterisk (*). If the specified target contains an asterisk (*) or a question mark (?), it is treated as a wildcard and only prints or deletes the matching destination route. The asterisk represents any one character sequence, and the question mark represents any one character. For example, 10.*.1, 192.168.*, 127.*, and *224* are all valid uses of Asterisk wildcard characters. using a combination of invalid target and subnet mask (netmask) values, the Route bad gateway address is displayednetmask "error message. This error occurs when one or more bits in the target are set to 1, and the corresponding bit in the subnet mask is set to 0. This can be checked by means of a binary notation for the target and subnet masks. The subnet mask in binary representation includes a series of 1 representing the destination network address portion and a series of 2 parts representing the destination host address portion. View the destination to determine the host address portion of the target (as defined by the subnet mask)whether some bits are set to 1. the route command for Windows 98 does not support the-P parameter. This command is available only if the TCP/IP protocol is installed as a component of the network adapter properties in a network connection. 4. Example Description     
Example 1: To display the complete contents of the IP routing table, execute the following command: Route print Example 2: To display the IP routing table with 10. Start route, execute the following command: Route printTen.*Example 3: To add a default gateway address of 192.168.12the default route for. 1, execute the following command: Route add0.0.0.0Mask0.0.0.0 192.168.12.1Example 4: To add a target of ten.41.0.0, the subnet mask is 255.255.0.0, the next hop address is 10.27.0. 1 route, execute the following command: Route add10.41.0.0Mask255.255.0.0 10.27.0.1Example 5: To add a target of ten.41.0.0, the subnet mask is 255.255.0.0, the next hop address is 10.27.0. 1 for a permanent route, execute the following command: Route-P Add10.41.0.0Mask255.255.0.0 10.27.0.1Example 6: To add a target of ten.41.0.0, the subnet mask is 255.255.0.0, the next hop address is 10.27.0.1, a route with a metric of 7, executes the following command: Route add10.41.0.0Mask255.255.0.0 10.27.0.1Metric7Example 7: To add a target of ten.41.0.0, the subnet mask is 255.255.0.0, the next hop address is 10.27.0.1, the interface index is 0x3 route, execute the following command: Route add10.41.0.0Mask255.255.0.0 10.27.0.1 if 0x3Example 8: To delete a target of ten.41.0.0, the subnet mask is 255.255.0. 0 route, execute the following command: ROUTE delete10.41.0.0Mask255.255.0.0Example 9: To remove all routes starting with 10 in the IP routing table, execute the following command: ROUTE deleteTen.*Example 10: To set the target to ten.41.0.0, the subnet mask is 255.255.0The next hop address of the. 0 route is from 10.27.0.1 change to 10.27.0. -, execute the following command: Route Change10.41.0.0Mask255.255.0.0 10.27.0.25
Routemost hosts typically reside on a network segment that is connected to only one router. Because there is only one router, there is no problem with which router will publish the packet to the remote computer, and the IP address of the router can be entered as the default gateway for all computers on that network segment. However, when you have two or more routers on your network, you don't necessarily want to rely only on the default gateway. In fact, you might want to have some of your remote IP addresses delivered through a particular router, while other remote IPs are routed through another router. in this case, you need the appropriate routing information, which is stored in the routing table, with each host and each router with its own unique routing table. Most routers use specialized routing protocols to exchange and dynamically update the routing tables between routers. In some cases, however, you must manually add items to the routing tables on the routers and hosts. The route is used to display, manually add, and modify routing table items. Route print--This command is used to display the current item in the routing table, because the network card is configured with an IP address, so all of these items are automatically added. Route add--Use this command to add a message routing item to the routing table. For example, if you want to set a route to the destination network 209.98.32.33, through 5 router network segments, the first to go through a router on the local network, The IP is 202.96.123.5, the subnet mask is 255.255.255.224, then you should enter the following command:route Add 209.98.32.33 Mask 255.255.255.224 202.96.123.5 metric 5Route change--You can use this command to modify the transmission route of the data, however, you cannot use this command to change the destination of the data. The following example can change the routing of data to another router, which takes a more straight path with 3 segments:route Add 209.98.32.33 Mask 255.255.255.224 202.96.123.250 metric 3Route delete--Use this command to remove a route from the routing table. Example: Route Delete 209.98.32.33------------------------------------------------------------------------------using the Route command-line utilityyou can 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.
-P Make the route permanent when used with the add command.
Command Specify the command you want to run (add/change/delete/print).
Destination Specifies the network destination for this route.
Mask Netmask Specifies the network mask (also known as the subnet mask) associated with the network destination.
Gateway Specifies the address set and subnet mask defined by the network destination to reach the forward or next hop IP address.
Metric metric Specifies an integer cost value label 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.
If Interface Specifies the interface index for the interface that can access the target. 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.
Exampleto display the entire contents of the IP routing table, type:Route printto display the route in the IP routing table that starts with 10., 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.1To 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.1To 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.1To 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 7To 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 0x3To 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.0to remove all routes in the IP routing table that starts with 10., 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

Windows command-route

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.