Centos7默认安装了firewalld,如果没有安装的话,则需要YUM命令安装;firewalld真的用不习惯,与之前的iptable防火墙区别太大,但毕竟是未来主流讲究慢慢磨合它的设置规则;
yum install firewalld firewalld-config
yum install firewalld firewalld-config
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --zone=public --add-port=21/tcp --permanent
firewall-cmd --zone=public --add-port=53/udp --permanent
firewall-cmd --zone=public --remove-port=80/tcp --permanent
firewall-cmd --zone=public --remove-port=443/tcp --permanent
firewall-cmd --zone=public --remove-port=22/tcp --permanent
firewall-cmd --zone=public --remove-port=21/tcp --permanent
firewall-cmd --zone=public --remove-port=53/udp --permanent
firewall-cmd --zone=public --add-port=4400-4600/udp --permanent
systemctl start firewalld.service
firewall-cmd --reload 或者 service firewalld restart
firewall-cmd --permanent --list-port
systemctl stop firewalld
systemctl enable firewalld
sytemctl disable firewalld
systemctl status firewalld或者 firewall-cmd --state