1

I used netstat command recently, and the output is below.

netstat  -a    

proto  local address          foreign address       state

tcp    127.0.0.1:1107         avinash-pc:0          listening
tcp    0.0.0.0:134            avinash-pc:0          listening
tcp    226.178.166.149:1104   a60-274-182-61:https  close_wait
udp    0.0.0.0:566            *.*                   
udp    [::]:566               *.*
  1. When I did netstat -n, there was no 0.0.0.0:134 in the output... why?
  2. What is meant by the first and second entries(local and foreign address are both on my computer)
    • i.e. why is my computer connecting to itself?
  3. What is meant by . of 3rd entry and [::] of 4th entry?

2 Answers 2

4

from netstat -h:

-a            Displays all connections and listening ports.

As in both current connections and listening ports (half open).

-n            Displays addresses and port numbers in numerical form.

As in, do not resolve addresses to host names.

Your computer can and regularly does connect to itself, usually for IPC or administrative tasks.

*.* = All IPv4 addresses (it's listening, so accept connections from any IPv4)
[::] = All IPv6 addresses (same reason as the last).

2
  • ...thanks but ...1. i think u didn't understand my first question...i know that -n gives numerical output...what i am saying is that when i used netstat -n entries of second form were displayed as ip addresses but the entry row corresponding 0.0.0.0:134 was not there...i.e. in tcp protocol first column contained just 127.0.0.1:1107 and 226.178.166.149:1104..... 2. also i read that ports above 1024 are used only for connections with remote computers ...but in first row my computer connects to itself using a port above 1024
    – AvinashK
    Dec 20, 2011 at 7:24
  • 1. -a switch adds "listening" connections, which the "0.0.0.0:124" is, it's not "established". When running netstat without -a those "listening" entries will not be displayed. 2. What you read was wrong. Ports under 1024 are reserved for privileged communication (leaving 1024 and up for privileged or non-privileged); has nothing to do with remote vs local communication.
    – Chris S
    Dec 20, 2011 at 13:24
2

netstat -a vs netstat -n

The -a options shows listening connections on your system. The -n option disables name resolution. You can combine the two options like netstat -a -n. Then you would disable name resolution, and see ports your system is listening on.

What is meant by the first and second entries

The important piece is the last column, which states listening. Your computer is accepting incoming connections on tcp/1107 and tcp/134.

What is meant by . of 3rd entry and [::] of 4th entry?

Again it is just ports open for listening, but UDP is displayed differently because it isn't connection based.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .