CentOS7 防火墙常用命令
时间:2023-07-18 来源:未知 投稿:admin 点击:次
firewalld防火墙:
查看防火墙状态:firewall-cmd --state
关闭防火墙:systemctl stop firewalld.service
开启防火墙:systemclt start firewalld.service
开启状态:running 关闭状态:not running
开启80端口:
firewall-cmd --permanent --zone=public --add-port=80/tcp
删除80端口
firewall-cmd --permanent --zone=public --remove-port=80/tcp
重新加载防火墙配置以使更改生效:
firewall-cmd --list-all
iptables防火墙(这个防火墙是自己装上去的)
安装iptables命令:yum install iptables-services
查看iptables防火墙:systemctl status iptables.service
关闭iptables防火墙:systemctl stop iptables.service
开启iptables防火墙:systemctl start iptables.service
重启iptables防火墙:systemctl restart iptables.service
查看防火墙状态:firewall-cmd --state
关闭防火墙:systemctl stop firewalld.service
开启防火墙:systemclt start firewalld.service
开启状态:running 关闭状态:not running
开启80端口:
firewall-cmd --permanent --zone=public --add-port=80/tcp
删除80端口
firewall-cmd --permanent --zone=public --remove-port=80/tcp
重新加载防火墙配置以使更改生效:
sudo firewall-cmd --reload
查看所有策略:
firewall-cmd --list-all
iptables防火墙(这个防火墙是自己装上去的)
安装iptables命令:yum install iptables-services
查看iptables防火墙:systemctl status iptables.service
关闭iptables防火墙:systemctl stop iptables.service
开启iptables防火墙:systemctl start iptables.service
重启iptables防火墙:systemctl restart iptables.service
如果您的问题仍未解决,还可以加入服务器在线技术交流QQ群:8017413寻求帮助。
相关内容