# default route$iprouteget $(dig+shortgithub.com|head-1) |sed-rn's|.*dev\s+(\S+)\s+src.*$|\1|p')# or$ ip route get $(nslookup "${githubIp}" | grep Server | awk -F' ' '{print $NF}') | sed -rn 's|.*dev\s+(\S+)\s+src.*$|\1|p'
en8# all active interface$netstat-nr|grep-E'UG|UGSc'|grep-E'^0.0.0|default'|grep-E'[0-9.]{7,15}'|awk-F' ''{print $NF}'en0en8
$ipAddr=$(/usr/local/bin/ipas"${interface}"|sed-rn's|\W*inet[^6]\W*([0-9\.]{7,15}).*$|\1|p')# or via `/sbin/ifconfig`$ipAddr=$(/sbin/ifconfig"${interface}"|sed-rn's|^\s+inet\s+([0-9\.]+))
Host name—Route is to a host rather than to a network
R
Reject—Set by ARP when an entry expires
D
Dynamic—Route added by a route redirect or RIP
M
Modified—Route modified by a route redirect
C
Cloning—A new route is cloned from this entry when it is used
L
Link—Link-level information, such as the Ethernet MAC address, is present
S
Static—Route added with the route command
check route
show all
# linux-like route -n$netstat-nr# or$netstat-nr-finet# via `ip route`$iprouteshow
show particular ip
$routeget<ip.address>routeto:ec2-1-1-1-1.compute-1.amazonaws.comdestination:ec2-1-1-1-1.compute-1.amazonaws.comgateway:192.168.0.1interface:en0flags:<UP,GATEWAY,HOST,DONE,STATIC>recvpipesendpipessthreshrtt,msecrttvarhopcountmtuexpire0007711015000# or via `ip route`$iprouteget1.1.1.11.1.1.1via192.168.0.1deven0src192.168.6.55