Ubuntu
#查看防火墙状态
sudo ufw status
#开启防火墙
sudo ufw enable
#关闭防火墙
sudo ufw disable
CentOs
#查看防火墙状态
systemctl status firewalld
# 开启
sudo service firewalld start
# 重启
sudo service firewalld restart
# 关闭
sudo service firewalld stop
Ubuntu
#查看防火墙状态
sudo ufw status
#开启防火墙
sudo ufw enable
#关闭防火墙
sudo ufw disable
CentOs
#查看防火墙状态
systemctl status firewalld
# 开启
sudo service firewalld start
# 重启
sudo service firewalld restart
# 关闭
sudo service firewalld stop