Shows/manipulates the IP routing table
- route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] dev] If]
- route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] [metric N] [[dev] If]
The route command 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 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.
route add -net 127.0.0.0
Adds the normal loopback entry, using 255.0.0.0 netmask (class A network, determined from the destination address) and associated with the lo device (assuming this device was previously set up correctly with ifconfig).
route add -net 188.8.131.52 netmask 255.255.255.0 dev eth0
Adds a route to the network 192.56.76.x via eth0. The class C netmask modifier is not really necessary here because 192.* is a class C IP address. The word dev can be omitted here.
route add -net 184.108.40.206 netmask 240.0.0.0 dev eth0
This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via eth0. This is the correct normal configuration line with a multicasting kernel.
See also [[Acronis Linux Commands.