這篇文章將為大家詳細(xì)講解有關(guān)netstat的1基本用法有哪些,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
創(chuàng)新互聯(lián)建站專(zhuān)業(yè)為企業(yè)提供嫩江網(wǎng)站建設(shè)、嫩江做網(wǎng)站、嫩江網(wǎng)站設(shè)計(jì)、嫩江網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、嫩江企業(yè)網(wǎng)站模板建站服務(wù),十年嫩江做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
顯示當(dāng)前所有的鏈接
root@ts:~# netstat -a Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:domain *:* LISTEN tcp 0 0 testforpaas.21vi:domain *:* LISTEN tcp 0 0 localhost:5433 *:* LISTEN tcp 0 0 localhost:smtp *:* LISTEN tcp 0 0 localhost:6010 *:* LISTEN
root@ts:~# netstat -tau
默認(rèn)情況下 netstat 會(huì)通過(guò)反向域名解析技術(shù)查找每個(gè) IP 地址對(duì)應(yīng)的主機(jī)名。這會(huì)降低查找速度。如果你覺(jué)得 IP 地址已經(jīng)足夠,而沒(méi)有必要知道主機(jī)名,就使用 -n 選項(xiàng)禁用域名解析功能
root@ts:~# netstat -ant Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 172.16.16.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:8123 0.0.0.0:* LISTEN
任何網(wǎng)絡(luò)服務(wù)的后臺(tái)進(jìn)程都會(huì)打開(kāi)一個(gè)端口,用于監(jiān)聽(tīng)接入的請(qǐng)求。這些正在監(jiān)聽(tīng)的套接字也和連接的套接字一樣,也能被 netstat 列出來(lái)。使用 -l 選項(xiàng)列出正在監(jiān)聽(tīng)的套接字
root@ts:~# netstat -tnl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 172.16.16.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:8123 0.0.0.0:* LISTEN
root@ts:~# netstat -tlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 localhost:domain *:* LISTEN 1080/DNSmasq tcp 0 0 testforpaas.21vi:domain *:* LISTEN 1080/dnsmasq tcp 0 0 localhost:5433 *:* LISTEN 11237/postgres tcp 0 0 localhost:smtp *:* LISTEN 1371/sendmail: MTA: tcp 0 0 localhost:6010 *:* LISTEN 9389/6
root@ts:~# netstat -tlpe Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name tcp 0 0 localhost:domain *:* LISTEN root 15870 1080/dnsmasq tcp 0 0 testforpaas.21vi:domain *:* LISTEN root 15868 1080/dnsmasq tcp 0 0 localhost:5433 *:* LISTEN postgres 130080 11237/postgres tcp 0 0 localhost:smtp *:* LISTEN root 17826 1371/sendmail: MTA
root@ts:~# netstat -tlpen Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 0 15870 1080/dnsmasq tcp 0 0 172.16.16.1:53 0.0.0.0:* LISTEN 0 15868 1080/dnsmasq tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN 116 130080 11237/postgres tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 17826 1371/sendmail: MTA
netstat 可以打印出網(wǎng)絡(luò)統(tǒng)計(jì)數(shù)據(jù),包括某個(gè)協(xié)議下的收發(fā)包數(shù)量
root@ts:~# netstat -tns IcmpMsg: InType0: 93 InType3: 14674 InType11: 27391 OutType3: 18230 OutType8: 38060 Tcp: 23583 active connections openings 139747 passive connection openings 21350 failed connection attempts 1512 connection resets received 4 connections established 4263613 segments received 4716472 segments send out 171992 segments retransmited 55 bad segments received. 151266 resets sent
root@ts:~# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 172.16.16.62 0.0.0.0 UG 0 0 0 ens160 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br-9547a5f0faec 10.20.0.0 10.20.101.9 255.255.0.0 UG 0 0 0 ppp0
netstat 也能打印網(wǎng)絡(luò)接口信息,-i 選項(xiàng)就是為這個(gè)功能而生
root@ts:~# netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg br-9547a5f0faec 1500 0 55883292 0 0 0 89519216 0 0 0 BMRU docker0 1500 0 49 0 0 0 16 0 0 0 BMU ens160 1500 0 152552760 0 611 0 60254997 0 0 0 BMRU lo 65536 0 583345 0 0 0 583345 0 0 0 LRU ppp0 1354 0 2157 0 0 0 1679 0 0 0 MOPRU veth6dd978f 1500 0 12751092 0 0 0 18590019 0 0 0 BMRU
輸出友好信息
root@ts:~# netstat -ei Kernel Interface table br-9547a5f0faec Link encap:Ethernet HWaddr 02:42:ee:4b:21:05 inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::42:eeff:fe4b:2105/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:55883460 errors:0 dropped:0 overruns:0 frame:0 TX packets:89519456 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:7839329499 (7.8 GB) TX bytes:199950345292 (199.9 GB) docker0 Link encap:Ethernet HWaddr 02:42:8f:b2:de:7a inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0 inet6 addr: fe80::42:8fff:feb2:de7a/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:49 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1372 (1.3 KB) TX bytes:1368 (1.3 KB)
root@ts:~# netstat -cu Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State udp6 0 0 localhost:37429 localhost:37429 ESTABLISHED
netstat -atnp | grep ESTA
watch -d -n0 "netstat -atnp | grep ESTA"
關(guān)于“netstat的1基本用法有哪些”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
網(wǎng)站題目:netstat的1基本用法有哪些
網(wǎng)站地址:http://chinadenli.net/article28/ppjocp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、動(dòng)態(tài)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、App開(kāi)發(fā)、網(wǎng)站收錄、搜索引擎優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)