Basic Networking tools: Telnet
telnet
maybe the most basic networking tool in Unix/Linux. It’s developed in 1969 with RFC15.
Telnet uses a client-server protocol, which is a reliable connection-oriented protocol.
Currently, almost nobody uses telnet server, but we still use telnet
to establish TCP connection to a server.
Test whether a port is opened and connectivity is OK
Suppose you start a server, but you don’t know whether everything is OK, then run telnet like this:
|
If you connected successfully, the output will be like this:
Otherwise, the connectivity is not OK, the output will be:
The reason may be: Operation timed out、Connection refused。
Send an HTTP request
Since telnet
establishes a TCP connection, and also could be used to send an HTTP request to server.
For instance, we execute command line telnet coderscat.com 80
, then we input the following text (Note there are four lines, including 2 empty lines):
|
We get a valid HTTP response with status code 301 (redirect to HTTPS).
Connect to a Redis server
We could use telnet to connect a Redis server and execute some redis operations:
Telnet’s limitation
telnet
can not function as a server, and can not using UDP protocol.
Join my Email List for more insights, It's Free!😋