[yjc@localhost ~]$ telnet localhost 8080
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
没有启用8080端口,使用 nc -lp 8080 & 命令开启8080的tcp侦听,
在端口启用列表里面能找到了,再telnet就通了,说明8080端口正常可用。
参考文章:https://q.cnblogs.com/q/106337/
另外,本机ip地址为192.168.0.138,使用Telnet连接时用localhost连接不上,输入IP地址就连接上了,真是太迷了,研究了近五个小时,本人的/etc/hosts文件中的内容为:
[yjc@localhost etc]$ cat hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.138 hadoopIMOOC
192.168.0.139 hadoop000
192.168.0.140 hadoop001
192.168.0.141 hadoop002
[yjc@localhost ~]$ telnet localhost 44433
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
[yjc@localhost ~]$ telnet 192.168.0.138 44433
Trying 192.168.0.138...
Connected to 192.168.0.138.
Escape character is '^]'.
12 w
OK
使用localhost时连接的是127.0.0.1,使用ip地址时连接的是192.168.0.138,但是这不应该是同一台机器吗,为啥localhost会连接不上呢,希望明白的大佬能给我指点一下迷津,谢谢啦