route [-dnqtv] command [[modifiers] args]
route [-n] command [-net | -host] destination gateway [netmask]
-n
numeric address, i.e. do not display names, helpful with DNS problems
-d | debug mode, Do not modify the routing table. | ||||||
-t |
root privilege required for commands in ths rendition.
Only the super-user may modify the routing tables.
commands
:
get host | display the route for a destination.
route -n get 192.0.43.10 # ( example.com ) route to: 192.0.43.10 destination: default mask: default gateway: 192.168.1.1 (shows a gateway) interface: en1 flags: <UP,GATEWAY,DONE,STATIC,PRCLONING> recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire 0 0 0 0 0 0 1500 0 | ||||||||
monitor | report any changes to the routing information
base, routing lookup misses, or suspected network partitionings. Sleeps wakes and checks,… smacpro 5/12/20 ( as a set i.e. all timestams are the same. this repeates every 15 seconds) got message of size 112 on Tue May 12 12:19:43 2020 RTM_IFINFO: iface status change: len 112, if# 5, flags:<UP,BROADCAST,b6,RUNNING,PPROMISC,SIMPLEX,MULTICAST> timestamps removed RTM_IFINFO: iface status change: len 112, if# 5, flags:<UP,BROADCAST,b6,RUNNING,SIMPLEX,MULTICAST> RTM_IFINFO: iface status change: len 112, if# 12, flags:<UP,PTP,RUNNING,PPROMISC,MULTICAST> RTM_IFINFO: iface status change: len 112, if# 12, flags:<UP,PTP,RUNNING,MULTICAST> RTM_IFINFO: iface status change: len 112, if# 1, flags:<UP,LOOPBACK,RUNNING,PPROMISC,MULTICAST> RTM_IFINFO: iface status change: len 112, if# 1, flags:<UP,LOOPBACK,RUNNING,MULTICAST> RTM_IFINFO: iface status change: len 112, if# 9, flags:< †BROADCAST,RUNNING,SIMPLEX,MULTICAST> got message of size 68 on Tue May 12 13:00:55 2020 RTM_DELMADDR: multicast group membership removed from iface: len 68, sockaddrs: |
gateway
is the next-hop intermediary via which packets should be routed. -net
and -host
force the destination.local address part
of INADDR_ANY (0.0.0.0)
, or
examples:
128.32 | -host 128.0.0.32 |
128.32.130 | -host 128.32.0.130 |
-net 128.32 | 128.32.0.0 |
-net 128.32.130 | 128.32.130.0 |
192.168.64/20 | -net 192.168.64 -netmask 255.255.240.0 |
A destination default
is a synonym for -net 0.0.0.0
.
-interface
the destination is directly reachable via an interface requiring no
intermediary system to act as a gateway.
gateway
is the address of this host on the common network, indicating the interface to be used for transmission.
If the interface is point to point, the name of the interface
itself may be given, in which case the route remains valid even if the local or remote addresses change.
-xns, -osi, and -link
specify that all subsequent
addresses are in the XNS, OSI, or AppleTalk address families, or are
specified as link-level addresses, and the names must be numeric.
-netmask
is intended to achieve the effect of an
OSI ESIS redirect with the netmask option, or to manually add subnet
routes with netmasks different from that of the implied network interface
(as would otherwise be communicated using the OSPF or ISIS routing protocols). Specify additional address parameter (to be
interpreted as a network mask).
In the AF_INET case, the implicit network mask generated can be overridden by making sure this option follows the destination parameter.
For AF_INET6, -prefixlen
is available instead of -mask
because non-continuous masks are not allowed in IPv6. For
example, -prefixlen 32 specifies network mask of
ffff:ffff:0000:0000:0000:0000:0000:0000 to be used.
The default value of prefixlen is 64 to get along with the aggregatable address.
0 is assumed if default
is specified.
-cloning RTF_CLONING - generates a new route on use -xresolve RTF_XRESOLVE - emit mesg on use (for external lookup) -iface ~RTF_GATEWAY - destination is directly reachable -static RTF_STATIC - manually added route -nostatic ~RTF_STATIC - pretend route added by kernel or daemon -reject RTF_REJECT - emit an ICMP unreachable when matched -blackhole RTF_BLACKHOLE - silently discard pkts (during updates) -proto1 RTF_PROTO1 - set protocol specific routing flag #1 -proto2 RTF_PROTO2 - set protocol specific routing flag #2 -llinfo RTF_LLINFO - validly translates proto addr to link addr
-rtt, -rttvar, -sendpipe, -recvpipe, -mtu,
-hopcount, -expire, and -ssthresh
provide initial values to quantities
maintained in the routing entry by transport level protocols, such as TCP
or TP4. These may be individually locked by preceding it
locked by the -lock
meta-modifier, or one can specify that all
ensuing metrics may be locked by the -lockrest
meta-modifier.
In change
or add
where the destination and gateway are not sufficient
to specify the route (as in the ISO case where several interfaces
may have the same address), -ifp
or -ifa
may be used to
determine the interface or interface address.
-proxy
specifies that the RTF_LLINFO routing table
entry is the published (proxy-only) ARP entry, as reported by arp.
All symbolic names specified for a destination or gateway are looked up
first as a host name using gethostbyname.
If this lookup fails, getnetbyname
is then used to interpret the name as that of a network.
Route uses a routing socket and the new message types RTM_ADD, RTM_DELETE, RTM_GET, and RTM_CHANGE.
add [host | network ] %s: gateway %s flags %x
The specified route is being added to the tables. The values output are from the routing table
entry supplied in the ioctl(2) call.
delete [ host | network ] %s: gateway %s flags %x
As above, but when deleting an entry.
%s %s done When the flush command is specified, each routing table entry deleted is indicated with a message of this form.
Network is unreachable
An attempt to add a route failed because the
gateway listed was not on a directly-connected network. The next-hop
gateway must be given.
not in table
A delete operation was attempted for an entry which wasn't present in the tables.
routing table overflow
An add operation was attempted, but the system
was low on resources and was unable to allocate memory to create the new
entry.
gateway uses the same route
A change operation resulted in a route whose
gateway uses the same route as the one being changed. The next-hop gateway should be reachable through a different route.
Exits 0 on success, and >0 if an error occurs.