Networking tools

iproute2

Display ports activated

ss -ntl

Output

State                       Recv-Q                      Send-Q                                            Local Address:Port                                              Peer Address:Port
LISTEN                      0                           128                                                     0.0.0.0:3000                                                   0.0.0.0:*
LISTEN                      0                           128                                                     0.0.0.0:5432                                                   0.0.0.0:*
LISTEN                      0                           128                                                     0.0.0.0:2200                                                   0.0.0.0:*
LISTEN                      0                           128                                                     0.0.0.0:3001                                                   0.0.0.0:*
LISTEN                      0                           128                                                     0.0.0.0:5433                                                   0.0.0.0:*
LISTEN                      0                           20                                                    127.0.0.1:25                                                     0.0.0.0:*
LISTEN                      0                           128                                                     0.0.0.0:443                                                    0.0.0.0:*
LISTEN                      0                           128                                                   127.0.0.1:41211                                                  0.0.0.0:*
LISTEN                      0                           128                                                     0.0.0.0:8989                                                   0.0.0.0:*

Display daemons using ports

ss -ntlp

Output

State               Recv-Q              Send-Q                            Local Address:Port                             Peer Address:Port
LISTEN              0                   128                                     0.0.0.0:3000                                  0.0.0.0:*
LISTEN              0                   128                                     0.0.0.0:5432                                  0.0.0.0:*
LISTEN              0                   128                                     0.0.0.0:2200                                  0.0.0.0:*
LISTEN              0                   128                                     0.0.0.0:3001                                  0.0.0.0:*
LISTEN              0                   128                                     0.0.0.0:5433                                  0.0.0.0:*
LISTEN              0                   20                                    127.0.0.1:25                                    0.0.0.0:*
LISTEN              0                   128                                     0.0.0.0:443                                   0.0.0.0:*
LISTEN              0                   128                                   127.0.0.1:41211                                 0.0.0.0:*                  users:(("code-e7e037083f",pid=11357,fd=9))
LISTEN              0                   128                                     0.0.0.0:8989                                  0.0.0.0:*                  users:(("jupyter-noteboo",pid=722,fd=4))

System administration commands (BSD TCP/IP Suite)

ifconfig

ifconfig - interface configurator is depricated and has to be installed before using.

Install ifconfig if not available on the system

sudo apt install net-tools
ifconfig is depricated and has to be installed before using. Better use another tool / command set, e.g. ip address show

ip command

Displays all ip addresses of the host:

ip address show

Output

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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
44290: veth6a4757d@if44289: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-3088a32ea240 state UP group default
    link/ether 8a:0d:ef:af:0a:a5 brd ff:ff:ff:ff:ff:ff link-netnsid 0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:56:44:1f:6f brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    altname ens18
    inet 185.239.209.239/23 brd 185.239.209.255 scope global eth0
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:64:0a:07:e1 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

Displays all links of the host:

ip link show

Output

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
44290: veth6a4757d@if44289: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-3088a32ea240 state UP mode DEFAULT group default
    link/ether 8a:0d:ef:af:0a:a5 brd ff:ff:ff:ff:ff:ff link-netnsid 0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:50:56:44:1f:6f brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    altname ens18
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
    link/ether 02:42:64:0a:07:e1 brd ff:ff:ff:ff:ff:ff

Only show IPv4 interfaces/addresses

ip -4 address show

Output

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    altname enp0s18
    altname ens18
    inet 185.239.209.239/23 brd 185.239.209.255 scope global eth0
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

Show IPv4 address of a specific address, e.g. docker0

ip -4 address show docker0

Output

3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever