[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.

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

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐