![]() |
routing in linux |
Tags: routing in linux, ip routing, ip route command,add static route linux, add route in linux, add route in Ubuntu, ip r, delete route, delete route in linux, delete route command
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