How to use the talnet command in windows and linux


foreword

什么是telnet?,如何用?

Telnet can be used for remote control, but it is not very safe. Now ssh is used more, and it is more used to determine the status of remote services in work, such as determining whether a certain port of the remote server can be accessed.


提示:以下是本篇文章正文内容,下面案例可供参考

1. Use on Windows?

1.1 To use on windows, you need to enable the telnet service and client in advance

insert image description here

1.2. Use

Enter cmd during operation:
click OK to open the command prompt,

C:\Users\hp>telnet 10.0.0.9 3306

Two, use under linux

## 2.1. If telnet is unavailable, you need to enable the telnet service.
Start the service:

systemctl start  xinetd

Command format:

telnet   [参数]   [主机]

参数:
-8 允许使用8位字符资料,包括输入与输出。

-a 尝试自动登入远端系统。

-b<主机别名> 使用别名指定远端主机名称。

-c 不读取用户专属目录里的.telnetrc文件。

-d 启动排错模式。

-e<脱离字符> 设置脱离字符。

-E 滤除脱离字符。

-f 此参数的效果和指定"-F"参数相同。

-F 使用Kerberos V5认证时,加上此参数可把本地主机的认证数据上传到远端主机。

-k<域名> 使用Kerberos认证时,加上此参数让远端主机采用指定的领域名,而非该主机的域名。

-K 不自动登入远端主机。

-l<用户名称> 指定要登入远端主机的用户名称。

-L 允许输出8位字符资料。

-n<记录文件> 指定文件记录相关信息。

-r 使用类似rlogin指令的用户界面。

-S<服务类型> 设置telnet连线所需的IP TOS信息。

-x 假设主机有支持数据加密的功能,就使用它。

-X<认证形态> 关闭指定的认证形态。

2.2, usage analysis

Example 1: The remote server is unreachable

命令:
telnet  192.168.120.206
输出:
[root@localhost ~]# telnet 192.168.120.209
Trying 192.168.120.209...
telnet: connect to address 192.168.120.209: No route to host
telnet: Unable to connect to remote host: No route to host
[root@localhost ~]# 

Description:
How to deal with this situation:
(1) Confirm whether the ip address is correct?
(2) Check if the host corresponding to the ip address is powered on?
(3) If the host has been started, confirm whether the routing settings are correct? (Use the route command to view)
(4) If the host has been started, check whether the telnet service is enabled on the host? (Use the netstat command to check whether there is a line in the LISTEN state on TCP port 23)
(5) If the host has started the telnet service, confirm whether the firewall has released the access to port 23? (use iptables-save to view

Example 2: The domain name cannot be resolved.

命令:
telnet www.baidu.com
输出:
[root@localhost ~]# telnet www.baidu.com
www.baidu.com/telnet: Temporary failure in name resolution
[root@localhost ~]# 

illustrate:

Ways to deal with this situation:
(1) Confirm whether the domain name is correct
(2) Confirm whether the settings related to domain name resolution of the machine are correct (whether the nameserver setting in /etc/resolv.conf is correct, if not, you can use nameserver 8.8.8.8 )
(3) Confirm whether the firewall has released access to UDP port 53 (DNS uses UDP protocol, port 53, use iptables-save to view)

Example 3: ip cannot be accessed

命令:
telnet 192.168.120.206
输出:
[root@localhost ~]# 
Trying 192.168.120.206...
telnet: connect to address 192.168.120.206: Connection refused
telnet: Unable to connect to remote host: Connection refused
[root@localhost ~]#

Description:
To deal with this situation:
(1) Confirm whether the ip address or host name is correct?
(2) Confirm whether the port is correct, whether it is the default port 23

Guess you like

Origin blog.csdn.net/wei1359765074410/article/details/127785213