opensuse tumbleweed telnet connection refused

安装
sudo zypper install telnet
sudo zypper install telnet-server 

telnet 普通的客户端应用程序,而不是服务。


firewall-cmd 命令
	firewall-cmd --list-all
	firewall-cmd --zone=public --permanent --add-service=telnet		#Enable firewall rule for telnet	
	firewall-cmd  --permanent --remove-service=telnet				#Disable firewall rule for telnet	
	
	firewall-cmd --list-port  										# list to check if the port was opened   
	firewall-cmd --permanent --add-port 2401/tcp  					#open the port permanently
 	
 	firewall-cmd --runtime-to-permanent								#保存活动运行时配置并用它覆盖永久配置	
 	firewall-cmd --reload											#Reload firewall rules.
	systemctl stop firewalld   										# stop and open the firewall service
	systemctl start firewalld
telnet出错查看对应的信息
  1. 检查firewall是否开放了telnet服务
suse-tom:~ # sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s25
  sources: 
  services: dhcpv6-client ssh telnet			#telnet 开启了
...

如果没有telnet服务,则按上述firewalld-cmd命令进行设置,或者在yast上设置防火墙。

  1. 在另一台主机上进行连接测试,或者在本机上查看是否有对对应接口的监听
suse-tom:/etc/firewalld/services # sudo lsof -i -n -P
COMMAND    PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
avahi-dae 1066 avahi   11u  IPv4  25524      0t0  UDP *:5353 
...
sshd      2866   tom    4u  IPv4  33728      0t0  TCP 192.168.3.109:22->192.168.3.111:60507 (ESTABLISHED)
xinetd    7518  root    5u  IPv6  42946      0t0  TCP *:13 (LISTEN)
[root@ton ~]#telnet 192.168.3.109
Trying 192.168.3.109...
telnet: Unable to connect to remote host: Connection refused

远程主机Connection refused,或者本机无telnet相关端口的监听中,则需要启动telnet服务

suse-tom:/etc/firewalld/services # systemctl start telnet.socket		#启动telnet服务
suse-tom:/etc/firewalld/services # systemctl enable telnet.socket		#或者设置开机启动
suse-tom:~ # sudo lsof -i -n -P 
COMMAND    PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd      1  root   79u  IPv6  39598      0t0  TCP *:23 (LISTEN)
...
sshd      3229   tom    4u  IPv4  34798      0t0  TCP 192.168.3.109:22->192.168.3.111:59440 (ESTABLISHED)
telnet    4222  root    3u  IPv4  41316      0t0  TCP 192.168.3.109:41598->192.168.3.111:23 (SYN_SENT)
测试结果

测试连接本机13端口daytime服务

[tom@suse-tom ~]$sudo telnet 127.0.0.1 daytime
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
24 MAY 2021 21:49:49 CST
Connection closed by foreign host.

测试远程主机可以telnet连接

[root@ton ~]#telnet 192.168.3.109
Trying 192.168.3.109...
Connected to 192.168.3.109.
Escape character is '^]'.
Welcome to openSUSE Tumbleweed 20210514 - Kernel 5.12.3-1-pae (3).
suse-tom login: 
ubuntu 的telnet启用
sudo apt-get install openbsd-inetd
sudo apt-get install telnetd
sudo /etc/init.d/openbsd-inetd restart

参考https://www.thegeekdiary.com/centos-rhel-7-how-to-install-and-configure-telnet/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值