3.4. 在防火墙中打开所需端口
要允许其他机器通过网络连接到目录服务器,请在本地防火墙中打开所需的端口。
如果在实例创建过程中没有指定端口,实例将端口 389 用于 LDAP,和端口 636 用于 LDAPS 协议。
先决条件
- 在实例创建过程中设置的 LDAP 和 LDAPS 协议的端口号。
流程
确保
firewalld服务正在运行。查看
firewalld当前是否正在运行:systemctl status firewalld
# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2018-06-15 14:06:33 CEST; 1h 17min ago ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow 要启动
firewalld并将服务配置为在系统引导时自动启动:systemctl start firewalld systemctl enable firewalld
# systemctl start firewalld # systemctl enable firewalldCopy to Clipboard Copied! Toggle word wrap Toggle overflow
使用
firewall-cmd工具打开所需的端口。例如,要在默认防火墙区中打开 LDAP 和 LDAPS 默认端口:firewall-cmd --permanent --add-port={389/tcp,636/tcp}# firewall-cmd --permanent --add-port={389/tcp,636/tcp}Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重新载入防火墙配置,以确保立即进行更改:
firewall-cmd --reload
# firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
其他资源
-
有关使用
firewall-cmd在系统上打开端口的详情,请查看 Red Hat Enterprise Linux 安全指南 或firewall-cmd(1)man page。