firewall 开启查看关闭端口

4 篇文章 0 订阅
1 篇文章 0 订阅

ps:firewall是centos7系统自带的防火墙 ,centos6使用的是iptables(配置文件路径:/etc/sysconfig/iptables)

查看端口

firewall-cmd --zone=public --query-port=80/tcp

 开启端口

# --permanent 表示永久有效,没有这个参数重启后会失效
firewall-cmd --zone=public --add-port=80/tcp --permanent

删除端口

# --permanent 表示永久有效,没有这个参数重启后会失效
firewall-cmd --zone=public --remove-port=80/tcp --permanent

使firewall修改后生效 

firewall-cmd --reload

firewall在centos7中的配置文件(/etc/firewalld/zones/public.xml)

vi /etc/firewalld/zones/public.xml

firewalld服务

# 查看防火墙服务状态
systemctl status firewalld

# 启用防火墙服务
systemctl start firewalld

# 关闭防火墙服务
systemctl stop firewalld

# 重启防火墙服务
systemctl restart firewalld

# 开机启动防火墙服务
systemctl enable firewalld

# 关闭开机启动防火墙服务
systemctl disable firewalld

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值