我查看了以前的帖子,但没有找到问题的答案。希望你不介意帮忙!
问题:当尝试在端口8080上从一个主机远程登录到另一个主机时,我收到“telnet:连接到地址HostB:连接被拒绝”。另一方面,我可以telnet到其他几个端口。
[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之外,我如何确定允许这些端口和服务的内容,因为它们似乎已被禁用?谢谢!