首页
导航
博客
电子书
算法
众创
代码
随贴
关于我们
您好,欢迎来到码863代码分享网! 请
[登录]
/
[注册]
搜 索
标题:
*
140
字
TAG标签:
(用空格隔开)
30
字
恢复历史版本:
请选择分类
html
python
javascript
php
sql
c
c++
c#
java
plain
所有人可见
仅自己可见
编辑器:UEditor
编辑器:TinyMCE
编辑器:Editor.md
HTML转MD
HTML转MD2
<p><a id="Header1_HeaderTitle" class="headermaintitle" href="https://www.cnblogs.com/moxiaoan/" style="color: rgb(51, 102, 153); text-decoration-line: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">莫小安</a></p><h2 style="margin-top: 10px; font-size: 13px; border-bottom: 1px solid rgb(102, 102, 102);"><a id="cb_post_title_url" href="https://www.cnblogs.com/moxiaoan/p/5683743.html" style="color: rgb(0, 0, 255); text-decoration-line: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-weight: normal;">CentOS7使用firewalld打开关闭防火墙与端口</a></h2><p>1、firewalld的基本使用</p><p>启动: systemctl start firewalld</p><p>关闭: systemctl stop firewalld</p><p>查看状态: systemctl status firewalld </p><p>开机禁用 : systemctl disable firewalld</p><p>开机启用 : systemctl enable firewalld</p><p> </p><p> </p><p>2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。</p><p style="margin: 10px auto; line-height: 1.5;">启动一个服务:systemctl start firewalld.service<br/>关闭一个服务:systemctl stop firewalld.service<br/>重启一个服务:systemctl restart firewalld.service<br/>显示一个服务的状态:systemctl status firewalld.service<br/>在开机时启用一个服务:systemctl enable firewalld.service<br/>在开机时禁用一个服务:systemctl disable firewalld.service<br/>查看服务是否开机启动:systemctl is-enabled firewalld.service<br/>查看已启动的服务列表:systemctl list-unit-files|grep enabled<br/>查看启动失败的服务列表:systemctl --failed</p><p style="margin: 10px auto; line-height: 1.5;">3.配置firewalld-cmd</p><p>查看版本: firewall-cmd --version</p><p>查看帮助: firewall-cmd --help</p><p>显示状态: firewall-cmd --state</p><p>查看所有打开的端口: firewall-cmd --zone=public --list-ports</p><p>更新防火墙规则: firewall-cmd --reload</p><p>查看区域信息: firewall-cmd --get-active-zones</p><p>查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0</p><p>拒绝所有包:firewall-cmd --panic-on</p><p>取消拒绝状态: firewall-cmd --panic-off</p><p>查看是否拒绝: firewall-cmd --query-panic</p><p> </p><p>那怎么开启一个端口呢</p><p>添加</p><p>firewall-cmd <span class="attribute">--zone=<span class="attribute-value">public <span class="attribute">--add-port=<span class="attribute-value">80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)</span></span></span></span></p><p>重新载入</p><p><span class="attribute">firewall-cmd --reload</span></p><p>查看</p><p><span class="attribute"><span class="attribute-value"><span class="attribute"><span class="attribute-value">firewall-cmd <span class="attribute">--zone= <span class="attribute-value">public <span class="attribute">--query-port=<span class="attribute-value">80/tcp</span></span></span></span></span></span></span></span></p><p>删除</p><p>firewall-cmd <span class="attribute">--zone= <span class="attribute-value">public <span class="attribute">--remove-port=<span class="attribute-value">80/tcp --permanent</span></span></span></span></p><p><br/></p>
CopyRight 2002~2023 精通2100网 联系邮箱:qqtxt@163.com
版权所有:精通2100网
湘ICP备2023018646号-1
MYSQl共执行 4 个查询,用时 0.0020809173583984 秒,PHP脚本用时 0.004494 秒,占用内存 0.515 MB,Gzip 已启用