telnet: connect to address 127.0.0.1: Connection refused

[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会连接不上呢,希望明白的大佬能给我指点一下迷津,谢谢啦

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值