1

netstat and similar commands provide information on services bound to an IP. This information is however limited when a service binds to "all available interfaces":

root@srv ~# netstat -tulpn | grep 22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1077/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1077/sshd

In the case above, the SSH daemon bound to all available interfaces, but it is not explicit about which ones.

How to check all interfaces (or IP addresses) a service bound to?

1 Answer 1

4

Try ss.

Something like:

ss -o state established '( dport = :ssh or sport = :ssh )'

Might be what you are looking for:

$ ss -o state established '( dport = :ssh or sport = :ssh )'
Netid Recv-Q Send-Q        Local Address:Port                         Peer Address:Port                
tcp   0      0               10.12.11.93:ssh                            10.22.96.0:57244                 timer:(keepalive,119min,0)


Man page online: https://linux.die.net/man/8/ss

3
  • Thanks but this lists the established connections, not the binding (which may not have a connection right now)
    – WoJ
    Aug 3, 2018 at 11:36
  • @WoJ For the binding maybe this is the answer you seek: unix.stackexchange.com/a/16058/191550
    – anon
    Aug 3, 2018 at 11:43
  • Thanks again, but this is the routing - independent of which service bound to which interface.
    – WoJ
    Aug 3, 2018 at 11:53

You must log in to answer this question.

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