How can we help you today?

How to Use Telnet as a Port Scanner on Cisco IOS

Introduction

When troubleshooting network connectivity, ICMP (ping) only tells you half the story. Ping verifies Layer 3 routing, but it cannot tell you if a specific TCP port is open, closed, or being actively blocked by a stateful firewall.

Instead of relying on external tools or workstations, you can use a Cisco router’s native Telnet client as a quick and highly effective TCP port scanner. Here is a straightforward guide on how to prepare your router, perform port checks, and manipulate your source interfaces to isolate network drops.

The Prerequisite: Unblocking the VTY Lines

Before you can even attempt a port check, you must ensure your router’s Virtual Teletype (VTY) lines are permitted to process Telnet traffic. Modern security standards often disable Telnet entirely, which will stop your troubleshooting before it even begins.

Allowing Outbound Tests (transport output) If you try to run a Telnet port check and the router immediately rejects your command, your local VTY line likely has outbound Telnet disabled. You must temporarily allow the router to initiate outbound Telnet sessions:

Router(config)# line vty 0 4
Router(config-line)# transport output ssh telnet
Router(config-line)# end

Not needed for most examples however if you are testing port connectivity from one Cisco router to another Cisco router (e.g., checking telnet port 23), the test will fail if the destination router is not configured to accept incoming Telnet connections. On the receiving router, allow the inbound traffic:

Destination-Router(config)# line vty 0 4
Destination-Router(config-line)# transport input ssh telnet
Destination-Router(config-line)# end

(Note: Once your network testing is complete, it is highly recommended to revert these lines to transport input ssh and transport output ssh to maintain security best practices).

The Basic TCP Port Check

Once your VTY lines allow the traffic, you can use the standard Telnet syntax to specify a destination port after the IP address. This forces the router to attempt a standard TCP 3-way handshake on that specific port instead of the default port 23.

The Command:

Router# telnet 192.168.1.50 80

How to Read the Results:

  • “Open”: The TCP handshake succeeded. The network path is clear, firewalls are allowing the traffic, and the destination device is actively listening on that port.
  • “Connection refused”: The network path is clear, but the destination device explicitly rejected the connection (usually because no service is actively listening on that specific port).
  • “Connection timed out”: The packets are being dropped into a black hole. This usually means a firewall is blocking the traffic, or routing is broken somewhere along the path.

Checking Ports Using a Specific Source Interface

By default, a Cisco router sources its outgoing traffic from the physical interface closest to the destination. However, if you are testing connectivity for a specific service bound to a Loopback interface, or testing a specific VPN tunnel/VRF, you need to force the router to use a different source IP.

You can do this by appending the /source-interface parameter to your command.

The Command:

Router# telnet 192.168.1.50 443 /source-interface Loopback0

This commands the router to build the TCP connection to port 443 on 192.168.1.50, but ensures the source IP address matches Loopback0. If this succeeds, you have definitively proven that the firewalls and routing tables along the path are correctly configured to pass traffic for that specific Loopback IP.

Summary

The Cisco Telnet client is an incredibly powerful, built-in tool for validating Layer 4 connectivity. By preparing your VTY lines and combining targeted port numbers with specific source interfaces, you can rapidly isolate firewall drops and routing issues without ever leaving the CLI.

Leave a Reply

Your email address will not be published. Required fields are marked *

    ICTU LTD is a company registered England and Wales (Company No. 09344913) 142 Thornes Lane, Wakefield, England, WF2 7RE
    Copyright © 2025 ICTU LTD, All Rights Reserved.