본문 바로가기

Network

netstat 명령어

1.netstat 도움말

C:>netstat /?

Displays protocol statistics and current TCP/IP network connections.

NETSTAT [-a] [-e] [-n] [-o] [-s] [-p proto] [-r] [interval]

-a Displays all connections and listening ports.
-e Displays Ethernet statistics. This may be combined with the -s
option.
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection.
-p proto Shows connections for the protocol specified by proto; proto
may be any of: TCP, UDP, TCPv6, or UDPv6. If used with the -s
option to display per-protocol statistics, proto may be any of:
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
-r Displays the routing table.
-s Displays per-protocol statistics. By default, statistics are
shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
the -p option may be used to specify a subset of the default.
interval Redisplays selected statistics, pausing interval seconds
between each display. Press CTRL+C to stop redisplaying
statistics. If omitted, netstat will print the current
configuration information once.


2.옵션

C:>netstat
Proto Local Address Foreign Address State
TCP bang:4057 localhost:19801 ESTABLISHED
TCP bang:19801 localhost:4057 ESTABLISHED

-n 옵션 사용시 ip address와 port numbers을 숫자로 표시한다.

c:>netstat -n
Proto Local Address Foreign Address State
TCP 127.0.0.1:4057 127.0.0.1:19801 ESTABLISHED
TCP 127.0.0.1:19801 127.0.0.1:4057 ESTABLISHED

-a 옵션 사용시 모든 tcp&udp ports의 listening ports 까지 표시한다.

-o 옵션 사용시 pid 값을 표시한다.

-e Ethernet network interface 의 정보를 표시한다.

C:>netstat -e
Interface Statistics

Received Sent

Bytes 1481212865 483074368
Unicast packets 1648675 1259168
Non-unicast packets 61286 8634
Discards 0 0
Errors 0 0
Unknown protocols 97189

-s 옵션 ip,icmp,tcp,udp의 protocol summary 통계를 표시한다.


C:>netstat -s

IPv4 Statistics

Packets Received = 1665232
Received Header Errors = 0
Received Address Errors = 83
Datagrams Forwarded = 0
Unknown Protocols Received = 0
Received Packets Discarded = 0
Received Packets Delivered = 1665149
Output Requests = 1269804
Routing Discards = 0
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

ICMPv4 Statistics

Received Sent
Messages 8320 4837
Errors 0 4
Destination Unreachable 3979 0
Time Exceeded 2 0
Parameter Problems 0 0
Source Quenches 0 0
Redirects 0 0
Echos 69 4768
Echo Replies 4270 65
Timestamps 0 0
Timestamp Replies 0 0
Address Masks 0 0
Address Mask Replies 0 0

TCP Statistics for IPv4

Active Opens = 25332
Passive Opens = 6437
Failed Connection Attempts = 3345
Reset Connections = 3321
Current Connections = 13
Segments Received = 1538885
Segments Sent = 1151813
Segments Retransmitted = 7219

UDP Statistics for IPv4

Datagrams Received = 117560
No Ports = 8635
Receive Errors = 0
Datagrams Sent = 105812

-r 옵션 routing table을 표시한다.
반응형