telnet is an application protocol used to connect remote devices over the network. Telnet provides text-oriented communication between local and remote hosts. Even the telnet is created to manage devices remotely via the command line interface it is also used to test open ports. As the telnet protocol and command use the TCP it can be used to test open ports remotely.
Install Telnet For Windows Operating System
Windows operating systems provide the telnet client but it is not installed by default. The telnet client for Windows operating system can install different ways which are described in detail.
Install Telnet For Linux Operating System
All major Linux distributions provide the telnet client but should be installed via the package managers like
Install Telnet For Ubuntu, Debian, Mint, Kali:
$ sudo apt install telnet
Install Telnet For Fedora, CentOS, RHEL:
$ sudo dnf install telnet
Test Open Port Using IP Address
The telnet command is very simple it can accept the remote IP address and remote port we want to connect. The syntax of the telnet command is like below.
telnet IP PORT
- IP is the remote system IP address.
- PORT is the remote system TCP port we want to check if it is open.
In the following example, we check the HTTP port of the remote system with IP address 192.168.136.136.
$ telnet 192.168.136.136 80
Trying 192.168.136.136… Connected to 192.168.136.136. Escape character is '^]'. Connection closed by foreign host.
The output consists of 4 lines with the following meaning.
- “Trying 192.168.136.136…” line means the telnet try to connect remote IP address 192.168.136.136.
- “Connected to 192.168.136.136.” line means the port is open and connected succesfully.
- “Escape character is ‘^]’.” line is hust a simple information not related with the port connectivity.
- “Connection closed by foreign host.” line means the connection is closed by the remote host because every network protocol has a timeout value to close port automatically after specified of time.
Test Open Port Using Domain Name
The remote host can be also specified with the domain name or hostname. The syntax is the same with the IP address where the domain name is specified instead of the IP address. In the following example, we check the
www.google.com hostname port number
$ telnet www.google.com 443
|Telnet Port Check Command||Description|
|telnet 192.168.1.1 80||Check remote HTTP (80) port|
|telnet 192.168.1.1 443||Check remote HTTPS (443) port|
|telnet 192.168.1.1 23||Check remote Telnet(23) port|
|telnet 192.168.1.1 21||Check remote FTP(21) port|
|telnet 192.168.1.1 25||Check remote SMTP(25) port|
|telnet 192.168.1.1 143||Check remote IMAP(143) port|
|telnet 192.168.1.1 3389||Check remote RDP(3389) port|
|telnet 192.168.1.1 22||Check remote SSH(22) port|