<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Netstat</id>
	<title>Netstat - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Netstat"/>
	<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Netstat&amp;action=history"/>
	<updated>2026-05-15T20:19:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=Netstat&amp;diff=126&amp;oldid=prev</id>
		<title>Ardika Sulistija: Created page with &quot;&lt;b&gt;Netstat&lt;/b&gt; is a useful command to learn more about the configuration of your system, and can be useful when troubleshooting connectivity issues related to the Transport and IP layer. Its great for checking your networking configuration and activity. Prints information about Linux Networking subsystems, such as routing tables, interface statistics, masquerade connections, and multicast memberships.   https://www.tecmint.com/20-netstat-commands-for-linux-network-manage...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Netstat&amp;diff=126&amp;oldid=prev"/>
		<updated>2024-08-27T00:49:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;b&amp;gt;Netstat&amp;lt;/b&amp;gt; is a useful command to learn more about the configuration of your system, and can be useful when troubleshooting connectivity issues related to the Transport and IP layer. Its great for checking your networking configuration and activity. Prints information about Linux Networking subsystems, such as routing tables, interface statistics, masquerade connections, and multicast memberships.   https://www.tecmint.com/20-netstat-commands-for-linux-network-manage...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;b&amp;gt;Netstat&amp;lt;/b&amp;gt; is a useful command to learn more about the configuration of your system, and can be useful when troubleshooting connectivity issues related to the Transport and IP layer. Its great for checking your networking configuration and activity. Prints information about Linux Networking subsystems, such as routing tables, interface statistics, masquerade connections, and multicast memberships. &lt;br /&gt;
&lt;br /&gt;
https://www.tecmint.com/20-netstat-commands-for-linux-network-management/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 $ sudo netstat -lnp | grep :80&lt;br /&gt;
 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 919/apache&lt;br /&gt;
&lt;br /&gt;
The first column tells you what protocol the port is using. &lt;br /&gt;
&lt;br /&gt;
The second and third columns are the receive and send queues (both are set to 0 here). &lt;br /&gt;
&lt;br /&gt;
The column you want to pay attention to is the fourth column, as it lists the local address on which the host is listening. Here the 0.0.0.0:80 tells us that the host is listening on all of its IPs for port 80 traffic. If Apache were listening only on web1’s Ethernet address, you would see 10.1.2.5:80 here.&lt;br /&gt;
&lt;br /&gt;
The final column will tell you which process has the port open, or what process is listening on that port. Here you can see that Apache is running and listening. If you do not see this in your netstat output, you need to start your Apache server.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To see TCP-established connections, as well as process related information, such as PID and process state:&lt;br /&gt;
 $ sudo netstat -tnp&lt;br /&gt;
&lt;br /&gt;
This will provide information about open sockets and processes listening for connections along with their current state. &lt;br /&gt;
 $ sudo netstat -tnpl (or -u)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you see it like &amp;lt;b&amp;gt;tcp6&amp;lt;/b&amp;gt; as seen below, it is indicative that it is also listening on IPv4, even though tcp6. (This is by default, AF_INET6 sockets will actually work for both IPv4 and IPv6..[https://unix.stackexchange.com/questions/237731/why-are-ipv4-tcp-connections-showing-as-tcp6/237747 &amp;lt;b&amp;gt;reference&amp;lt;/b&amp;gt;])&lt;br /&gt;
&lt;br /&gt;
 # netstat -tulpna | grep :80&lt;br /&gt;
 tcp6       0      0 :::80                   :::*                    LISTEN      4848/httpd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
To see default gateway of different range of addresses, for all interfaces, run:&lt;br /&gt;
 $ netstat -rn&lt;br /&gt;
Reference: [[Networking_and_Routing_in_Linux|&amp;lt;b&amp;gt;Networking and Routing in Linux&amp;lt;/b&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to read netstat output====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
 $ sudo netstat -ntp&lt;br /&gt;
 Active Internet connections (w/o servers)&lt;br /&gt;
 Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    &lt;br /&gt;
 tcp        0      0 172.31.33.239:33990     52.94.238.171:443       TIME_WAIT   -                   &lt;br /&gt;
 tcp        0      0 172.31.33.239:41012     54.239.26.26:443        TIME_WAIT   -                   &lt;br /&gt;
 tcp        0    180 172.31.33.239:22        72.21.196.65:30282      ESTABLISHED 17005/sshd: ec2-use &lt;br /&gt;
 tcp        0      0 172.31.33.239:45888     54.239.25.71:443        ESTABLISHED 2274/amazon-cloudwa &lt;br /&gt;
 tcp        0      0 172.31.33.239:22        72.21.196.65:31807      ESTABLISHED 11817/sshd: ec2-use &lt;br /&gt;
 tcp        0      0 172.31.33.239:33992     52.94.238.171:443       TIME_WAIT   -&lt;br /&gt;
&lt;br /&gt;
* If the port (:22) is under &amp;lt;b&amp;gt;Local Address&amp;lt;/b&amp;gt; and the ephemeral port (:30282) is under &amp;lt;b&amp;gt;Foreign Address&amp;lt;/b&amp;gt;, then that connection is &amp;lt;b&amp;gt;inbound&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* If the ephemeral port (:33990) is under &amp;lt;b&amp;gt;Local Address&amp;lt;/b&amp;gt; and the well-known port (:443) is under &amp;lt;b&amp;gt;Foreign Address&amp;lt;/b&amp;gt;, then that connection is &amp;lt;b&amp;gt;outbound&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====How to check what&amp;#039;s listening on a port====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
 # sudo netstat -tulpn | grep LISTEN&lt;br /&gt;
 tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      794/systemd-resolve &lt;br /&gt;
 tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1024/sshd           &lt;br /&gt;
 tcp6       0      0 :::22                   :::*                    LISTEN      1024/sshd           &lt;br /&gt;
 tcp6       0      0 :::1500                 :::*                    LISTEN      1223/java&lt;br /&gt;
&lt;br /&gt;
(Alternate) You can also use lsof:&lt;br /&gt;
 # lsof -i -P -n | grep LISTEN&lt;br /&gt;
 systemd-r  794 systemd-resolve   13u  IPv4  16800      0t0  TCP 127.0.0.53:53 (LISTEN)&lt;br /&gt;
 sshd      1024            root    3u  IPv4  19859      0t0  TCP *:22 (LISTEN)&lt;br /&gt;
 sshd      1024            root    4u  IPv6  19870      0t0  TCP *:22 (LISTEN)&lt;br /&gt;
 java      1223 aws-replication   66u  IPv6  28058      0t0  TCP *:1500 (LISTEN)&lt;/div&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
</feed>