CentOS7防火墙开启关闭
2023年8月23日发(作者:爷爷作文(精选36篇))
清华大学抗击疫情-
CentOS7防⽕墙开启关闭CentOS 7.0默认使⽤的是firewall作为防⽕墙使⽤systemctl来管理服务和程序,包括了service和chkconfig1、查看默认防⽕墙状态(关闭后显⽰not running,开启后显⽰running)firewall-cmd --state2、检查防⽕墙的状态systemctl list-unit-files|grep e或者:systemctl status e3、开启防⽕墙systemctl start e --启动firewallsystemctl enable e --开机时启动firewall4、关闭防⽕墙:systemctl stop e --停⽌firewallsystemctl disable e --禁⽌firewall开机启动5、重启防⽕墙systemctl restart e6、查看防⽕墙是否开机⾃启systemctl is-enabled e;echo $? enabled --⾃启或者:systemctl is-enabled e;echo $? disabled --不⾃启7、查看已启动的服务列表systemctl list-unit-files|grep enabled8、开启端⼝firewall-cmd --zone=public --add-port=80/tcp --permanent命令含义:–zone #作⽤域–add-port=80/tcp #添加端⼝,格式为:端⼝/通讯协议–permanent #永久⽣效,没有此参数重启后失效9、查看已经开放的端⼝firewall-cmd --list-port10、屏蔽FirewallD服务systemctl mask firewalld还可以通过创建⼀个e到/dev/null的符号连接来屏蔽防⽕墙服务。11、反屏蔽FirewallD服务systemctl unmask firewalld这是反屏蔽FirewallD服务,它会移除屏蔽FirewallD服务时创建的符号链接,故能重新启⽤服务。12、检查是否已安装防⽕墙yum install firewalld firewall-config