0

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.

8
  • if you have lsof installed, run lsof -i tcp:8081 and post the output in the question. Apr 25, 2018 at 15:38
  • @darcy-nader I don't have lsof. And my SO is Solaris.
    – abarazal
    Apr 25, 2018 at 16:12
  • What does netstat -l -n show? I'm guessing that you'll see an IPv4 and IPv6 address.
    – ErikF
    Apr 25, 2018 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. Apr 25, 2018 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/… Apr 26, 2018 at 9:42

1 Answer 1

1

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 127.0.0.1 24482

In a separate terminal:

# Terminal 2
$ nc -kl <public_ip> 24482

From another terminal on the local host:

# Terminal 3
$ telnet localhost 24482
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
hi
^]
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 '^]'.
ho
^]
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.

2
  • Should say 'hi' in Terminal 1, right?
    – abarazal
    Apr 27, 2018 at 20:10
  • @abaraza Yes, I corrected the description to indicate that hi is seen on Terminal 1 Apr 29, 2018 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.