In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to use telnet to test the connectivity of designated ports". In the operation of actual cases, many people will encounter this dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Telnet is a castrated version of ssh that is unencrypted, vulnerable to theft, and vulnerable to man-in-the-middle attacks, so the telnet port must be closed by default.
Telnet provides users with the ability to do remote host work on the local computer, so you can test port connectivity through telnet.
Confirm the port of the remote host
Before testing port connectivity, let's use the nmap command to see the port open status of the target server.
$nmap lxlinux.net
Use telnet to test port connectivity
After confirming that the port of the target server is open, we can use telnet to test port connectivity. The format of the test is:
$telnet server port
For example, if we want to test port (80) connectivity on http, we can test it like this:
$telnet lxlinux.net 80
We can see from the prompt that it shows Connected to lxlinux.net. Which means that this port is connected
If the port is disconnected, it will prompt unable connect to remote host: Connection timed out.
Now let's try the closed port again. Let's test port 22, which is not scanned by nmap, so it should be closed. Just to be on the safe side, we can use nmap to confirm again, and then we need to add the-p option.
$nmap-p 22 lxlinux.net
So now that port 22 is closed, we can use telnet to test its connectivity.
$telnet lxlinux.net 22
The prompt shows Connection refused, which means that the port is also disconnected.
When you connect to a port with telnet, you can press CTRL+] to enter the interactive interface:
Telnet >
Then type quit and press enter to exit the connection.
With this feature of telnet, we can write a script to test the connectivity of multiple hosts and ports.
For example, we wrote the following script multipletelnet.sh:
#! / bin/bash
Telnet lxlinux.net 80
Telnet baidu.com 80
Telnet lxlinux.net 443
Then we use the chmod command to give it executable permissions:
$chmod + x multipletelnet.sh
Of course, if you want to test multiple ports at the same time, then this script is a bit inadequate, in which case you need to use nmap and other similar tools.
That's all for "how to use telnet to test the connectivity of a designated port". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.