Skip to content
Home » Network » How to Check Open Port By Telnet

How to Check Open Port By Telnet

Telnet

If you'd like to check open port of a remote server, there is a very simple way to do it by using telnet command. In the following case, we would like to know www (http) port 80 on a remote server is open or not.

Before port 80 open

On remote server 10.12.68.154, we check open port 80 by this:

[oracle@test ~]$ telnet 10.12.68.154 80
Trying 10.12.68.154...
telnet: connect to address 10.12.68.154: No route to host
telnet: Unable to connect to remote host: No route to host

It failed with No route to host right after the command was issued. Obviously, it's not open.

After port 80 open

[oracle@test ~]$ date; telnet 10.12.68.154 80; date
Mon Jul 22 19:34:52 CST 2013
Trying 10.12.68.154...
Connected to 10.12.68.154 (10.12.68.154).
Escape character is '^]'.
Connection closed by foreign host.
Mon Jul 22 19:36:53 CST 2013

We waited for about 2 minutes to timeout on check open port 80. But I think the wait seconds to timeout may vary from port to port. It could be short as 10 seconds, as a result of port 3306 testing.

Particularly, Escape character is '^]' and Connection closed by foreign host are the keywords that indicate the port is open.

Further, you may be interested in how to open port. For those who are using iptables or firewalld, you can refer to: How to Open Ports and Survives from Reboots.

Leave a Reply

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