linux route command

 

 


Version & Help

 

route -V [--version]

net-tools 1.60
route 1.98 (2001-04-15)

-h [--help]

 

Add

route  [-v]  [-A  family]  add  <-net|-host>  target[/N] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If]

-net        # the target is a network.

-host      # the target is a host.

dev If      # force the route to be associated with the specified device, as the kernel will otherwise try  to  determine the  device  on its own

reject      # install a blocking route, which will force a route lookup to fail.  This is for example used  to  mask  out networks before using the default route.

metric M

mss M

Example

# Default Route

route add default gw 192.168.8.1

# to 192.168.2.0/24 via 192.168.3.254 by nic eth1

route add -net 192.168.2.0/24 gw 192.168.3.254 dev eth1

Del

route  [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] [metric N] [[dev] If]