Friday, October 23, 2009

Checking Network Services Using Telnet

Suppose we want to check whether the web server(port 80) or any other network service is running or not, but we do not have any browsers (lynx, Firefox, IE, Netscape, ...), then there is a simple way of doing that. Just telnet to that machine on the http port (port no. 80 in general).


$ telnet <ip_addr> <port_no>


And then, give command "get /" (without quotes). If the webserver is running, it displays the HTML script of the homepage or basic info and closes the connection to the remote host.



$ telnet wordpress.com 80
Trying 76.74.254.126...
Connected to wordpress.com.
Escape character is '^]'.

get /
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>
Connection closed by foreign host.


No comments: