欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Linux下怎么用netstat查看網(wǎng)絡(luò)狀態(tài)、端口狀態(tài)

這篇文章給大家分享的是有關(guān)Linux下怎么用netstat查看網(wǎng)絡(luò)狀態(tài)、端口狀態(tài)的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)技術(shù)團(tuán)隊(duì)10多年來致力于為客戶提供網(wǎng)站建設(shè)、做網(wǎng)站、成都品牌網(wǎng)站建設(shè)營(yíng)銷型網(wǎng)站、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過多年發(fā)展,公司擁有經(jīng)驗(yàn)豐富的技術(shù)團(tuán)隊(duì),先后服務(wù)、推廣了上千網(wǎng)站,包括各類中小企業(yè)、企事單位、高校等機(jī)構(gòu)單位。

      netstat命令是一個(gè)監(jiān)控TCP/IP網(wǎng)絡(luò)的非常有用的工具,它可以顯示路由表、實(shí)際的網(wǎng)絡(luò)連接以及每一個(gè)網(wǎng)絡(luò)接口設(shè)備的

      netstat命令的功能是顯示網(wǎng)絡(luò)連接、路由表和網(wǎng)絡(luò)接口信息,可以讓用戶得知目前都有哪些網(wǎng)絡(luò)連接正在運(yùn)作。

      該命令的一般格式為:


      netstat [選項(xiàng)]

      命令中各選項(xiàng)的含義如下:

      -a 顯示所有socket,包括正在監(jiān)聽的。

      -c 每隔1秒就重新顯示一遍,直到用戶中斷它。

      -i 顯示所有網(wǎng)絡(luò)接口的信息,格式同“ifconfig -e”。

      -n 以網(wǎng)絡(luò)IP地址代替名稱,顯示出網(wǎng)絡(luò)連接情形。

      -r 顯示核心路由表,格式同“route -e”。

      -t 顯示TCP協(xié)議的連接情況。

      -u 顯示UDP協(xié)議的連接情況。

      -v 顯示正在進(jìn)行的工作。

1. netstat -an | grep LISTEN
      0.0.0.0的就是每個(gè)IP都有的服務(wù),寫明哪個(gè)IP的就是綁定那個(gè)IP的服務(wù)。

2. netstat -tln
      用來查看linux的端口使用情況

3. /etc/init.d/vsftp start
      是用來啟動(dòng)ftp端口~!

4. netstat
      查看已經(jīng)連接的服務(wù)端口(ESTABLISHED)

5. netstat -a
      查看所有的服務(wù)端口(LISTEN,ESTABLISHED)

6. sudo netstat -ap
      查看所有的服務(wù)端口并顯示對(duì)應(yīng)的服務(wù)程序名

7. nmap <掃描類型><掃描參數(shù)>
例如:
       nmap localhost

nmap -p 1024-65535 localhost

nmap -PT 192.168.1.127-245

當(dāng)我們使用 netstat -apn 查看網(wǎng)絡(luò)連接的時(shí)候,會(huì)發(fā)現(xiàn)很多類似下面的內(nèi)容:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 52 218.104.81.152:7710 211.100.39.250:29488 ESTABLISHED 6111/1

----

 ESTABLISHED
          The socket has an established connection.
   SYN_SENT
          The socket is actively attempting to establish a connection.
   SYN_RECV
          A connection request has been received from the network.
   FIN_WAIT1
          The socket is closed, and the connection is shutting down.
   FIN_WAIT2
          Connection is closed, and the socket is waiting for  a  shutdown
          from the remote end.
   TIME_WAIT
          The socket is waiting after close to handle packets still in the
          network.
   CLOSE  The socket is not being used.
   CLOSE_WAIT
          The remote end has shut down, waiting for the socket to close.
   LAST_ACK
          The remote end has shut down, and the socket is closed.  Waiting
          for acknowledgement.
   LISTEN The  socket is listening for incoming connections.  Such sockets
          are  not  included  in  the  output  unless  you   specify   the
          --listening (-l) or --all (-a) option.
   CLOSING
          Both  sockets are shut down but we still don't have all our data
          sent.
   UNKNOWN
          The state of the socket is unknown.

Consider two programs attempting a socket connection (call them a and b). Both set up sockets and transition to the LISTEN state. Then one program (say a) tries to connect to the other (b). asends a request and enters the SYN_SENT state, and b receives the request and enters the SYN_RECV state. When b acknowledges the request, they enter the ESTABLISHED state, and do their business. Now a couple of things can happen:

  1. a wishes to close the connection, and enters FIN_WAIT1. b receives the FIN request, sends an ACK (then a enters FIN_WAIT2), enters CLOSE_WAIT, tells a it is closing down and the enters LAST_ACK. Once a acknowledges this (and enters TIME_WAIT), b enters CLOSE. a waits a bit to see if anythings is left, then enters CLOSE.

  2. a and b have finished their business and decide to close the connection (simultaneous closing). When a is in FIN_WAIT, and instead of receiving an ACK from b, it receives a FIN(as b wishes to close it as well), a enters CLOSING. But there are still some messages to send (the ACK that a is supposed to get for its original FIN), and once this ACK arrives, aenters TIME_WAIT as usual.



顯示這臺(tái)服務(wù)器開放了7710端口,那么這個(gè)端口屬于哪個(gè)程序呢?我們可以使用 lsof -i :7710 命令來查詢:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 1990 root 3u IPv4 4836 TCP *:7710 (LISTEN) 54com.cn

這樣,我們就知道了7710端口是屬于sshd程序的。

感謝各位的閱讀!關(guān)于“Linux下怎么用netstat查看網(wǎng)絡(luò)狀態(tài)、端口狀態(tài)”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

網(wǎng)頁題目:Linux下怎么用netstat查看網(wǎng)絡(luò)狀態(tài)、端口狀態(tài)
當(dāng)前路徑:http://chinadenli.net/article48/jhgihp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)網(wǎng)站排名網(wǎng)站設(shè)計(jì)電子商務(wù)服務(wù)器托管微信小程序

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(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í)需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站