linux 7 services设定,centos7 firewalld.service 设定

官方文档地址:

cd /usr/lib/firewalld/services 目录中存放定义好的网络服务和端口参数,系统参数,不能修改。

cd /etc/firewalld/services/

systemctl status firewall        查看firewall服务状态

firewall-cmd –state            查看firewall的状态

firewall-cmd –list-all        查看防火墙规则

方法1、修改配置文件/etc/firewalld/zones/public.xml

[root@nginx01 zones]# cat public.xml

Public

For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

                放通指定ip,指定端口、协议

                放通任意ip访问服务器的9527端口

添加需要的规则,放通源ip为192.249.87.114,端口80,协议tcp

需要对之前防火墙做好备份

再重启firewalld.service服务

service firewalld restart

方法2、

firwall-cmd –permanent –add-port=9527/tcp    插入防火墙规则,放通9527端口。

在/etc/firewall/zones/public.xml中自动生成该规则。

firewall-cmd –permanent –query-port=9527/tcp    查询刚插入的规则是否生效

扩展文档:

1.CentOS7下Firewall防火墙配置用法详解

2.在CentOS7.0 中默认的防火墙 “firewall” 使用方法

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值