Difference between revisions of "Netstat"

[unchecked revision] [quality revision]
m
 

1 Article purpose[edit]

This article provides the basic information needed to start using the Linux tool: netstat [1].

2 Introduction[edit]

The following table provides a brief description of the tool, as well as its availability depending on the software packages:

Yes: this tool is either present (ready to use or to be activated), or can be integrated and activated on the software package.

No: this tool is not present and cannot be integrated, or it is present but cannot be activated on the software package.

Tool STM32MPU Embedded Software distribution STM32MPU Embedded Software distribution for Android™
Name Category Purpose Starter Package Developer Package Distribution Package Starter Package Developer Package Distribution Package
netstat Monitoring tools netstat[1] prints network connections, routing tables, interface statistics, masquerade connections, and multicast membership information. Yes Yes Yes Yes Yes Yes

3 Installing the trace and debug tool on your target board[edit]

3.1 Using the STM32MPU Embedded Software distribution[edit]

netstat is installed by default and ready to be used with all STM32MPU Embedded Software Packages.

It comes through the busybox:

 which netstat | xargs ls -la
/bin/netstat -> /bin/busybox.nosuid

3.2 Using the STM32MPU Embedded Software distribution for Android™[edit]

netstat is installed by default and ready to be used with all STM32MPU Embedded Software Packages for Android™.

It comes with the toybox:

 which netstat | xargs ls -la
/system/bin/netstat -> toybox

4 Getting started[edit]

Here are basic commands to start with netstat:

  • Display kernel routing information
 netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.99.3.254     0.0.0.0         UG        0 0          0 eth0
10.99.0.0       0.0.0.0         255.255.252.0   U         0 0          0 eth0
10.99.3.254     0.0.0.0         255.255.255.255 UH        0 0          0 eth0
  • List out listening-only connections
 netstat -tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 0.0.0.0:19999           0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      
tcp        0      0 10.99.1.237:53          0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:1534            0.0.0.0:*               LISTEN      
tcp        0      0 :::19999                :::*                    LISTEN      
tcp        0      0 :::5355                 :::*                    LISTEN      
tcp        0      0 :::53                   :::*                    LISTEN      
tcp        0      0 :::22                   :::*                    LISTEN

5 To go further[edit]

Additional documentation is available on Internet about netstat. See References.

Refer to LinuxTemplate:Sup ® man page[1] for more details on command options.

6 References[edit]


  • Useful external links
Document link Document Type Description
netstat (wikipedia.org) Standard wikipedia.org
netstat examples User Guide binarytides.com
netstat main commands User Guide geekflare.com



==Article purpose==
This article provides the basic information needed to start using the Linux tool: '''netstat''' <ref name=netstatmanpage/>.

==Introduction==
{{:Trace_and_debug_tools_assignment_table_template}}<onlyinclude>

 | [[Netstat|netstat]]
 | [[:Category:Monitoring tools|Monitoring tools]]
 | style="text-align:left;" | '''netstat'''<ref name=netstatmanpage>https://linux.die.net/man/8/netstat</ref> prints network connections, routing tables, interface statistics, masquerade connections, and multicast membership information.
 || {{Y}} || {{Y}} || {{Y}}
 || {{Y}} || {{Y}} || {{Y}}
 |-</onlyinclude>

 |}

== Installing the trace and debug tool on your target board ==
=== Using the STM32MPU Embedded Software distribution ===
'''netstat''' is installed by default and ready to be used with all STM32MPU Embedded Software Packages.

It comes through the '''busybox''':
 {{Board$}} which netstat | xargs ls -la
 /bin/netstat -> /bin/busybox.nosuid

=== Using the STM32MPU Embedded Software distribution for Android&trade; ===
'''netstat''' is installed by default and ready to be used with all STM32MPU Embedded Software Packages for Android&trade;.

It comes with the '''toybox''':
 {{Board$}} which netstat | xargs ls -la
 /system/bin/netstat -> toybox

==Getting started==
Here are basic commands to start with netstat:

* Display kernel routing information
 {{Board$}} netstat -rn
 Kernel IP routing table
 Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
 0.0.0.0         10.99.3.254     0.0.0.0         UG        0 0          0 eth0
 10.99.0.0       0.0.0.0         255.255.252.0   U         0 0          0 eth0
 10.99.3.254     0.0.0.0         255.255.255.255 UH        0 0          0 eth0

* List out listening-only connections
 {{Board$}} netstat -tnl
 Active Internet connections (only servers)
 Proto Recv-Q Send-Q Local Address           Foreign Address         State       
 tcp        0      0 0.0.0.0:19999           0.0.0.0:*               LISTEN      
 tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      
 tcp        0      0 10.99.1.237:53          0.0.0.0:*               LISTEN      
 tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
 tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      
 tcp        0      0 0.0.0.0:1534            0.0.0.0:*               LISTEN      
 tcp        0      0 :::19999                :::*                    LISTEN      
 tcp        0      0 :::5355                 :::*                    LISTEN      
 tcp        0      0 :::53                   :::*                    LISTEN      
 tcp        0      0 :::22                   :::*                    LISTEN

== To go further ==
Additional documentation is available on Internet about '''netstat'''. See [[#References|References]].

Refer to Linux{{<sup>|&reg;}}</sup> man page<ref name=netstatmanpage/> for more details on command options.

== References ==<references />


* Useful external links
{|
! scope=col | Document link
! scope=col | Document Type
! scope=col | Description
|-
| [https://en.wikipedia.org/wiki/Netstat netstat (wikipedia.org)]
| Standard
| wikipedia.org
|-
| [http://www.binarytides.com/linux-netstat-command-examples netstat examples]
| User Guide
| binarytides.com
|-
| [https://geekflare.com/netstat/ netstat main commands]
| User Guide
| geekflare.com
|}
<noinclude>
{{ ArticleBasedOnModel | Trace and debug tools article model }}
{{ PublicationRequestId | 9039 | 08Oct'18 }}
[[Category:Linux monitoring tools]]
</noinclude>
Line 58: Line 58:
 
Additional documentation is available on Internet about '''netstat'''. See [[#References|References]].
 
Additional documentation is available on Internet about '''netstat'''. See [[#References|References]].
   
Refer to Linux{{sup|&reg;}} man page<ref name=netstatmanpage/> for more details on command options.
+
Refer to Linux<sup>&reg;</sup> man page<ref name=netstatmanpage/> for more details on command options.
   
 
== References ==
 
== References ==
Line 83: Line 83:
 
|}
 
|}
   
  +
<noinclude>
 
{{ ArticleBasedOnModel | Trace and debug tools article model }}
 
{{ ArticleBasedOnModel | Trace and debug tools article model }}
 
{{ PublicationRequestId | 9039 | 08Oct'18 }}
 
{{ PublicationRequestId | 9039 | 08Oct'18 }}
 
 
[[Category:Linux monitoring tools]]
 
[[Category:Linux monitoring tools]]
  +
</noinclude>