The firewall rules currently in effect are displayed by:
iptables -L -n -v
The ports in use for listening are displayed by
ss -lntp
ss -lnup
for TCP and UDP connections, respectively.
If you want, you can get a fairly good idea of what is happening even in another machine (and, for the sake of completeness, on your own too) by means of nmap
:
nmap -p PORT_NUMBERS IP_ADDRESS
This will return the ports' status as open
(a process is listening on it, and there is no firewall), closed
(no one is listening on it), filtered
(a firewall is protecting the port, and nmap
is unable to tell whether the port is open or not), unfiltered
when the ports respond to nmap
which is however unable to tell whether the port is open or not.
The command you posted (obsolete, please use ss
) is used to display listening ports, hence if the port you are interested in is not diplayed, it means the process which should be using such port is not running.
iptables -L -n
maybe?