Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to test port connectivity in Linux

2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to test port connectivity in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux systems sometimes need to test the connectivity of a port, users can refer to the following methods to test.

Method 1. Telnet method

Telnet provides users with the ability to do remote host work on the local computer, so you can test port connectivity through telnet, using the format:

Telnet ip port

Description:

Ip: is the ip address of the test host

Port: it's a port, such as 80

If the telnet connects to a port that does not exist, it will look like the following figure.

If there is a port for a telnet connection, the content shown in the following figure appears, as shown in the following figure, taking port 80 as an example.

Method 2. Ssh method

SSH is currently a reliable protocol designed to provide security for remote login sessions and other network services. You can test port connectivity through the ssh command on linux in the following format:

Usage: ssh-v-p port username@ip

Description:

-v debug mode (logs will be printed).

-p designated port

Username: the logged in user of the remote host

Ip: remote host

If the remote host opens the appropriate port, it will be prompted to establish successfully as shown in the following figure.

If the remote host does not have the corresponding port open, it is shown in the following figure

Method 3. Curl method

Curl is an open source file transfer tool that uses URL syntax to work on the command line. It can also be used to test port connectivity, specific usage:

Curl ip:port

Description:

Ip: is the ip address of the test host

Port: it's a port, such as 80

If the remote host opens the corresponding port, it will output information. If the corresponding port is not opened, there will be no prompt and the CTRL+C will be disconnected.

Method 4. Wget method

Wget is a free tool for automatically downloading files from the network. It supports downloading through the three most common TCP/IP protocols, HTTP, HTTPS, and FTP, and can use the HTTP agent. The origin of the wget name is a combination of "World Wide Web" and "get", and it can also be used to test port connectivity:

Wget ip:port

Description:

Ip: is the ip address of the test host

Port: it's a port, such as 80

If the remote host does not have a port, it will always be prompted to connect to the host.

If a port exists on the remote host, you will see the appropriate information, as shown in the following figure.

Thank you for reading! This is the end of the article on "how to test port connectivity in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report