Skip to main content

C.4 netstat Command


C.4 netstat Command
The netstat command displays the network status and the protocol statistics.
This command allows you to view a list of connections maintained by the host and their status. The command also allows you to check the IP, TCP, and UDP packet statistics and error conditions.
Table C-4 lists the options of the netstat command and how those options are useful for troubleshooting.
Table C-4  netstat command options
Option Description Application
-i
Displays the interface status. The displayed content includes information on incoming and outgoing packets, incoming and outgoing errors, collisions, and queues. Allows you to view a concise overview of the network status.
-i interval
Executes the netstat command at the interval of the number of seconds specified with a numeric value after the -i option. Identifies intermittent or long-term network events. You can view nighttime events at a glance by piping the netstat output to a file.
-p
Displays the media table. Allows you to check the MAC addresses of the host on the subnetwork.
-r
Displays the routing table. Allows you to check the routing information.
-n
Converts a host name into an IP address and then displays it. Allows you to check the IP address instead of the host name.
The following example shows the output from the netstat command.
# netstat -p
Net to Media Table: IPv4
Device   IP Address               Mask      Flags      Phys Addr
------ -------------------- --------------- -------- ---------------

net0   4S-111-D0            255.255.255.255 SPLA     b0:99:28:98:30:36
net0   10.24.187.1          255.255.255.255          00:0a:b8:50:cd:42
net0   224.0.0.22           255.255.255.255 S        01:00:5e:00:00:16

Net to Media Table: IPv6
 If   Physical Address    Type      State      Destination/Mask
----- -----------------  ------- ------------ ---------------------------

net0  33:33:00:00:00:01  other   REACHABLE    ff02::1
net0  33:33:00:00:00:02  other   REACHABLE    ff02::2
net0  33:33:00:01:00:02  other   REACHABLE    ff02::1:2
net0  33:33:00:00:00:16  other   REACHABLE    ff02::16
net0  b0:99:28:98:30:36  local   REACHABLE    fe80::b299:28ff:fe98:3036
net0  33:33:ff:98:30:36  other   REACHABLE    ff02::1:ff98:3036

#