route - show / manipulate the IP routing table
[-A family] add [-net|-host]
[gw Gw] [metric N]
route [-v] [-A family] del [-net|-host] target|default
route [-V] [--version] [-h] [--help]
Display, add or delete entries in the kernel's IP routing tables.
For hosts with multiple interfaces, specifies which interface to use when sending packets based on destination network address.
del options modify the routing tables.
| select verbose operation.
| address family (eg |
inet inet6, ax25, netrom ipx,ddp x25
| add the default route
| the destination network or host IP addresses in dotted decimal or host/network names.
| delete a route.
| the target is a network.
| the target is a host.
| route packets via a gateway. The specified gateway must be reachable first.
set up a static route to the gateway .
If you specify the address of one of your local interfaces, it will be used to decide
about the interface to which the packets should be routed to.
| defines portion of the address outside of this subnet. |
Packets whose destination does not match the address of the gateway in the bits set in the netmask need to be forwarded to the gateway.
Consider the nnn.nnn.nnn.sss as a hexadecimal mask.
a common value is FF.FF.FF.00. (specified as 255.255.255.0 ) this means that all the bits in the first 3 portions of the address must match the gateway. The rightmost portion defines which host within this subnet is the destination.
source cannot contact gateway
leftmost 3 portions of the address are used to determine if destination is withing the subnet
leftmost 2 portions must match and values in the third position must both (gateway and destination ) be in a the matching range from 1-126 or 128-254
within subnet ||within subnet
not within subnet|
packets send to gateway
in order to reach another
both gateway and destination in 1-126 range
|192.168.24.143||outside subnet||outside subnet|
although leftmost 2 digits match ,
gateway is in 1-126 range but
destination is not
set the metric field in the routing table (used by routing daemons) to M. Entries with higher metrics are avoided.
| set the TCP Maximum Segment Size (MSS) for connections over this route to b bytes.
The default is the device MTU minus headers, or a lower MTU when path mtu discovery
occured. This setting can be used to force smaller TCP packets on the other end when
path mtu discovery does not work (usually because of misconfigured firewalls that
block ICMP Fragmentation Needed)
set the TCP window size for connections over this route to w
bytes. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames.
| set the initial round trip time (irtt) for TCP connections over this route to I milliseconds (1-12000). This is typically only used on AX.25 networks. default 300ms .
| install a blocking route, which will force a route lookup to fail. mask out networks before using the default route.
mod, dyn, reinstate
install a dynamic or modified route for diagnostic purposes, and are
generally only set by routing daemons.
| operate on the kernel's FIB (Forwarding Information Base) routing table. default.
| operate on the kernel's routing cache.
|force the route to be associated with the specified device. (rarely used)
| display numerical addresses instead of host names.
Useful when the nameserver is inaccessable.
| use netstat-format for displaying the routing table. |
metric, Ref, Use
If dev If is the last option on the command line,
dev is optional
route add default gw mango-gw
Packets to destinations not matching other gateways are sent to mango-gw.
route add -net 184.108.40.206 netmask 255.255.255.0 dev eth0
adds a route to the network 192.56.76.x via
route add oldstandby sl0
the "oldstandby" host uses the SLIP interface ( serial Link Interface Protocol , might be dialup modem)
route add -net 220.127.116.11 netmask 255.255.255.0 gw oldstandby
the net "192.57.66.x" is to be gatewayed through to the SLIP interface.
route add -net 18.104.22.168 netmask 240.0.0.0 dev eth0
sets all of the
multicast IP routes to go via "eth0".(normal configuration line with a multicasting )
route add -net 10.0.0.0 netmask 255.0.0.0 reject
installs a rejecting route for the private network "10.x.x.x."
| The destination network or destination host.
| The gateway address or '*' if none set.
|The netmask for the destination net; |
'255.255.255.255' for a host destination and
'0.0.0.0' for the default route.
| route is up
| target is a host
| use gateway
| reinstate route for dynamic routing
| dynamically installed by daemon or redirect
| modified from routing daemon or redirect
| installed by addrconf
| cache entry
| reject route
| The 'distance' to the target in hops (router handoffs).
| Number of references to this route.
| Count of lookups for the route. Depending on the use of -F and -C this will be
either route cache misses (-F) or hits (-C).
| Interface to which packets for this route will be sent.
| Default maximum segement size for TCP connections over this route.
|Default window size for TCP connections over this route.
| Initial RTT (Round Trip Time). The kernel uses this to guess about the best TCP protocol parameters without waiting on (possibly slow) answers.
HH (cached only)
| number of ARP entries and cached routes that refer to the hardware header cache
for the cached route. This will be -1 if a hardware address is not needed for the interface of the cached route (e.g. lo).
Arp (cached only)
| Whether or not the hardware address for the cached route is up to date.
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default Wireless_Broadb 0.0.0.0 UG 0 0 0 eth0
ifconfig, netstat, arp, rarp