功能:
打印網(wǎng)絡連接、路由表收擦、接口統(tǒng)計, 喬裝(偽)連接和多路廣播
描述:
netstat(network statistics的簡寫)是顯示網(wǎng)絡連接(傳入和傳出)祈坠、路由表吼鱼、一些網(wǎng)絡接口(網(wǎng)絡接口控制器或軟件定義的網(wǎng)絡接口)的統(tǒng)計姨涡,
注明:
netstat已經(jīng)不維護了幌蚊,已經(jīng)被ss和ip所代替
參數(shù)解析
{--route|-r}:查看內(nèi)核路由表
-i:展示網(wǎng)路接口信息
-g: 展示IPv4 和 IPv6.組廣播信息
-s:展示每種協(xié)議進行統(tǒng)計(傳輸層和網(wǎng)絡層協(xié)議)
-a:顯示所有選項翻伺,默認不顯示LISTEN相關
-t:只展示tcp相關選項
-u:只展示udp相關選項
-n:不顯示別名畴蒲,能顯示數(shù)字的全部轉化成數(shù)字诗鸭,最好先是別名染簇,看著更清楚,不過查詢端口的時候可能使用
-l:僅列出有在 Listen (監(jiān)聽) 的服務
-p:顯示建立相關鏈接的程序名
-o:包括網(wǎng)絡計時器
-l:只顯示監(jiān)聽套接字
輸出
Proto:socket使用的協(xié)議(tcp强岸、udp锻弓、raw)
Recv-Q
Send-Q
Local Address
Foreign Address
State
見圖(具體的值都是每個節(jié)點):
User
PID/Program name
Path
栗子
列出所有接口: netstat -a
顯示本地系統(tǒng)網(wǎng)絡活動的統(tǒng)計信息:netstat -an
列出tcp所有接口:netstat -at
只列出監(jiān)聽狀態(tài)的端口:netstat -l
列出監(jiān)聽tcp的端口:netstat -lt
顯示使用的所有端口的統(tǒng)計信息:netstat -s
其他相關命令
ac — Print statistics about the amount of time users have been connected.
arp — Manipulate the system ARP cache.
ifconfig — View or modify the configuration of network interfaces.
ip — Display and manipulate information about routing, devices, policy routing and tunnels.
route — Display and manipulate the IP routing table.
rpcinfo — Report information about Remote Procedure Calls.
參考資料
http://roclinux.cn/?p=2418
http://www.computerhope.com/unix/unetstat.htm