October 19, 2018

Troubleshooting Linux Servers with telnet - page 2

Completely Insecure But Still Useful

  • February 14, 2011
  • By Juliet Kemp

HTTP servers are also accessible via telnet:

telnet www.example.com 80
Try getting a particular page:
GET /index.html HTTP/1.1
host: www.example.com
Note that you need to hit enter twice after the host name line, and you need to specify both the HTTP protocol version, and the hostname.

If the page is there, you should get a bunch of HTTP header information, then the HTML content of the page. If it's not, you'll get an HTTP 404 Not Found error, and the website's 404 page. Use the same request structure again to request a different page. If you want to experiment more with this, check out the HTTP 1.1 protocol.


Most IRC servers run on port 6667. Try connecting to an IRC server like this:

telnet irc.freenode.net 6667
This will connect you, but you'll need to set your nickname manually (type NICK yournickname) and join channels with the raw protocol command (type JOIN #thischannel). You'll get a lot of output that you may or may not recognise, and the whole thing is a bit more tortuous than using a real IRC client! But it gives you a chance to experiment with the raw commands, which (as discussed in the O'Reilly book IRC Hacks can be useful if you want to write or improve IRC clients.

You can also try port 9 to test that your telnet client is working OK. It's the discard/null port, so you won't affect any other services.


Telnetting to servers won't always work these days, as some (quite reasonably!) insist on only connecting over an encrypted connection for some services, and telnet is plaintext. However, it can be a useful debugging tool, particularly when you're setting up your own servers to make sure that everything is working as it should. Not to mention... it's always kind of fun to be able to talk to people or servers in their own language.

Chapter 20 of the "Linux Cookbook" by your very own Linux Planet editor has detailed sections on testing mail servers with telnet and s_client

Most Popular LinuxPlanet Stories