1. ip route 顯示主機基本路由資訊
~]# ip route
default via 172.25.0.254 dev eth0 proto static metric 1024
172.25.0.0/24 dev eth0 proto kernel scope link src 172.25.0.11
172.25.253.254 via 172.25.0.254 dev eth0 proto static metric 1
2. traceroute / tracepath 追蹤遠端主機UDP資料包路徑
traceroute 預設追蹤UDP資料包,選項 -I 可追蹤 ICMP的資料包,-T可追蹤TCP資料包
~]# tracepath www.baidu.com
1?: [LOCALHOST] pmtu 1500
1: gateway 4.109ms
1: gateway 3.545ms
2: 192.168.0.2 0.320ms
3: 210.206.46.79 6.380ms
4: 10.255.88.241 1.432ms
5: 10.255.33.141 1.131ms
6: 10.255.30.49 4.399ms
7: 10.255.28.173 2.054ms
8: 124.205.98.69 1.810ms
9: 14.197.243.133 1.918ms
10: 14.197.250.170 2.636ms
11: 182.61.253.119 3.439ms
Too many hops: pmtu 1500
Resume: pmtu 1500
3. ss 與netstat功能相當
ss與netstat 選項
-n 顯示介面和埠的編號,且不顯示名稱
-t 顯示TCP套接字
-u 顯示TCP套接字
-l 僅顯示偵聽中的套接字
-a 顯示所有套接字,包括偵聽中和已經建立的
~]# ss -ta
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:https *:*
LISTEN 0 5 *:ideafarm-door *:*
LISTEN 0 5 *:5901 *:*
LISTEN 0 128 *:sunrpc *:*
LISTEN 0 128 *:6001 *:*
LISTEN 0 128 127.0.0.1:8307 *:*
LISTEN 0 5 192.168.122.1:domain *:*
LISTEN 0 128 *:ssh *:*
LISTEN 0 128 127.0.0.1:ipp *:*
LISTEN 0 100 127.0.0.1:smtp *:*
ESTAB 0 0 192.168.96.254:ssh 192.168.101.251:53439
LISTEN 0 128 :::https :::*
LISTEN 0 5 :::ideafarm-door :::*
LISTEN 0 5 :::5901 :::*
LISTEN 0 128 :::sunrpc :::*
LISTEN 0 128 :::6001 :::*
LISTEN 0 128 ::1:8307 :::*
LISTEN 0 128 :::ssh :::*
LISTEN 0 128 ::1:ipp :::*
LISTEN 0 100 ::1:smtp :::*