> For the complete documentation index, see [llms.txt](https://wiki.astrawireless.net/astra-wireless-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.astrawireless.net/astra-wireless-documentation/technical-documentation/astraflex-technical-user-manual/layer-3-command-set-ip-networking/netstat-command-network-statistics.md).

# ⁣⁣netstat command (Network statistics)

### Description <a href="#id-netstatcommand-networkstatistics-description" id="id-netstatcommand-networkstatistics-description"></a>

The *"netstat"* command allows to monitor network connections, network packets statistic for each protocol, to display routing tables and statistics for network interfaces.

**Syntax:**

```
net -r print routing table
net -i [clear] print interface table
net -s print IP statistics
net -s{rut} print protocol statistics (raw,udp,tcp)
```

### Parameters <a href="#id-netstatcommand-networkstatistics-parameters" id="id-netstatcommand-networkstatistics-parameters"></a>

<table><thead><tr><th width="155">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><em><strong>-r</strong></em><br></td><td><p>Displays the content of the system routing tables.</p><p>Flags for specific routes have the following meaning:</p><ul><li>"<em>U</em>" – this routing table element is currently active.</li><li>"<em>H</em>" – this route leads to a host. If this flag is not set, the route goes to a network.</li><li>"<em>D</em>" – this route has been created using the "<em>icmp redirect</em>" protocol.</li><li>"<em>M</em>" – this route has been modified using the "<em>icmp redirect</em>" protocol.</li><li>"<em>G</em>" – this route is connected to a host. If this flag is not set, it is considered that the route destination is directly connected.</li><li>"<em>S</em>" – it's a static route, set by the operator using a "<em>route add</em>" command.</li><li>"<em>1</em>" – a pseudostatic route, set as a result of a "<em>rip static</em>" command.</li><li>"<em>L</em>" – a route points to a directly connected host (for such a route an APR request may be performed).</li><li>"<em>C</em>" – when using this route, more specific routes may be created (e.g. using the "<em>L"</em> flag).</li></ul></td></tr><tr><td><em><strong>-i [clear]</strong></em></td><td><p>Displays an information about each network interface in the system.</p><ul><li>"<em>clear</em>" – resets a statistic of inbound / outbound packets and errors.</li></ul></td></tr><tr><td><strong>-s{rut}</strong><br></td><td><p>Displays statistics for IP and ICMP packets.</p><ul><li>"<em>r</em>" – if added, statistic of RAW protocol packets is displayed.</li><li>"<em>u</em>" – statistic of UDP protocol packets is displayed.</li><li>"<em>t</em>" – statistic of TCP protocol packets is displayed.</li></ul></td></tr></tbody></table>

### Examples <a href="#id-netstatcommand-networkstatistics-examples" id="id-netstatcommand-networkstatistics-examples"></a>

Display the content of the system routing tables using the "*-r*" parameter.

```
Routing tables
Destination        Gateway            Flags     Refs     Use  Interface
default            192.168.103.1      UGS         1       47  svi1
10.10.10.0/24      link#2             UC          0        0  eth0
127.0.0.1          127.0.0.1          UH          2       26  lo0
192.168.103.0/24   link#6             UC          0        0  svi1
192.168.103.1      6c:3b:e5:51:e3:8d  UHL         1        0  svi1
192.168.103.20     bc:ee:7b:8d:32:65  UHL         0     1743  svi1
192.168.103.243    08:00:27:54:47:bf  UHL         1    17257  svi1
224.0.0.0/8        127.0.0.1          UGS         0        0  lo0
```

Reset the statistic of packets and display the information about network interfaces using the "*netstat -i \[clear]*" command.

```
Name      Network            Address               Ipkts Ierrs      Opkts Oerrs
lo0       Link:                                        0     0          0     0
lo0       127.0.0.1/32       127.0.0.1
eth0      Link:              00043503f7dd              0     0          0     0
eth0      10.10.10.0/24      10.10.10.14
eth1      Link:              00043513f7dd              0     0          0     0
eth1      none               none
rf5.0     Link:              00043523f7dd              0     0          0     0
rf5.0     none               none
null0*    Link:                                        0     0          0     0
svi1      Link:              02043503f7dd              0     0          0     0
svi1      192.168.103.0/24   192.168.103.37
```

Use the "*-s*" parameter to display packet statistic.

```
IP statistic:
ips_total           8584161 (total packets received)
ips_badsum                0 (checksum bad)
ips_tooshort              0 (packet too short)
ips_toosmall              0 (not enough data)
ips_badhlen               0 (ip header length < data size)
ips_badlen                0 (ip length < ip header length)
ips_fragments             0 (fragments received)
ips_fragdropped           0 (frags dropped (dups,ipstat. out of space))
ips_fragtimeout           0 (fragments timed out)
ips_forward               0 (packets forwarded)
ips_cantforward     2496172 (packets rcvd for unreachable dest)
ips_redirectsent          0 (packets forwarded on same net)
ips_noproto               0 (unknown or unsupported protocol)
ips_delivered       6087989 (datagrams delivered to upper level
ips_localout         335787 (total ip packets generated here)
ips_odropped              0 (lost packets due to nobufs,ipstat. etc.)
ips_reassembled           0 (total packets reassembled ok)
ips_fragmented            0 (datagrams sucessfully fragmented)
ips_ofragments            0 (output fragments created)
ips_cantfrag              0 (don't fragment flag was set,ipstat. etc.)
ips_badoptions            0 (error in option processing)
ips_noroute               0 (packets discarded due to no route)
ips_badvers               0 (ip version != 4)
ips_rawout            17401 (total raw ip packets generated)
ips_badfrags              0 (malformed fragments (bad length))
ips_rcvmemdrop            0 (frags dropped for lack of memory)
ips_toolong               0 (ip length > max ip packet size)
 
ICMP Staticstic:
icps_error                0 ( # of calls to icmp_error )
icps_oldshort             0 ( no error 'cuz old ip too short )
icps_oldicmp              0 ( no error 'cuz old was icmp )
icps_badcode              0 ( icmp_code out of range )
icps_tooshort             0 ( packet < ICMP_MINLEN )
icps_checksum             0 ( bad checksum )
icps_badlen               0 ( calculated bound mismatch )
icps_reflect              0 ( number of responses )
icps_bmcastecho           0 ( rejected broadcast icmps )
```

Display statistic of UDP protocol packets using the "*netstat -su*" command.

```
UDP statistic:
udps_ipackets       5878277
udps_opackets         11019
udps_hdrops               0
udps_badsum               0
udps_badlen               0
udps_noport               0
udps_fullsock             0
udps_pcbhashmiss      17511
0.0.0.0:0 snmp
0.0.0.0:161 snmp
0.0.0.0:22534 trap
```
