7-detailed explanation of common network management commands

Source: Internet
Author: User

7. route command...

  • Syntax :...

  • -F option...

  • -P option...

  • Print command...

  • Add command...

  • DELETE command...

  • Change command...

7. route command

The route command is used to display and modify entries in the local IP address routing table. It is often used to troubleshoot network faults.

Use a route or route /? Help is displayed.

650) This. width = 650; "Title =" clip_image002 "style =" border-top: 0px; border-Right: 0px; border-bottom: 0px; border-left: 0px; "Border =" 0 "alt =" clip_image002 "src =" http://img1.51cto.com/attachment/201411/3/1024435_1415023828Ivun.jpg "Height =" 258 "/>

Syntax:

Route [-F] [-p] [Command [destination] [mask netmask] [gateway] [metric] [If interface]

-F Option

The route-F command clears the route tables of all gateway entries. If this parameter is used in combination with a command, the route table is cleared before running the command.

As shown in, when you run the route-F command and print the route table with route print, you can see that the route table is empty.

650) This. width = 650; "Title =" clip_image004 "style =" border-top: 0px; border-Right: 0px; border-bottom: 0px; border-left: 0px; "Border =" 0 "alt =" clip_image004 "src =" http://img1.51cto.com/attachment/201411/3/1024435_1415023828OSZm.jpg "Height =" 407 "/>

-P Option

When used with the route add command, the routing device remains unchanged during system boot.

By default, the route is not saved when the system is restarted.

When the-p parameter is added to the route add command, the route print command displays the permanent route.

650) This. width = 650; "Title =" clip_image006 "style =" border-top: 0px; border-Right: 0px; border-bottom: 0px; border-left: 0px; "Border =" 0 "alt =" clip_image006 "src =" http://img1.51cto.com/attachment/201411/3/1024435_1415023829YiKp.jpg "Height =" 230 "/>

Print command

Next, we will introduce four common command commands: print, add, delete, and chance.

The route print command shows the complete content of the IP route table, as shown in: displays the list of all interfaces of the current host, and then displays the IPv4 route table and IPv4 permanent route, my IPv4 route table has two default gateways and there is no manually added IPv4 permanent route.

When you use the route print command, the target or gateway can be a wildcard, And the wildcard is specified as the asterisk (*).

The route print-4 command only displays IPv4 route table information.

The route print-6 command only displays the IPv6 route table information.

The route print 192 * command only displays the items that match 192.

650) This. width = 650; "Title =" clip_image008 "style =" border-top: 0px; border-Right: 0px; border-bottom: 0px; border-left: 0px; "Border =" 0 "alt =" clip_image008 "src =" http://img1.51cto.com/attachment/201411/3/1024435_1415023830K7mW.jpg "Height =" 697 "/>

Add command

The route add command adds a static route information. The-p parameter is used to add a permanent route. It is often used when there are multiple Gateway addresses in the network.

650) This. width = 650; "Title =" clip_image009 "style =" border-top: 0px; border-Right: 0px; border-bottom: 0px; border-left: 0px; "Border =" 0 "alt =" clip_image009 "src =" http://img1.51cto.com/attachment/201411/3/1024435_1415023830Py5O.png "Height =" 55 "/>

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

Command:Route add 0.0.0.0 mask 0.0.0.0 192.168.12.1


Example2:To add a route entry to the destination 10.41.0.0 with the 255.255.0.0 subnet mask and the next hop address 10.27.0.1

Command:Route add 10.41.0.0 mask 255.255.0.0 10.27.0.1


Example3:To add a permanent route to the destination 10.41.0.0 with the 255.255.0.0 subnet mask and the next hop address 10.27.0.1

Command:Route-P add 10.41.0.0 mask route 255.0.0 10.27.0.1


Example4:To add a route entry to the 10.41.0.0 destination with the 255.255.0.0 subnet mask, 10.27.0.1 next hop address, and its cost value is 7

Command:Route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7


Example5:To add a route entry to the destination 10.41.0.0 with the 255.255.0.0 subnet mask, 10.27.0.1 next hop address, and indexed using the 0x3 interface

Command:Route add 10.41.0.0 mask route 0.0 10.27.0.1 if 0x3

If if is not given, it will try to find the best interface for the given gateway.


Example6:If the local IP address is 172.16.1.100 and the gateway is 172.16.1.254, there is an existing ADSL line, and the router address is 172.161.200, you can access the Internet through this address. How can I access resources on the Internet? You only need to perform the following three steps:

Step 1: Change the local gateway address from 172.16.1.254 to 172.16.1.200.

Step 2: Route Delete 0.0.0.0 mask 0.0.0.0 172.16.1.254

Step 3: Route add 172.16.0.0 mask 255.255.0.0 172.16.1.100-P metric 1

DELETE command

The route DELETE command deletes a route.

When you use the route DELETE command, the target or gateway can be a wildcard, And the wildcard is specified as the asterisk (*).

Example1:To delete a route entry destined for 10.41.0.0 with the 255.255.0.0 Subnet Mask

Command:Route Delete 10.41.0.0 mask 255.255.0.0


Example2:To delete all routes in the IP route table starting with 10.

Command:Route Delete 10 .*

Change command

The route change command is only used to modify gateways and/or hops.

Example1:To change the next hop address with the 10.100.0.0 destination and 255.255.0.0 subnet mask from 10.100.0.1 to 10.100.0.254

Command:Route change 10.100.0.0 mask 255.255.0.0 10.100.0.254




This article is from the "Haina baichuan" blog, please be sure to keep this source http://hichuann.blog.51cto.com/1024435/1571454

7-detailed explanation of common network management commands)

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.