centos7防火墙关闭telnet端口不通

[root@zabbix-agen2 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

确定防火墙已关闭

[root@zabbix-agen2 ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


[root@zabbix-agen2 ~]# setenforce 0
setenforce: SELinux is disabled

确定selinux已关闭

[root@zabbix-agen2 ~]# ss -ntulp
Netid  State      Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port
udp    UNCONN     0      0                                  127.0.0.1:323                                                    *:*                   users:(("chronyd",pid=657,fd=5))
udp    UNCONN     0      0                                          *:68                                                     *:*                   users:(("dhclient",pid=710,fd=6))
udp    UNCONN     0      0                                      [::1]:323                                                 [::]:*                   users:(("chronyd",pid=657,fd=6))
tcp    LISTEN     0      128                                        *:22                                                     *:*                   users:(("sshd",pid=909,fd=3))
tcp    LISTEN     0      100                                127.0.0.1:25                                                     *:*                   users:(("master",pid=1003,fd=13))
tcp    LISTEN     0      128                                        *:10050                                                  *:*                   users:(("zabbix_agentd",pid=1576,fd=4),("zabbix_agentd",pid=1575,fd=4),("zabbix_agentd",pid=1574,fd=4),("zabbix_agentd",pid=1573,fd=4),("zabbix_agentd",pid=1572,fd=4),("zabbix_agentd",pid=1571,fd=4))
tcp    LISTEN     0      128                                     [::]:22                                                  [::]:*                   users:(("sshd",pid=909,fd=4))
tcp    LISTEN     0      100                                    [::1]:25                                                  [::]:*                   users:(("master",pid=1003,fd=14))
tcp    LISTEN     0      128                                     [::]:10050                                               [::]:*                   users:(("zabbix_agentd",pid=1576,fd=5),("zabbix_agentd",pid=1575,fd=5),("zabbix_agentd",pid=1574,fd=5),("zabbix_agentd",pid=1573,fd=5),("zabbix_agentd",pid=1572,fd=5),("zabbix_agentd",pid=1571,fd=5))

确定服务端口已开启

[root@zabbix-master ~]# telnet 192.168.8.135 10050
Trying 192.168.8.135...
Connected to 192.168.8.135.
Escape character is '^]'.
Connection closed by foreign host.

telnet还是被拒绝

百度了一堆 都说尝试开启防火墙放行10050端口

[root@zabbix-agen2 ~]# systemctl start firewalld
[root@zabbix-agen2 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since 二 2022-07-19 16:59:22 CST; 6s ago
     Docs: man:firewalld(1)
 Main PID: 1658 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─1658 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

7月 19 16:59:21 zabbix-agen2 systemd[1]: Starting firewalld - dynamic firewall daemon...
7月 19 16:59:22 zabbix-agen2 systemd[1]: Started firewalld - dynamic firewall daemon.
7月 19 16:59:22 zabbix-agen2 firewalld[1658]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration optio...it now.
Hint: Some lines were ellipsized, use -l to show in full.
[root@zabbix-agen2 ~]# firewall-cmd --zone=public --add-port=10050/tcp --permanent
Warning: ALREADY_ENABLED: 10050:tcp
success

再次尝试telnet10050端口

[root@zabbix-master ~]# telnet 192.168.8.135 10050
Trying 192.168.8.135...
Connected to 192.168.8.135.
Escape character is '^]'.
Connection closed by foreign host.

还是被拒绝  人麻掉了。。。。。。。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
您好!如果您在关闭 CentOS 7 的防火墙后仍然无法通过 telnet 连接到某个端口,可能有几个原因导致 telnet 不可用。以下是一些可能的解决方法: 1. 确保端口已经正确打开:您可以使用 `netstat` 命令来检查端口是否处于监听状态。例如,`netstat -tuln | grep <端口号>` 可以检查指定端口是否处于监听状态。如果没有任何输出,说明该端口没有打开。 2. 检查服务是否正在运行:如果您尝试连接的端口与某个服务相关联,确保该服务正在运行。您可以使用 `systemctl status <服务名称>` 命令来检查服务的状态,并确保它正在运行。 3. 检查 SELinux 配置:如果 SELinux 是启用状态,它可能会阻止某些端口访问。您可以使用 `sestatus` 命令来检查 SELinux 的状态。如果 SELinux 是启用的,并且您确定它是导致问题的原因,可以通过修改 SELinux 配置文件或使用 `setenforce` 命令将其设置为宽松模式来解决问题。 4. 检查防火墙规则:虽然您已经关闭防火墙,但仍然可以检查防火墙规则,确保没有其他规则阻止了该端口访问。您可以使用 `iptables -L` 命令来查看当前的防火墙规则。 请注意,这些是一些常见的解决方法,具体情况可能因系统配置和网络环境而异。如果以上方法无法解决问题,建议您进一步检查网络连接、日志文件等,以便找出导致 telnet 不可用的具体原因。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值