routing command in linux

routing command in linux



       Route manipulates the kernels 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  program.



Add Route :

# route  add -net  < network >  netmask <subnet/netmask> gw  < gateway>

Ex - route add -net 10.20.3.0 netmask 255.255.255.0 gw 10.20.2.1

OR

# route  add -net  < network >  netmask <subnet/netmask> gw  < gateway>  <device>

Ex - route add -net 10.20.3.0 netmask 255.255.255.0 gw 10.20.2.1 eth1


Delete  Route :

# route  del -net  < network >  netmask <subnet/netmask> gw  < gateway>

Ex - route del -net 10.20.3.0 netmask 255.255.255.0 gw 10.20.2.1

OR

# route  del -net  < network >  netmask <subnet/netmask> gw  < gateway> <device>

Ex - route del -net 10.20.3.0 netmask 255.255.255.0 gw 10.20.2.1 eth1



Previous
Next Post »