netnr / iptables-firewall
2019-07-25 14:59
centos 防火墙的启动、停止
# 查看状态
systemctl status iptables
# 停止
systemctl stop iptables
# 启动
systemctl start iptables
# 重启
systemctl restart iptables
# 永久关闭
systemctl disable iptables.service
# 永久关闭后启用
systemctl enable iptables.service

# 配置文件路径
vi /etc/sysconfig/iptables


systemctl status firewalld  # 查看firewall服务状态
systemctl start firewalld   # 启动
service firewalld restart   # 重启
systemctl stop firewalld    # 关闭
systemctl disable firewalld # 开机禁用
systemctl enable firewalld  # 开机启用

# 查看防火墙规则
firewall-cmd --list-all

# 查询端口是否开放
firewall-cmd --query-port=8080/tcp

# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=8080-8085/tcp

# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp

# 查看防火墙的开放的端口
firewall-cmd --permanent --list-ports

# 重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload

# help
https://blog.csdn.net/qq_41153478/article/details/83033688
ˆ