ROUTE

  • shows and manipulates the IP routing table

# route add -net 10.10.10.0/24 gw 192.168.0.1

  • adds a route

# route del -net 10.10.10.0/24 gw 192.168.0.1

  • deletes a route

# route add default gw 192.168.0.1

  • adds default gateway

route command also shows and manipulate ip routing table. To see default routing table in Linux, type the following command.

# route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.50.0 * 255.255.255.0 U 0 0 0 eth0

link-local * 255.255.0.0 U 1002 0 0 eth0

default 192.168.50.1 0.0.0.0 UG 0 0 0 eth0

Adding, deleting routes and default Gateway with following commands.

Route Adding

# route add -net 10.10.10.0/24 gw 192.168.0.1

Route Deleting

# route del -net 10.10.10.0/24 gw 192.168.0.1

Adding default Gateway

# route add default gw 192.168.0.1

Last updated

Was this helpful?