# 1.启动防火墙
systemctl start firewalld
#2.关闭防火墙
systemctl stop firewalld
#3.查看防火墙状态
systemctl status firewalld
#4.开机自动禁用
systemctl disable firewalld
#5.开机自动启动
systemctl enable firewalld
#6.开放80/tcp端口 (--permanent永久生效,没有此参数重启后失效)
firewall-cmd --zone=public --add-port=80/tcp --permanent
#7.查看80/tcp端口是否开放
firewall-cmd --zone=public --query-port=80/tcp
#8.查看系统所有开放的端口
firewall-cmd --zone=public --list-ports
#9. 关闭80/tcp端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent
#10.批量开放端口,打开从80000到85000之间的所有端口
firewall-cmd --zone=public --add-port=80000-85000/tcp --permanent
#11.批量关闭端口,关闭从80000到85000之间的所有端口
firewall-cmd --zone=public --remove-port=80000-85000/tcp --permanent
#12.修改防火墙的设置后立即生效
firewall-cmd --reload
标签:firewall,cmd,端口,常用命令,tcp,--,linux,80
From: https://www.cnblogs.com/mznsndy/p/17690793.html