当前位置: 首页> 房产> 政策 > linux服务器防火墙添加访问白名单

linux服务器防火墙添加访问白名单

时间:2025/9/6 0:33:51来源:https://blog.csdn.net/qwe1047978302/article/details/140614029 浏览次数:0次

linux防火墙增加白名单:
修改/etc/firewalld/ipsets下对应文件,默认为:ipset.xml

<ipset type="hash:net"><entry>xx.xxx.xx.0/24</entry><entry>xx.xxx.xx.x</entry>
</ipset>

按照规则添加IP或者IP/端口即可,参考第二行
如果想添加整个网段参考第一行,0/24 0/16 0/8代表不同的意思,自行了解网络相关。

如果路径下有多个文件,进入/etc/firewalld/zones下,查看public.xml,判断需要修改的配置文件。

<?xml version="1.0" encoding="utf-8"?>
<zone><short>Public</short><description>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.</description># 代表文件名 ipset=ipset.xml<source ipset="ipset"/># ipset_ssh.xml<source ipset="ipset_ssh"/># 使用文件的规则<rule family="ipv4"># 规则对应的配置文件<source ipset="ipset_ssh"/># 规则对应的服务<service name="ssh"/><accept/></rule><rule family="ipv4"># 规则对应的配置文件<source ipset="ipset"/># 规则对应的端口<port port="3306" protocol="tcp"/><accept/></rule><rule family="ipv4"># 规则对应的配置文件<source ipset="ipset"/># 规则对应的端口<port port="10050" protocol="tcp"/><accept/></rule>
</zone>
关键字:linux服务器防火墙添加访问白名单

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: