Skip to content

Commit 032ac92

Browse files
committed
2017-05-05 补充 CentOS 7 防火墙
1 parent 70e402c commit 032ac92

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

CentOS6-and-CentOS7.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@
3434
- `systemctl is-enabled httpd` #查看httpd服务是否开机启动
3535
- 对于启动脚本的存放位置,也不再是 `/etc/init.d/`(这个目录也是存在的),而是 `/usr/lib/systemd/system/`
3636

37+
### 开放端口
38+
39+
- 添加端口:`firewall-cmd --zone=public --add-port=8883/tcp --permanent`
40+
- 重启防火墙:`firewall-cmd --reload`
41+
- 命令解释:
42+
- `--zone` #作用域
43+
- `--add-port=80/tcp` #添加端口,格式为:端口/通讯协议
44+
- `--permanent` #永久生效,没有此参数重启后失效
45+
- 列出所有端口列表:`firewall-cmd --list-all`
46+
47+
3748
## 关闭 firewall 使用 iptables
3849

3950
- 关闭 firewall

0 commit comments

Comments
 (0)