firewalld
启动与关闭
systemctl start firewalld #临时开启
systemctl stop firewalld #临时关闭
systemctl enable firewalld #永久开启
systemctl disable firewalld #永久关闭
端口放行
firewall-cmd --permanent --zone=trusted --change-interface=docker0 #docker虚拟网卡加信任
firewall-cmd --zone=public --permanent --add-port=8883/tcp #永久放行tcp端口
firewall-cmd --zone=public --permanent --add-port=8883/udp #永久放行udp端口
firewall-cmd --zone=public --permanent --remove-port=80/tcp #就用移除tcp端口
firewall-cmd --reload #重载
firewall-cmd --list-all #查看列表
firewall-cmd --direct --get-all-rules #查看规则
firewall-cmd -h #查看帮助
[root@wjy ~]# cd /etc/firewalld/ #也可以直接在这里修改配置文件
[root@wjy firewalld]# ll
总用量 8
-rw-r--r--. 1 root root 2706 10月 1 2020 firewalld.conf
drwxr-x---. 2 root root 6 10月 1 2020 helpers
drwxr-x---. 2 root root 6 10月 1 2020 icmptypes
drwxr-x---. 2 root root 6 10月 1 2020 ipsets
-rw-r--r--. 1 root root 272 10月 1 2020 lockdown-whitelist.xml
drwxr-x---. 2 root root 6 10月 1 2020 services
drwxr-x---. 2 root root 64 2月 16 10:43 zones
[root@wjy firewalld]#
selinux
getenforce #查看状态
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config #永久开启
sed -i 's/SELINUX=disabled/SELINUX=enforcing/g' /etc/selinux/config #永久关闭
setenforce 1 #临时开启
setenforce 0 #临时关闭