install netstat
To use netstat to check active connections and open ports, which can help in enabling the firewall, follow these steps:
- Install netstat (if not already installed):
- On Debian-based systems like Ubuntu, you can install net-tools, which includes netstat:
sudo apt update
sudo apt install net-tools
- Check listening ports:
- Use the following command to see all active connections and listening ports:
sudo netstat -tuln
- -t shows TCP connections.
- -u shows UDP connections.
- -l shows only listening ports.
- -n shows numeric addresses instead of resolving names.
- View specific details:
- To view specific details about the processes listening on the ports:
sudo netstat -tulnp
- -p shows the PID (Process ID) and the name of the program listening on each port.
Edited by peturbg