How to use “route” command on Linux

Route command is used to show/manipulate the IP routing table. It is primarily used to setup static routes to specific host or networks via an interface.

Let’s start with some very basic…

1. Running route at the command line without any options will display the routing table entries:

#route

2. Learn to add and remove routes from your routing table:
eth0 : Exit interface

gw : GateWay

#route add -net 192.168.0.0/24 dev eth0
#route del -net 192.168.0.0/24 dev eth0

#route add -net 192.168.0.0/24 gw 192.168.10.1
#route del -net 192.168.0.0/24 gw 192.168.10.1

That’s all!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s