Skip to content
Advertisement

How does netstat determine symbolic hostname?

I was trying to understand what the --numeric/-n flag of netstat does? Manual says the following about --numeric/-n

–numeric , -n

Show numerical addresses instead of trying to determine symbolic host, port or user names.

  1. Following is a line of output with “-n” option

    JavaScript
  2. Following is the same line as in A but without “-n” option

    JavaScript

port 8080 in my case is associated with solr. I have no idea why it’s being listed as terabase. That’s why I am wondering how netstat determines symbolic host. It would be helpful if someone can throw light on this.

Advertisement

Answer

You’re mixing ports and hosts I believe.

The symbolic host is determined by DNS lookup, whereas the port usage is what you’ll find in /etc/services (why you have teradata for port 8080 I don’t know – it’s usually http-alt – but go have a look)

So, for example with -n you could have

JavaScript

meaning something is listening on port 5432 on IP 127.0.0.1. Without -n it would be

JavaScript

which makes us much wiser, since we can now see it’s PostgreSQL on localhost.

The price for that information is that the DNS roundtrips take time…!

Cheers,

Advertisement