安装Firewall
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 firewall-cmd –zone=public –add-port=4400-4600/tcp –permanent
开启防火墙
systemctl start firewalld
重启防火墙
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
审核编辑:刘清
全部0条评论
快来发表一下你的评论吧 !