How is it possible that netstat -a | grep 8081 shows this:

localhost.8081             *.*                0      0 49152      0 LISTEN
      *.8081               *.*                0      0 49152      0 LISTEN

I don't really understand which means the second entry.

UPDATE_1: I've checked that two different processes are listening on 8081... I used to believe that this is not possible. One process is Jboss, which 8081 port is used to serve browser requests, and the other is Gitblit GO (It could have an embeded server in JAR), which 8081 port is used to shutdown.

  • if you have lsof installed, run lsof -i tcp:8081 and post the output in the question. – D'Arcy Nader Apr 25 '18 at 15:38
  • @darcy-nader I don't have lsof. And my SO is Solaris. – abarazal Apr 25 '18 at 16:12
  • What does netstat -l -n show? I'm guessing that you'll see an IPv4 and IPv6 address. – ErikF Apr 25 '18 at 17:25
  • 1
    It looks like one process is listening on the loopback interface, and the other is listening on, effectively, any other interface. A client accessing localhost:8081 would connect to the first. A client accessing <publicIP>:8081 would connect to the second. – Andy Dalton Apr 25 '18 at 18:07
  • 1
    Which version of Solaris? If Solaris 11, you can use netstat directly to get the process(s) listening on a port. On Solaris 10, see stackoverflow.com/questions/13246309/… – Andrew Henle Apr 26 '18 at 9:42

I did the following experiment to illustrate my comment above. I use the netcat command to implement two simple TCP servers. My secnario differs from yours a bit in that I explicitly bind to the public IP instead of *:8081

# Terminal 1
$ nc -kl 24482

In a separate terminal:

# Terminal 2
$ nc -kl <public_ip> 24482

From another terminal on the local host:

# Terminal 3
$ telnet localhost 24482
Connected to localhost.
Escape character is '^]'.
telnet> q
Connection closed.

After that, I see hi in Terminal 1.

Next, from a remote node:

# Terminal 4 (on remote node)
$ telnet <public_ip> 24482
Trying <public_ip>...
Connected to <public_ip>.
Escape character is '^]'.
telnet> q
Connection closed.

After that, I see ho in Terminal 2.

I suspect that this is the behavior that you would see, although I don't have a Solaris environment in which to test it.

  • Should say 'hi' in Terminal 1, right? – abarazal Apr 27 '18 at 20:10
  • @abaraza Yes, I corrected the description to indicate that hi is seen on Terminal 1 – Andy Dalton Apr 29 '18 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.