firewalld、selinux

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 101 2020 firewalld.conf
drwxr-x---. 2 root root    6 101 2020 helpers
drwxr-x---. 2 root root    6 101 2020 icmptypes
drwxr-x---. 2 root root    6 101 2020 ipsets
-rw-r--r--. 1 root root  272 101 2020 lockdown-whitelist.xml
drwxr-x---. 2 root root    6 101 2020 services
drwxr-x---. 2 root root   64 216 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 #临时关闭
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值