本博客旨在自我学习使用,如有任何疑问请及时联系博主

今天遇到个稀奇古怪的问题:

调试emqx的时候一直econnrefused,检查服务时,突然发现在ubuntu上telnet localhost竟然不通???

则往下进行排查,首先查看端口状态

netstat -tnl

发现虽然可以执行telnet,但并没有telnet服务占用端口,即并没有启动telnet服务

解决方案

  1. 安装xinetd和telnetd

    sudo apt-get install xinetd telnetd

  2. 创建inetd.conf文件

    sudo vi /etc/inetd.conf

  3. 在inetd.conf文件中添加

    telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd

  4. 完善xinetd.conf文件

    sudo vi /etc/xinetd.conf

  5. 在defaults配置里面添加

instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
![](https://tva1.sinaimg.cn/large/e6c9d24ely1gzfmvukethj20ts0gu76c.jpg)
  1. 创建telnet文件

    sudo vi /etc/xinetd.d/telnet

  2. 在文件中输入

# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
![](https://tva1.sinaimg.cn/large/e6c9d24ely1gzfmycpmnyj20qg0cg403.jpg)
  1. 重启Ubuntu系统

    shutdown -r now

  2. 重新查看端口状态

    netstat -tnl

    可以发现多了一个23端口占用,即为telnet服务正在监听23端口

  3. 重新测试telnet localhost



    原帖:wolai

Ubuntu20.04.3中telnet 127.0.0.1时Unable to connect to remote host: Connection refused的更多相关文章

  1. telnet报“Unable to connect to remote host:Connection refused”错误

    Linux下面telnet ip 端口号 报错误"Unable to connect to remote host:Connection refused"的时候,大部分是目标机的端 ...

  2. telnet: Unable to connect to remote host: Connection refused

    问题描述: telnet: Unable to connect to remote host: Connection refused 已解决,需要安装telent 服务,请查看下方的链接文章: htt ...

  3. [Linux] Telnet提示:Unable to connect to remote host: No route to host

    出错现象: [root@localhost ~]# telnet 192.168.1.128 Trying 192.168.1.128...telnet: connect to address 192 ...

  4. telnet: Unable to connect to remote host: No route to host

    用iptables -F这个命令来关闭防火墙,但是使用这个命令前,千万记得用iptables -L查看一下你的系统中所有链的默认target,iptables -F这个命令只是清除所有规则,只不会真正 ...

  5. telnet访问出现telnet:Unable to connect to remote host: No route to host

    Linux下的防火墙默认是不允许telnet服务通过的,所以,当防火墙不允许telnet服务通过时就会出现上面的这种情况,可以将防火墙关闭或者勾选允许telnet服务即可解决如上的问题.

  6. 解决loadrunner录制时 Request Connection: Remote Server @ 0.0.0.0:80 (Service=?) NOT PROXIED! (REASON: Unable to connect to remote server: rc = -1 , le = 0)问题

    环境为win7+ie8+loadrunner11,录制脚本回放查看Recoding log 出现如下错误:[Net An. Error    ( 7f8:1340)] Request Connecti ...

  7. 【err】VIDEOIO ERROR: V4L: index 0 is not correct!Unable to connect to camera

    前言 新到手一块板子,程序编译成功之后,运行出现错误,不能连接到摄像头. 问题 VIDEOIO ERROR: V4L: index is not correct! Unable to connect ...

  8. Loadrunner中遇到Failed to connect to server[10061] connection refused错误

    (1)run-time setting/browser emulation中,将simulate a new user on each iteration  选项去掉(默认是选中的). 重新运行一切正 ...

  9. Linux 出现telnet: 127.0.0.1: Connection refused错误解决办法

    Linux 出现telnet: connect to address 127.0.0.1: Connection refused错误解决办法 没有xinetd服务: 1./etc/init.d目录中放 ...

随机推荐

  1. Linux根目录缺少x权限,产生的两个错误

    错误一:root用户执行systemctl命令报误 [root@node1 ~]# systemctl restart sshd * (pkttyagent:10364): WARNING *: Un ...

  2. JQuery iframe 刷新效果

    假如有一个选项卡.tab-content,里面有多个iframe 只刷新显示的那个iframe,所以要用到:visible $('.tab-content iframe:visible')[0].co ...

  3. 金融云原生漫谈(三)|银行云原生基础设施构建:裸金属VS虚拟机

    在金融行业数字化转型的驱动下,国有银行.股份制银行和各级商业银行也纷纷步入容器化的进程.   如果以容器云上生产为目标,那么整个容器云平台的设计.建设和优化对于银行来说是一个巨大的挑战.如何更好地利用 ...

  4. HDU 1106 (1.3.5) 排序 (C语言描述)

    排序 Problem Description 输入一行数字,如果我们把这行数字中的'5'都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以'0'开头,这些头部的'0'应该被忽略掉,除非 ...

  5. Java中生成一个唯一值的方式

    现总结几种生成一个唯一值的方式 第一种:采用nanoTime() // 理论上存在重复的可能,可以在后面再加上一个随机字符串 Random r = new Random(); for (int i = ...

  6. C 库函数 - pow()

    1.C 标准库 - <math.h> 2.C 库函数 double pow(double x, double y) 返回 x 的 y 次幂,即 xy. 3.pow() 函数的声明. dou ...

  7. 《剑指offer》面试题20. 表示数值的字符串

    问题描述 请实现一个函数用来判断字符串是否表示数值(包括整数和小数).例如,字符串"+100"."5e2"."-123"."3.1 ...

  8. linux下编译支持opencl的opencv for android

    主要的步骤其他人已经写过,请参考这篇:https://www.cnblogs.com/hrlnw/p/4720977.html 操作的细节请参考附件的pdf:  https://files.cnblo ...

  9. 【小记录】cv::cuda::Stream中取出cudaStream_t并用于核函数的计算

    以下是找到的代码 1 cv::cuda::Stream stream; 2 cudaStream_t s = cv::cuda::StreamAccessor::getStream(stream); ...

  10. 搭建服务器之www-安装配置

    www服务器,使用软件Apache,服务守护进程为httpd,以下为安装配置过程: 1.首先yum install httpd,会下载安装Apache软件,可以用apachectrl -v查看版本,发 ...