| BSD i.e. Mac | £inux |
route [-dnqtv] command [[modifiers] args]
route [-n] command [-net | -host] destination gateway [netmask]
-n |
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
timestamps removed
RTM_IFINFO: iface status change: len 112, if# 5, flags:<UP,BROADCAST,b6,RUNNING,PPROMISC,SIMPLEX,MULTICAST>
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 RTM_DELMADDR: multicast group membership removed from iface: len 68,
sockaddrs: GATEWAY,IFP,IFA>
1.0.5e.0.0.1 en0:4c.32.75.97.3b.ad 224.0.0.1
RTM_DELETE: Delete Route: len 128, pid: 153, seq 72, errno 3,
ifscope 1, ifref, flags:<UP,HOST,DONE,LLINFO,WASCLONED,LOCAL,IFSCOPE,IFREF>
locks: inits:
sockaddrs: <DST,GATEWAY>
192.168.1.46 4c.32.75.97.3b.ad
RTM_DELETE: Delete Route: len 128, pid: 153, seq 74, errno 0,
ifscope 5, flags:<HOST,DONE,WASCLONED,BROADCAST,IFSCOPE,CONDEMNED>
locks: inits:
sockaddrs: <DST,GATEWAY>
192.168.1.255 ff.ff.ff.ff.ff.ff
RTM_DELETE: Delete Route: len 164, pid: 153, seq , errno 0,
flags:<HOST,DONE,STATIC,b016,WASCLONED,CONDEMNED>
locks: inits:
sockaddrs: <DST,GATEWAY,IFP,IFA>
169.254.8.239 78.4f.43.50.8a.13 en0:4c.32.75.97.3b.ad 192.168.1.46
…
germansfios_g1100.germans 20.c0.47.c2.a8.a3 en0:4c.32.75.97.3b.ad 192.168.1.46
…
pycom 80.7d.3a.94.7b.7c en0:4c.32.75.97.3b.ad 192.168.1.46
… …
RTM_NEWADDR: address being added to iface: len 80, metric 0, flags:CLONING
sockaddrs: NETMASK,IFP,IFA,BRD>
255.255.255.0 en0:4c.32.75.97.3b.ad smacpro.germans 192.168.1.255
… …
| |
add | ||
delete | ||
change | Change aspects of a route (such as its gateway). | |
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.
| ||
flush [family] | Remove [all] routes. address families -osi, -xns, -atalk, -inet6, or -inet modifiers, only routes
having destinations with addresses in the delineated family will be deleted.
| |
gateway is the next-hop intermediary via which packets should be routed.
Routes to a particular host may be distinguished from those to a network by interpreting the Internet address specified as the destination argument.
-net-host | force the destination. If the destination has a local address part of INADDR_ANY (0.0.0.0), or if the destination is the symbolic name of a network, then the route is assumed to be to a network; otherwise, it is presumed to be a route to a host. The destination could also be specified in the CIDR net/bits format.
examples:
A destination
| |||||||||||
| 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 | subsequent addresses are in the XNS, OSI, or AppleTalk address families, or are
specified as link-level addresses. Must be numeric. | |||||||||||
-netmask | 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, | |||||||||||
-rtt | 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 specify that all
ensuing metrics may be locked by the -lockrest
| |||||||||||
-proxy | the RTF_LLINFO routing table
entry is the published (proxy-only) ARP entry, as reported by arp.
|
-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
All symbolic names specified for a destination or gateway are looked up
first as a host name using gethostbyname. 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_CHANGEL.
add |delete [ host | network ] %s: gateway %s flags %x
With flush, each entry deleted is indicated with a message of this form: %s %s done
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 unable to allocate memory to create the new entry.
gateway uses the same route A change 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.
/usr/sbin/netstat -r Routing tables Internet: Destination Gateway Flags Netif Expire default germansfios_g1100. UGSc en0 127 localhost UCS lo0 localhost localhost UH lo0 169.254 link#5 UCS en0 ! 192.168.1 link#5 UCS en0 ! 192.168.1.1/32 link#5 UCS en0 ! germansfios_g1100. 20:c0:47:c2:a8:a3 UHLWIir en0 1181 hpc658ca.germans 10:60:4b:c6:58:ca UHLWI en0 1091 slammerfox.germans 50:3e:aa:d:46:e9 UHLWIi en0 1143 192.168.1.11 a8:10:87:18:67:37 UHLWI en0 1091 dapi2.germans b8:27:eb:f0:ae:8 UHLWI en0 1096 kitchen.germans 70:85:c2:63:1f:bf UHLWI en0 1199 pi93graf.germans b8:27:eb:1c:5b:93 UHLWI en0 1096 tesla_model_s.germ 4:4e:af:ac:8:e1 UHLWI en0 1097 denniss-iphone.ger f8:e9:4e:e2:89:16 UHLWI en0 1091 fing.germans f0:23:b9:eb:2b:88 UHLWI en0 1200 marilyns-iphone.ge d4:61:da:c1:83:df UHLWIi en0 1199 esp_2116b0.germans 84:f3:eb:21:16:b0 UHLWI en0 1091 damonitor2.germans b8:27:eb:6:73:4c UHLWI en0 1096 192.168.1.44/32 link#5 UCS en0 ! smacpro.germans 4c:32:75:97:3b:ad UHLWI lo0 192.168.1.61 b8:27:eb:f7:1d:5a UHLWI en0 1096 STB 0:1f:c4:ef:5d:f1 UHLWI en0 1091 224.0.0/4 link#5 UmCS en0 ! 224.0.0.251 1:0:5e:0:0:fb UHmLWI en0 239.255.255.250 1:0:5e:7f:ff:fa UHmLWI en0 255.255.255.255/32 link#5 UCS en0 ! long delay Exits0 on success, and >0 if an error occurs.