[NOTE] Linux防火墙
CentOS firewalld
Firewalld is installed on CentOS 7 as default. Here comes some operations of it.
- Check firewall status:
sudo firewall-cmd --state
- Disable firewalld:
sudo systemctl disable firewalld
(禁止开机启动) - Stop firewalld:
sudo systemctl stop firewalld
Ubuntu 18.04 ufw
- check a current firewall status:
sudo ufw status
- for more verbose:
sudo ufw status verbose
- enable firewall:
sudo ufw enable
- disable firewall:
sudo ufw disable
基操:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
orsudo ufw allow 22
sudo ufw allow 2222
sudo ufw allow http
orsudo ufw allow 80
sudo ufw allow https
orsudo ufw allow 443
sudo ufw allow 6000:6003/tcp
sudo ufw allow 6000:6003/udp