ดูข้อมูลการติดต่อเน็ตเวิร์คด้วย netstat

เราสามารถใช้คำสั่ง netstat เพื่อแสดงสถิติและการเชื่อมต่อโปรโตคอล TCP / IP ได้ netstat-a จะแสดงการเชื่อมต่อทั้งหมดและ netstat-r แสดง Router Table และการเชื่อมต่อที่ทำงานอยู่ คำสั่ง netstat-o จะแสดง process ID ของโปรแกรมที่ใช้พอร์ตนั้นๆอยู่ คำสั่ง netstat-E จะแสดงสถิติ Ethernet และ netstat-s จะแสดงสถิติของแต่ละโปรโตคอล  netstat-n จะแสดงAddressและหมายเลขพอร์ต ตัวอย่างคำสั่งและผลลัพธ์ netstat แสดงไว้ด้านล่าง:

C:\>netstat -e
Interface Statistics

                       Received      Sent
Bytes                  3995837940    47224622
Unicast packets        120099        131015
Non-unicast packets    7579544       3823
Discards               0             0
Errors                 0             0
Unknown protocols      363054211

C:\>netstat -n -o

Active Connections
 
  proto  Local Address          Foreign Address        State           PID
  TCP    172.31.71.152:1136     157.54.2.84:389        CLOSE_WAIT      180
  TCP    172.31.71.152:2730     172.31.71.99:139       ESTABLISHED     4
  TCP    172.31.71.152:3110     157.54.2.84:389        CLOSE_WAIT      364
  TCP    172.31.71.152:3796     172.30.236.233:1479    ESTABLISHED     1128
  TCP    172.31.71.152:3800     172.30.236.233:1740    ESTABLISHED     1128
  TCP    172.31.71.152:3815     172.30.236.233:1479    ESTABLISHED     908
  TCP    172.31.71.152:3819     172.30.236.233:1740    ESTABLISHED     908
  TCP    172.31.71.152:4034     172.31.16.197:139      TIME_WAIT       0
  TCP    172.31.71.152:4037     157.54.4.183:445       TIME_WAIT       0
  TCP    172.31.71.152:4043     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4044     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4045     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4046     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4047     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4048     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4049     157.60.218.11:119      TIME_WAIT       0
  TCP    172.31.71.152:4050     157.60.218.11:119      TIME_WAIT       0

C:\>netstat -a

Active Connections

 proto Local Address      Foreign Address       State
 TCP  CORP1:1572       172.16.48.10:nbsession   ESTABLISHED
 TCP  CORP1:1589       172.16.48.10:nbsession   ESTABLISHED
 TCP  CORP1:1606       172.16.105.245:nbsession ESTABLISHED
 TCP  CORP1:1632       172.16.48.213:nbsession  ESTABLISHED
 TCP  CORP1:1659       172.16.48.169:nbsession  ESTABLISHED
 TCP  CORP1:1714       172.16.48.203:nbsession  ESTABLISHED
 TCP  CORP1:1719       172.16.48.36:nbsession   ESTABLISHED
 TCP  CORP1:1241       172.16.48.101:nbsession  ESTABLISHED
 UDP  CORP1:1025       *:*
 UDP  CORP1:snmp       *:*
 UDP  CORP1:nbname     *:*
 UDP  CORP1:nbdatagram *:*
 UDP  CORP1:nbname     *:*
 UDP  CORP1:nbdatagram *:*

C:\>netstat -s
IP Statistics

 Packets Received             = 5378528
 Received Header Errors       = 738854
 Received Address Errors      = 23150
 Datagrams Forwarded          = 0
 Unknown protocols Received   = 0
 Received Packets Discarded   = 0
 Received Packets Delivered   = 4616524
 Output Requests              = 132702
 Routing Discards             = 157
 Discarded Output Packets     = 0
 Output Packet No Route       = 0
 Reassembly Required          = 0
 Reassembly Successful             = 0
 Reassembly Failures               = 0
 Datagrams Successfully Fragmented = 0
 Datagrams Failing Fragmentation   = 0
 Fragments Created                 = 0

ICMP Statistics
                          Received  Sent
 Messages                 693       4
 Errors                   0         0
 Destination Unreachable  685       0
 Time Exceeded            0         0
 Parameter problems       0         0
 Source Quenches          0         0
 Redirects                0         0
 Echoes                   4         0
 Echo Replies             0         4
 Timestamps               0         0
 Timestamp Replies        0         0
 Address Masks            0         0
 Address Mask Replies     0         0

TCP Statistics

 Active Opens                 = 597
 Passive Opens                = 135
 Failed Connection Attempts   = 107
 Reset Connections            = 91
 Current Connections          = 8
 Segments Received            = 106770
 Segments Sent                = 118431
 Segments Retransmitted       = 461
 
UDP Statistics

 Datagrams Received   = 4157136
 No Ports             = 351928
 Receive Errors       = 2
 Datagrams Sent       = 13809
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s