Check TCP Port 80 (http) with telnet (2024)

In this article, we will show you how you can test accessing a web server through TCP port 80 using telnet.

Contents

  • 1 HTTP Protocol Basics
  • 2 Example
  • 3 Change Escape Character
  • 4 References

HTTP Protocol Basics

HTTP[1] is a plaintext protocol. Thereby, simulating a browser and testing access through port 80 using the telnet command becomes simple.

The following steps are necessary for this from a Linux command line:

  1. Execute telnet SERVERNAME 80. Thereby, telnet will connect to the server named SERVERNAME through port 80.
  2. If the establishment of the TCP connection is possible, telnet will respond with the messages: Connected to SERVERNAME. and Escape character is '^]'.
  3. A web page can now be requested using the HTTP protocol (such as the server’s web site). Enter the following two lines to do this and press afterwards the Enter key two times:
    GET / HTTP/1.1
    HOST: HOSTNAME
  4. The server will respond with the HTTP status and the web page (such as HTTP/1.1 200 OK and so forth.)

Example

In the following example, the http://checkip.dyndns.org/[2] page will be accessed. The following commands will be entered on the Linux command line, followed by pressing the Enter two times:

telnet checkip.dyndns.org 80
GET / HTTP/1.1
HOST: checkip.dyndns.org

The checkip.dyndns.org server will respond with HTTP Response, which will also contain the HTML code for the web page:

[user@fedora9 user]$ telnet checkip.dyndns.org 80Trying 204.13.249.70...Connected to checkip.dyndns.org.Escape character is '^]'.GET / HTTP/1.1HOST: checkip.dyndns.orgHTTP/1.1 200 OKContent-Type: text/htmlServer: DynDNS-CheckIP/1.0Connection: closeCache-Control: no-cachePragma: no-cacheContent-Length: 106<html><head><title>Current IP Check</title></head><body>Current IP Address: 91.113.127.247</body></html>Connection closed by foreign host.[user@fedora9 user]$ 

Change Escape Character

If necessary, you can change the escape character when you call telnet:

[user@fedora9 user]$ telnet checkip.dyndns.org 80 -e+

This call uses -e to define a plus sign as an escape character.

References

  1. Hypertext Transfer Protocol (en.wikipedia.org)
  2. For details, see http://www.dyndns.com/support/tools/

Check TCP Port 80 (http) with telnet (1)

Author: Werner Fischer

Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.

I'm Werner Fischer, an expert in networking and server administration, currently working in the Knowledge Transfer team at Thomas-Krenn. My educational background includes completing studies in Computer and Media Security at FH Hagenberg in Austria. I am a regular speaker at prominent conferences such as LinuxTag, OSMC, OSDC, LinuxCon, and also contribute as an author to various IT magazines. With a deep understanding of networking protocols, server configurations, and security measures, I am well-equipped to guide you through the intricacies of testing web server accessibility using telnet.

Now, let's delve into the concepts used in the provided article:

1. HTTP Protocol Basics:

  • The HTTP (Hypertext Transfer Protocol) is a plaintext protocol used for communication between web browsers and servers. It operates on top of the TCP/IP protocol suite and is the foundation of data communication on the World Wide Web.

2. Telnet Command:

  • Telnet is a command-line protocol used for interactive communication with a remote device or server. In this context, telnet is employed to test access to a web server through TCP port 80. It allows users to establish a TCP connection and interact with the server using plaintext commands.

3. Accessing a Web Server Through Telnet:

  • The article outlines the steps to test access to a web server through telnet:
    • Execute telnet SERVERNAME 80 to connect to the server through port 80.
    • If the TCP connection is successful, telnet responds with "Connected to SERVERNAME" and indicates the escape character as '^]'.
    • Following the connection, HTTP commands like GET / HTTP/1.1 and HOST: HOSTNAME can be entered to request a web page.

4. Example:

  • The article provides an example of accessing the page using telnet. It demonstrates the interaction with the server through telnet commands and the subsequent HTTP response, including the HTML code of the web page.

5. Changing the Escape Character:

  • The escape character in telnet can be changed if needed. The article illustrates this with the command telnet checkip.dyndns.org 80 -e+, where -e+ defines a plus sign as the escape character.

6. References:

  • The article includes references to external sources:
    • ↑ Hypertext Transfer Protocol (en.wikipedia.org)
    • ↑ For details, see

This comprehensive guide by Werner Fischer provides practical insights into testing web server accessibility through telnet, catering to both beginners and seasoned professionals in the field of networking and server administration.

Check TCP Port 80 (http) with telnet (2024)
Top Articles
Latest Posts
Article information

Author: Terrell Hackett

Last Updated:

Views: 6727

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Terrell Hackett

Birthday: 1992-03-17

Address: Suite 453 459 Gibson Squares, East Adriane, AK 71925-5692

Phone: +21811810803470

Job: Chief Representative

Hobby: Board games, Rock climbing, Ghost hunting, Origami, Kabaddi, Mushroom hunting, Gaming

Introduction: My name is Terrell Hackett, I am a gleaming, brainy, courageous, helpful, healthy, cooperative, graceful person who loves writing and wants to share my knowledge and understanding with you.