Telnet – Test TCP Port Connectivity

What is Telnet?

Definition: Telnet is an application-layer protocol and command-line tool used to provide interactive text communication over a TCP/IP network.
Purpose: Historically, Telnet was used for remote device management. Today, its main use is testing TCP port connectivity, since it transmits data in plain text and is not secure.

Role in Remote Management and Connectivity Testing

  • Allows remote access and management of network devices (switches, routers, servers) using TCP port 23 by default.
  • Modern use: Testing if a TCP port is open/reachable, and troubleshooting network/firewall issues.
  • Security Note: Telnet is not recommended for remote management (use SSH instead).

Basic Telnet Usage

Syntaxtelnet [hostname or IP address] [port]
If [port] is omitted, defaults to 23 (Telnet).
Examples:
  • Connect to web server on port 80: telnet www.example.com 80
  • Test SMTP server on port 25: telnet mail.example.com 25
  • Check SSH on port 22: telnet 192.168.1.10 22

Testing TCP Port Connectivity with Telnet

ResultInterpretation
Connected (blank screen/banner) Port is open and reachable; service is responding
Connection refused Port is closed or no service listening
Timeout / no response Port is blocked, filtered, or unreachable (firewall/routing)

Example Output

Successful:
Trying 192.168.1.10...
Connected to 192.168.1.10.
Escape character is '^]'.
  
Failure (Connection refused):
Connecting To 192.168.1.10...Could not open connection to the host, on port 22: Connect failed
  

Common Ports to Test with Telnet

ServiceDefault TCP Port
HTTP (Web)80
HTTPS (Web)443
SSH22
SMTP (Email)25
Telnet23

Limitations of Telnet

  • No encryption – all data sent in plain text.
  • Vulnerable to sniffing – never use for sensitive remote management.
  • Cannot test UDP ports – only TCP.
  • Often disabled by default for security reasons.

Telnet for Troubleshooting

  • Diagnose firewall, ACL, or routing issues by checking port reachability.
  • Verify if services (web, mail, SSH) are running and accessible.
  • Check for port forwarding/NAT issues by testing from different network segments.

Telnet Client Availability

  • Windows: Not enabled by default (install via "Turn Windows features on or off").
  • Linux/macOS: Usually available or installable via package manager.

Security Considerations

  • Never use Telnet for sensitive remote management – use SSH instead.
  • Only use Telnet for quick connectivity tests or on isolated labs.
  • Disable Telnet server on devices wherever possible.

Alternative Tools for Port Testing

ToolCommand ExampleNotes
Netcatnc -vz 192.168.1.10 22Test TCP/UDP ports, scripting
Nmapnmap -p 22 192.168.1.10Scans multiple ports/services
PowerShellTest-NetConnection 192.168.1.10 -Port 22Modern Windows alternative
SSHssh user@192.168.1.10Secure device management

Exam Tips and Key Points

  • Telnet only tests TCP ports, not UDP.
  • Correct syntax: telnet [host] [port].
  • Interpret "Connected" (open), "refused" (closed), and "timeout" (filtered/unreachable).
  • Always mention security limitations and recommend SSH or alternatives.

Troubleshooting Scenarios

Scenario 1: Web Server Connectivity

John cannot access his company’s website at 192.168.10.10 on port 80 (HTTP).

Step 1: Test with Telnet:
telnet 192.168.10.10 80
Expected Output (Port Open):
Trying 192.168.10.10...
Connected to 192.168.10.10.
Escape character is '^]'.
  
Interpretation: Web server is listening on port 80.
If Port Closed/Blocked:
Trying 192.168.10.10...
telnet: Unable to connect to remote host: Connection refused
  
Interpretation: Port is closed, blocked by a firewall, or service is down.

Scenario 2: Testing SSH Port

John wants to check if an SSH server is up at 10.0.0.5.

telnet 10.0.0.5 22
Expected Output (Port Open):
Trying 10.0.0.5...
Connected to 10.0.0.5.
Escape character is '^]'.
SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
  
Interpretation: SSH server is reachable; the banner confirms it.
If Port Not Listening:
Trying 10.0.0.5...
telnet: Unable to connect to remote host: Connection refused
  

Scenario 3: Diagnosing SMTP Server Issue

John’s email client can’t send emails. Test mail server at mail.example.com on port 25.

telnet mail.example.com 25
Expected Output (Port Open):
Trying 203.0.113.25...
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
  
Interpretation: SMTP server is listening and available.
Timeout Example:
Trying 203.0.113.25...
telnet: Unable to connect to remote host: Connection timed out
  
Interpretation: Likely firewall, routing, or server down.

Scenario 4: Identifying Firewall Blocking

John can access the web server internally, but not from home.

telnet www.company.com 443
If fails externally but works internally, check edge firewall or ISP restrictions.

Sample Table: Interpreting Telnet Results

Telnet OutputMeaning
Connected to [host]TCP port open, service is up
Connection refusedPort closed or service not running
Unable to connect to remote host: timeoutPacket filtered by firewall or network issue
Raw protocol banner (SSH, SMTP, etc.)Service is up, banner confirms correct port

Telnet – Test TCP Port Connectivity Quiz

1. What is the default TCP port used by Telnet?

Correct answer is B. Telnet uses TCP port 23 by default for connections.

2. Which command syntax is correct to test connectivity to www.example.com on port 80?

Correct answer is D. The format is telnet [hostname/IP] [port].

3. What does it mean if Telnet outputs a blank screen or a banner message?

Correct answer is A. Open ports show a blank screen or service banner on connection.

4. What message indicates that the port is closed or no service is listening?

Correct answer is C. "Connection refused" means the port is closed or no service is running.

5. Why is Telnet generally discouraged for remote management in modern networks?

Correct answer is B. Telnet transmits data in plaintext, making it insecure.

6. Which of these is NOT a valid use case for Telnet today?

Correct answer is A. Telnet is insecure and not recommended for remote management.

7. What does it indicate if Telnet shows “Unable to connect to remote host: Connection timed out”?

Correct answer is D. Timeout usually indicates firewall or network filtering.

8. How do you enable Telnet client on modern Windows if it is not installed?

Correct answer is C. Telnet client must be enabled through Windows Features.

9. Which alternative tool is recommended for secure remote device management?

Correct answer is B. SSH provides encrypted and secure management connections.

10. Which of these ports is NOT typically tested using Telnet?

Correct answer is D. Telnet only tests TCP ports; DNS commonly uses UDP on port 53.

← Back to Home