[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cannot see a process listening on 127.0.0.1



Hi Victor,

On Thu, Aug 20, 2020 at 12:09:03PM +0700, Victor Sudakov wrote:
> There is a process listening on 127.0.0.1:8081 but for some reason
> netstat/sockstat/ss do not show it listening on IPv4. Is this a bug or a
> feature?

I think it's listening on an IPv4-mapped IPv6 address so it can
accept either v4 or v6. Does this answer your question?

    https://unix.stackexchange.com/questions/152612/netstat-why-are-ipv4-daemons-listening-to-ports-listed-only-in-a-inet6

Daemons that want to receive connections will do the equivalent of:

    bind(address, port)

The address will determine the interface and whether it is v4 or v6
or whatever. If they instead do:

    bind(INADDR_ANY, port)

then this will bind to every interface whether it's v4 or v6 and the
daemon will get udp6 or tcp6 sockets that can from fromn/to a v4 address.

If you daemon instead had an explicit list of address/port pairs to
listen on then it would do multiple binds and I believe the IPv4
ones would show up in netstat etc as being tcp4.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: