Network interfaces
Debian/Ubuntu using 'ifconfig' from 'net-tools' package
$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255 ether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet) RX packets 11960 bytes 17022353 (17.0 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5414 bytes 297073 (297.0 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Debian/Ubuntu using 'ip' from 'iproute2' package
$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1 link/ipip 0.0.0.0 brd 0.0.0.0 3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1 link/tunnel6 :: brd :: 14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0 valid_lft forever preferred_lft forever
Connections
Debian/Ubuntu using 'netstat' from 'net-tools' package
Show open socket connections
$ sudo netstat -tulpan Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 172.17.0.2:45280 91.189.88.161:80 TIME_WAIT - tcp 0 0 172.17.0.2:45276 91.189.88.161:80 TIME_WAIT -
Debian/Ubuntu using 'ss' from 'iproute2' package
Show open socket connections
-t
all TCP connections
-a
all connections
-n
ports in number format
root@f67cfbe795d0:/# ss -t -a -n State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* TIME-WAIT 0 0 172.17.0.2:33376 151.101.120.204:80 TIME-WAIT 0 0 172.17.0.2:39792 128.31.0.62:80
macOS Sierra
Show open TCP socket connections
sudo lsof -nP -i4TCP
Show open TCP socket connections, filter for port 8080
and status LISTEN
lsof -nP -i4TCP:8080 | grep LISTEN
Firewall
Show ufw
firewall status
sudo ufw status