Firewall Ports
- Chris Speed
- Nov 27, 2022
- 1 min read
Updated: Jul 25, 2023
Ubuntu
Turn Firewall On or Off
sudo ufw enable
sudo ufw disable
Check Firewall Ports
sudo ufw status verbose
sudo ufw app list
Open a Port
sudo ufw allow 22/tcp
sudo ufw allow from 192.168.1.10 to any port 22
Delete a Port
sudo ufw status numbered
sudo ufw delete 3
or
sudo ufw delete allow 22/tcp
Centos
Open/Close a Port
sudo firewall-cmd --zone=public --add-port=55555/tcp --permanent
sudo firewall-cmd --zone=public --remove-port=55555/tcp --permanent
sudo firewall-cmd --reload
Check Firewall Ports
sudo firewall-cmd --list-all
sudo yum install nmap
sudo nmap -n -PN -sT -sU -p- localhost
sudo yum install net-tools
netstat -pnltu
Windows
Open Windows Firewall by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type firewall, and then click Windows Firewall.
In the left pane, click Advanced settings. Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
In the Windows Firewall with Advanced Security dialog box, in the left pane, click Inbound Rules, and then, in the right pane, click New Rule.
Now select port and click next, now enter your port in specific local ports OR check on All local port.
Select your preferred setting on next two panel, and the last give your Inbound rule.
References:
How to Install netstat Command in Linux. https://www.tecmint.com/install-netstat-in-linux/
留言