岁安长安 發表於 2020-5-13 15:11:24

linux怎么查看防火墙是否开启并清除防火墙规则?

<p>iptables是linux下的防火墙组件服务,相对于windows防火墙而言拥有更加强大的功能,下面我们就来看看linux系统中关于iptables的一般常见操作,判断linux系统是否启用了iptables服务,并清除防火墙规则的教程。</p>
<p><strong>一、检查iptables是否安装</strong></p>
<p>1、Linux下的防火墙iptables一般是系统集成的组件,检查是否安装可以</p>
<p><strong>通过 <span style="color: #ff0000">rpm -qa</span>进行查询</strong></p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833100.png" /></p>
<p>2、如果没有安装改组件,可以通过<span style="color: #ff0000"><strong>yum install iptables</strong></span><strong>进行安装(必须联网)</strong></p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833101.png" /></p>
<p><strong>二、检查linux防火墙是否开启</strong></p>
<p>1、查询到iptables已经安装的话,对于iptables服务是否运行</p>
<p>可以通过<span style="color: #ff0000"><strong>service iptables status </strong></span>如图(如果有其他组件如fail2ban也会调用防火墙规则) 后面就是规则链</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833102.png" /></p>
<p>2、<strong>列出iptables规则</strong></p>
<p>如果要查看具体的iptables规则,也可以通过输入<span style="color: #ff0000"><strong>iptables -L</strong></span><strong> </strong>列出规则</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833103.png" /></p>
<p>3、<strong>通过服务来判断</strong></p>
<p>除了上面介绍的方法,还可以通过停止 iptables服务来判断(如图显示为确定xxx表示当前已经启用了iptables)</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833104.png" /></p>
<p>4、如果提示没有任何信息,表示当前系统没有启用iptables服务(进程)</p>
<p><strong>三、关闭iptables防火墙/删除规则</strong></p>
<p>1、<strong>Iptables开机自动启动</strong></p>
<p>如果要关闭iptables服务,还需要检查一下chkconfig列表里面是否有iptables的服务。</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833105.png" /></p>
<p>2、关闭步骤: <strong>先停止chkconfig iptables off 开机项目,</strong>然后移除,最后再查一次</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833106.png" /></p>
<p>3、<strong>清除iptables规则</strong></p>
<p>如果只需要删除iptables防火墙规则,可以通过<strong>iptables-F </strong>清除列表规则(iptables -L 列出当前的iptables规则)</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833107.png" /></p>
<p>4、删除某条iptables规则,选择输入<span style="color: #ff0000"><strong>iptables -d xxxx </strong></span>,启动iptables服务操作方法如图</p>
<p align="center"><img alt="" src="https://img.jbzj.com/file_images/article/202005/20200513145833108.png" /></p>
<p><span style="color: #ff0000"><strong>注意事项:</strong></span></p>
<p>注意iptables服务,此外还有一个ip6tables 用于ipv6下的防火墙</p>
<p>以上就是linux查看防火墙是否开启,删除iptables规则的教程,希望大家喜欢,请继续关注琼殿技术社区。</p>
<p><strong>相关推荐: </strong></p>
<p><a target="_blank" href="https://www.jb51.net/LINUXjishu/705697.html">Linux系统怎么更改默认网关?</a></p>
<p><a target="_blank" href="https://www.jb51.net/LINUXjishu/713362.html">linux怎么快速创建创建一次性的计划任务?</a></p>
<p><a target="_blank" href="https://www.jb51.net/LINUXjishu/349976.html">linux如何查看防火墙?Linux手动关闭防火墙的教程</a></p>
頁: [1]
查看完整版本: linux怎么查看防火墙是否开启并清除防火墙规则?