service firewalld status; #查看防火墙状态systemctl start firewalld.service;#开启防火墙systemctl stop firewalld.service;#关闭防火墙systemctl restart firewalld.service; #重启防火墙systemctl disable firewalld.service#禁止防火墙开启自启systemctl enable firewalld#设置防火墙开机启动yum remove firewalld#卸载firewall
安装iptables防火墙及操作:#yum install iptables-services#安装iptables防火墙#vi /etc/sysconfig/iptables#编辑防火墙配置文件,开放3306端口 添加配置:-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT#systemctl restart iptables.service #最后重启防火墙使配置生效#systemctl enable iptables.service #设置防火墙开机启动