2

I have installed and run docker and now it created another network interface docker0:

3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 06:19:32:11:AD:18 brd ff:ff:ff:ff:ff:ff
    inet xx.xx.xx.xx/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 ab90::43:2af:fe30:2245/64 scope link 
       valid_lft forever preferred_lft forever

Even when stopping the docker service this interface is still up. How is it possible to see all open/listening ports on all interfaces (eth0, wlan0 and docker0)? I've tried using lsof but I couldn't find any interface granularity options.

1 Answer 1

3

netstat -plnt (or the newer ss -plnt) will now you all listening TCP ports on your system, and which process is listening. If not run as the superuser, you will only see the process names for processes owned by the user as whom netstat or ss is invoked.

To show UDP ports as well as TCP ports, omit the t switch (netstat -pln / ss -pln).

The switches used are to show pports listening on tcp numerically.

3
  • 1
    But is it possible to see the interface the process is listening on?
    – Sebi
    Jun 1, 2016 at 15:05
  • ip a or ifconfig will show you each interface's assigned IP address(es), which you can then correlate with the output of ss -plnt to determine which service is on which interface by way of the IP to which it is assigned. The address 0.0.0.0 or * (IPv4); or :: (IPv6) indicates binding to all interfaces.
    – DopeGhoti
    Jun 1, 2016 at 16:25
  • I know that, but I was wondering if lsof can do it in one go.
    – Sebi
    Jun 1, 2016 at 20:07

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.