Connect to Telnet&STelnet
How Can I Connect to Telnet
Telnet is the standard protocol and main mode for the Internet remote login service. By default, port 23 is used. There are two types of Telnet login roles: client and server. You can run the Telnet client on the local host and remotely log in to the Telnet server to configure and manage the remote server. This method allows you to maintain multiple servers using a single user terminal, greatly facilitating operations.
When using Telnet to log in to the server, you must know the IP address and port number of the remote Telnet server (the default telnet port number is 23, which can be changed as required), user name, and password.
How Can I Use Telnet Commands
This section uses Huawei NE40E as an example to describe how to configure the Telnet server, change the Telnet port number, and log in to another device using Telnet.
- Telnet server configurationThe Telnet server must be configured with the user name, password, and service mode (Telnet), and the Telnet service needs to be enabled.
- Configure the user name and password for login.
local-user user-name password [ cipher password | irreversible-cipher irreversible-cipher-password ]
- Set the service mode for login users to Telnet.
local-user user-name service-type telnet
- Enable the Telnet service.
telnet [ ipv6 ] server enable
For details, see Configuring a User to Log In Through Telnet in Huawei NE40E Product Documentation.
- Configure the user name and password for login.
- Telnet port
By default, port 23 is used to set up a connection. If this port is occupied, the connection fails to be set up. In this case, you can change the port number of the TCP connection on the Telnet server and run the following command to change the Telnet port number:
telnet [ ipv6 ] server port port-number
If the Telnet port number has been changed on the Telnet server, you must use the same port number to log in to the server through a client.
- Use Telnet to log in to the server
When a Huawei device functions as a Telnet client, you can run the following commands to log in to the Telnet server:
- For an IPv4 server, run the following command:
telnet { -i interface-type interface-number | [ vpn-instance vpn-instance-name ] [ -a source-ip-address ] host-ip-address [ port-number ] }
- For an IPv6 server, run the following command:
telnet ipv6 [ vpn-instancevpn-instance-name ] ipv6-address [ -oi interface-type interface-number ] [ port-number ]
The following table describes the parameters in this command.
Table 1-1 Parameters in Telnet commandsParameter
Description
-i interface-type interface-number
Specifies the source interface type and number on the local device.
vpn-instance vpn-instance-name
Specifies the name of a VPN instance to which the device belongs.
-a source-ip-address
Specifies the IP address of the local device. Users can use the specified IP address to communicate with the Telnet server to ensure security.
If no source address is specified, the system will use the IP address of the outbound interface on the local device to initiate a Telnet connection.
host-ip-address
Specifies the IP address of the remote device.
port-number
Specifies the TCP port number used by the remote device that functions as the Telnet server.
The value is an integer that ranges from 1 to 65535, and the default value is 23. If the Telnet port number has been changed on the Telnet server, you must use the same port number to log in to the server through a client.
ipv6 ipv6-address
Specifies the IPv6 address of the remote device when the remote Telnet server is of the IPv6 type.
-oi interface-type interface-number
Specifies the source IPv6 interface type and number on the local device.
For details, see Configuring a User to Log In Through Telnet in Huawei NE40E Product Documentation.
- For an IPv4 server, run the following command:
What Is an Example of Telnet
- The user host functions as the Telnet client and logs in to the Telnet server.
The user remotely logs in to the server through the terminal emulation program or the Telnet client program on the PC, as shown in Figure 1-1.
# Configure the Telnet server.
<HUAWEI> system-view [~HUAWEI] sysname Telnet Server [*HUAWEI] commit [~Telnet Server] user-interface vty 0 4 [*Telnet Server-ui-vty0-4] authentication-mode aaa [*Telnet Server-ui-vty0-4] user privilege level 3 [*Telnet Server-ui-vty0-4] commit [~Telnet Server-ui-vty0-4] quit [~Telnet Server] aaa [~Telnet Server-aaa] local-user huawei password cipher Huawei@123 [*Telnet Server-aaa] local-user huawei service-type telnet [*Telnet Server-aaa] local-user huawei user-group manage-ug [*Telnet Server-aaa] commit [~Telnet Server-aaa] quit [~Telnet Server] telnet server enable [*Telnet Server] commit
# Configure the Telnet client.
- Access the Windows command line window.
- Run the telnet ip-address command to use Telnet to log in to the device.
- Enter the IP address of the Telnet server. As shown in Figure 1-2.
- Press Enter. Then enter the user name and password. The command line prompt of the user view, such as <HUAWEI>, is displayed, indicating that the user has logged in to the Telnet server. As shown in Figure 1-3.
- Using Telnet redirection to log in to the Telnet server
Huawei NE40E and NE20E-S can use Telnet redirection to log in to the Telnet server. On the network shown in Figure 1-4, there is a reachable route between the PC and Device A but no IP network connection between the PC and Device B. To remotely manage Device B, connect Device A's AUX port to Device B's console port, enable Telnet redirection on Device A, and use a specified port on the PC to remotely log in to and manage Device B.
For details, see Configuring Device Login Through Telnet Redirection in Huawei NE40E Product Documentation.
Security Risks
Although Telnet is easy to use and convenient, data is transmitted in plain text. Telnet transmits all user contents, including user names and passwords, in plain text on the Internet, which has security risks. Therefore, the Telnet service is disabled on many servers. STelnet is recommended for networks that have high security requirements.
The STelnet protocol uses port 22 by default. For details, see How Can I Connect to STelnet.
Troubleshooting
- If the TCP port number used by the server to provide the Telnet service is not 23, the Telnet operation fails and the client needs to change the port number.
How do I use Telnet to test a port?
To check the Telnet port, run the telnet ip address port command.
For example, run the telnet 127.0.0.1 23 and telnet 127.0.0.1 80 command. The result shows that port 23 is unavailable and port 80 is available. See Figure 1-5.
2. Telnet is a plaintext transmission protocol. For security concerns, many firewalls disable Telnet. If remote login is required, you can configure firewalls to allow Telnet login.
Related Documents
For details about the Telnet application of Huawei switches, see Example for Logging In to the Device Through Telnet in Switches Product Documentation.
How Can I Connect to STelnet
STelnet is a secure Telnet service. Based on the SSH protocol, STelnet uses port 22 to establish a connection by default. SSH provides encryption and authentication functions to protect devices against attacks, such as IP address spoofing and simple password interception.
Similar to Telnet, STelnet has two roles: STelnet client and STelnet server. For convenience, Huawei NE40E and other devices can be either STelnet servers or clients to access other STelnet servers. The following uses Huawei NE40E as an STelnet server as an example to describe how to log in to a device using STelnet. See Figure 1-6
Configuration Roadmap
- STelnet server configuration
- Configure a VTY user interface and create a local user.
- Create an SSH user and configure the authentication mode for the user.
- Enable the STelnet server function.
- PC configuration
The PC functions as the STelnet client and needs to be configured with the STelnet client software. The following uses PuTTY as an example (assume that the putty.exe software has been installed on the client).
An Example of STelnet
# Configure the STelnet server.
<HUAWEI> system-view [~HUAWEI] sysname SSH Server [*HUAWEI] commit [~SSH Server] user-interface vty 0 4 [*SSH Server-ui-vty0-4] authentication-mode aaa [*SSH Server-ui-vty0-4] protocol inbound ssh [*SSH Server-ui-vty0-4] user privilege level 3 [*SSH Server-ui-vty0-4] commit [~SSH Server-ui-vty0-4] quit [~SSH Server] aaa [~SSH Server-aaa] local-user huawei123 password cipher Huawei@123 [*SSH Server-aaa] local-user huawei123 service-type ssh [*SSH Server-aaa] local-user huawei123 user-group manage-ug [*SSH Server-aaa] commit [~SSH Server-aaa] quit [~SSH Server] ssh user huawei123 [*SSH Server] ssh user huawei123 authentication-type password [*SSH Server] commit [~SSH Server] stelnet server enable [*SSH Server] ssh user huawei123 service-type stelnet [*SSH Server] commit
# Configure the STelnet client.
Start the PuTTY and enter the IP address of the STelnet server, as shown in Figure 1-7 .
Click Open. If the connection is normal, the system prompts you to enter the user name and password, as shown in Figure 1-8.
This section uses password authentication as an example. To learn how to use key authentication, see Configuring STelnet Login in Huawei NE40E Product Documentation.
Related Ducuments
For details about the Telnet application of Huawei switches, see Example for Logging In to the Device Through Telnet in Switches Product Documentation.