Checking open ports with Telnet

When requesting that firewall ports be opened, it is useful to be able to check that they really have been opened using the simplest method possible. Using a telnet client is the perfect way to do this, as it comes standard on Windows and all Unix-like systems.

Telnet will create a raw TCP connection to a port you specify. If the port does not have a service listening on it, or the port is unreachable (due to a firewall), then you will not be able to establish a connection.

On Windows, typing “telnet www.jds.net.au 80” establishes a connection to the JDS web server and waits for you to make an HTTP request, presenting you with a blank screen. You can now end the session by pressing CTRL+], or you can type in an HTTP request (just for fun).

1
2
3
HEAD / HTTP/1.1<press Enter>
host: www.jds.net.au<press Enter>
<press Enter>

This should return something like…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
HTTP/1.1 200 OK
Date: Thu, 11 Dec 2008 00:11:10 GMT
Server: Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passth
rough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.2.6
X-Pingback: http://www.jds.net.au/xmlrpc.php
Set-Cookie: PHPSESSID=688bb2de5e03458279f1bcab9cffc595; path=/
Content-Type: text/html; charset=UTF-8
 
 
 
Connection to host lost.
 
C:\>

If the port is not accessible, then you will see “Connecting to {hostname} before the connection eventually times out.

1
2
C:\>telnet www.jds.net.au 81
Connecting To www.jds.net.au...

Note that this method will not work to check that a service which uses UDP can be connected to, as telnet only uses TCP.


Bookmark using any bookmark manager!

 

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply