Firewalld 针对指定端口开放

安装防火墙(很多缺省已经安装了)

yum firewalld install

 

#centos7启动防火墙 systemctl start firewalld.service #centos7停止防火墙/关闭防火墙 systemctl stop firewalld.service #centos7重启防火墙 systemctl restart firewalld.service #设置开机启用防火墙 systemctl enable firewalld.service #设置开机不启动防火墙 systemctl disable firewalld.service

 

firewall-cmd –permanent –add-rich-rule=”rule family=’ipv4′ source address=’x.x.x.x’ port protocol=’tcp’ port=’xxx’ accept”

不限地址

firewall-cmd –zone=public –add-port=80/tcp –permanent

#centos7查看防火墙所有信息 firewall-cmd –list-all #centos7查看防火墙开放的端口信息 firewall-cmd –list-ports

添加 echo-request 屏蔽

# firewall-cmd –zone=public –add-icmp-block=echo-request [–timeout=seconds]
移除 echo-reply 屏蔽

# firewall-cmd –zone=public –remove-icmp-block=echo-reply