当前位置:网站首页 / Linux / 正文

linux关闭防火墙

时间:2016年08月11日 | 作者 : liuhui | 分类 : Linux | 浏览: 7165次 | 评论 0

阿里云限量代金券 | 此广告位出租25元/月

CentOS6

首先查看防火墙状态:

service iptables status

永久性生效,重启后不会复原

开启:

chkconfig iptables on

关闭:

chkconfig iptables off

即时生效,重启后复原

开启:

service iptables start

关闭:

service iptables stop

设置后重启:

reboot


CentOS7

临时关闭防火墙

systemctl stop firewalld

永久关闭防火墙的开机自启动

systemctl disable firewalld

临时打开防火墙

systemctl start firewalld

防火墙开机启动

systemctl enable firewalld

查看防火墙状态

systemctl status firewalld


CentOS7开启和关闭端口

开启2333端口

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

更新防火墙规则使刚刚添加的2333端口生效

firewall-cmd --reload

查看开放的端口列表

firewall-cmd --list-ports

关闭2333端口

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

更新防火墙规则使用刚刚删除的端口关闭

firewall-cmd --reload

推荐您阅读更多有关于“”的文章

猜你喜欢

网站分类
关注电脑博士
友情链接

分享:

支付宝

微信