Route manipulates the kernel’s IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program.
When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.
In this article we will show you how to use the route command to add/delete default gateway, add/delete a route with a temporary way, it means that the changes will be lost if the system is shutdown or reboot.
Add default gateway
To add default gateway to route table use following command:
# route add default gw
# route add default gw 192.168.1.1
Delete default gateway
To delete default gateway type following command:
# route del default gw
# route del default gw 192.168.1.1
Add and deleting route to a host type
To add route to a host type enter following command:
# route add -host gw
# route add -host 192.168.1.100 gw 192.168.1.2
# route del -host gw
# route del -host 192.168.1.100 gw 192.168.1.2
For more information about route command ask a question in the comments.