Linux 防火墙之 Firewalld

查看防火墙状态:

systemctl status firewalld.service
firewall-cmd --state

查询已开放端口:

firewall-cmd --list-ports

查询防火墙配置:

firewall-cmd --list-all

开启防火墙:

systemctl start firewalld.service

关闭防火墙:

systemctl stop firewalld.service

重启防火墙:

firewall-cmd --reload

添加开放端口:

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

删除开放端口:

firewall-cmd --zone=public --remove-port=80/tcp --permanent

添加白名单IP&端口:

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.2" port protocol="tcp" port="1000" accept"

删除白名单IP&端口:

firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.2" port protocol="tcp" port="1000" accept"

查看防火墙开机启动状态:

systemctl is-enabled firewalld.service

设置防火墙开机启动:

systemctl enable firewalld.service

设置防火墙开机不启动:

systemctl disable firewalld.service

你可能感兴趣的:(面试,Linux)