我浏览了以前的帖子,并没有找到我的问题的答案。希望你不介意帮忙!
问题:尝试在端口 8080 上从一台主机远程登录到另一台主机时,我收到“telnet:连接到地址 HostB:连接被拒绝”。另一方面,我可以远程登录到其他几个端口。
[root@HostA bin]# telnet HostB 8080
Trying HostB-IP...
telnet: connect to address HostB-IP: Connection refused
[root@HostB ~]# lsof -i :8080
[root@HostB ~]#
[root@HostB ~]# netstat -l | grep :8080
[root@HostB ~]#
iptables 似乎没有启用或启动
[root@hostB ~]# systemctl status iptables
iptables.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
[root@hostB ~]# systemctl start iptables
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.
[root@hostB ~]# systemctl stop iptables
Failed to issue method call: Unit iptables.service not loaded.
[root@HostB ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
我读到的在 CentOS 7(我正在使用)中被 firewalld 取代。
[root@hostB ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead)
Mar 12 17:18:53 hostB systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 12 17:18:54 hostB systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 12 17:22:45 hostB systemd[1]: Stopping firewalld - dynamic firewall daemon...
Mar 12 17:22:46 hostB systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
所以看起来 iptables 和 firewalld 都没有运行,但是,只打开了一些端口。我还尝试添加 iptable 规则以接受端口 8080。
[root@HostB ~]# netstat -l | grep :
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8089 0.0.0.0:* LISTEN
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8191 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:irdmi 0.0.0.0:* LISTEN
tcp 0 0 localhost:8065 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
udp 0 0 0.0.0.0:24077 0.0.0.0:*
udp 0 0 0.0.0.0:40462 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:ntp 0.0.0.0:*
udp 0 0 localhost:323 0.0.0.0:*
udp 0 0 0.0.0.0:mdns 0.0.0.0:*
udp6 0 0 [::]:ntp [::]:*
udp6 0 0 localhost:323 [::]:*
udp6 0 0 [::]:58833 [::]:*
raw6 0 0 [::]:ipv6-icmp [::]:*
问题- 我如何确定除了 iptables 和 firewalld 之外还有什么允许这些端口和服务,因为它们似乎被禁用了?谢谢!!