Using the ip route command

The ip route command is one of the many features of the newer ip utility. This command can be used to display or modify the existing IP routing table. We can add, delete, or modify specific static routes to specific hosts or networks using ip route command.

Following are the examples to illustrate the usage of ip route command:

  • We can use ip route command to display the current routing table as follows:
$ ip route 
  • The ip route command can be used to add static routes in routing table. In the following example we add network routing information for 25.25.25.0/24 network, to route it through eth0 interface, as shown here:
$ ip route add 25.25.25.0/24  dev  eth0
  • The ip route command can also be used to add host routing information. In the following example we add information to route IPv4 address 15.15.15.15 through eth1 interface: 
$ ip route add 15.15.15.15 dev eth1
  • The ip route command can also be used to delete the static route from the routing table. In the following example we delete network routing information for 25.25.25.0/24 network as shown here:
$ ip route del 25.25.25.0/24 dev eth0
  • The ip route command can also be used to delete host routing information. In the following example we delete information to route IPv4 address 15.15.15.15 through eth1 interface: 
$ ip route del 15.15.15.15 dev eth0
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.214.215