iptables配置防火墙
iptables -A INPUT -p tcp --dport 22 -j ACCEPT service iptables save service iptables restart
有时间需要使用firewall-cmd来配置防火墙
firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload
firewall-cmd查看配置
firewall-cmd --zone=public --query-port=80/tcp
firewall-cmd删除配置
firewall-cmd --zone=public --remove-port=80/tcp --permanent
开启与关闭防火墙
systemctl start firewalld.service systemctl stop firewalld.service firewall-cmd --state
锁定与解锁服务
systemctl mask firewalld systemctl unmask firewalld