The route Command

The route Command

As you know, networking device, such as routers, is used for routing purposes. Routing is used to manipulate the routing table and move packets over the networks by using the suitable paths.

 To view the routing table, you need to type the following route print command on the windows command prompt:

 C: /User/system 32> route print

The following options are associated with the route command:

  • -f: Allows you to clear the routing table of all gateway entries.
  • -p: Use this option with add command. The entire individual route will be added to the registry. When you start TCP/IP, these routes are used to initialize the IP routing table. If we use the —p option with the print command, it will show the list of determined routes that are stored in the registry location of HKEY_LOCAL_MACHENE SYSTEM \CurrentControlSet \ Services \ Tcpip \ Parameters \ PersistentRoutes
  • Command: Allows you to run the add, delete, change, or print command. The descriptions of these commands are as follows:
  • Add: Allows you to add a route
  • Delete: Allows you to delete the route or routes
  • Change: Allows you to modify the existing route
  • Print: Allows you to print the route or routes
  • Destination: Provides the network destination of a given route. The destination can be an IP network address, IP address for particular host route, or the 0.0.0.0 that represents a default route.
  • Netmask: Provides subnet mask that is related to the destination network. The default destination subnet mask is 0.0.0.0 and generally you see the 255.255.255.255 host route.
  • Gateway: Specifies the gateway that depends on the network address and subnet mask.
  • Metric: Defines the cost metric (ranging from 1 to 9999) for a given route that helps you to select a suitable route from multiple routes in a routing table for transmitting the data packets.
  • Interface: Defines the interface number in the interface index over which the destination is reachable.
  • /?: Helps you to view the detailed functionality of the route command.

Some examples of the route command are as follows:

  1. Type route print to show all IP routing table.
  2. Type route add 0.0.0.0 mask 0.0.U.0 192.168.10.1 to add a default route along with the default gateway address 192.168.10.1.
  3. Type route add 10.1.1.0 mask 255.255.255.0 10.2.2.2 to add a route to the destination 10.1.1.0 along with the 255.255.255.0 subnet mask and the 10.2.2.2 next-hop address.
  4. Type route -p add 10.100.0.0 mask 255.255.0.0 10.2.0.1 to add a persistent route to the destination 10.100.0.0 along with the 255.255.0.0 subnet mask and the 10.2.0.1 next-hop address.
  5. Type route delete 10.100.0.0 mask 255.255.0.0 to delete the route to the destination 10.100.0.0 with the subnet mask 255.255.0.0.
  6. Type route change 10.100.0.0 mask 255.255.0.0 10.7.0.5 to change the next-hop address of a route along with the destination 10.100.0.0 and 255.255.0.0 subnet mask from 10.2.0.1 to 10.7.0.5.

 

Please follow and like us:

Leave a Reply

Your email address will not be published.