Home > System Tutorial > LINUX > Four ways to test port connectivity on Linux

Four ways to test port connectivity on Linux

WBOY
Release: 2024-01-11 17:36:11
forward
1605 people have browsed it

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

Method 1, telnet method

Telnet provides users with the ability to complete remote host work on the local computer, so the port connectivity can be tested through telnet. The specific usage format is:

telnet ip port

illustrate:

ip: is the ip address of the test host

port: is the port, such as 80

If telnet connects to a non-existent port, it will be as shown in the figure below.

Four ways to test port connectivity on Linux

If there is a port in the telnet connection, the content shown in the figure below will appear. The figure below takes port 80 as an example.

Four ways to test port connectivity on Linux

Method 2, ssh method

SSH is currently a more reliable protocol designed to provide security for remote login sessions and other network services. On Linux, you can use the ssh command to test port connectivity. The specific usage format is as follows:

Usage: ssh -v -p port username@ip

illustrate:

-v Debug mode (log will be printed).

-p Specify port

username:Login user of the remote host

ip:Remote host

If the remote host has opened the corresponding port, there will be a successful establishment prompt as shown in the figure below.

Four ways to test port connectivity on Linux

If the remote host does not open the corresponding port, it will be as shown in the figure below

Four ways to test port connectivity on Linux

Method 3, curl method

curl is an open source file transfer tool that uses URL syntax to work in command line mode. It can also be used to test the connectivity of the port. Specific usage:

curl ip:port

illustrate:

ip: is the ip address of the test host

port: is the port, such as 80

If the corresponding port is opened on the remote host, information will be output. If the corresponding port is not opened, there will be no prompt and CTRL C is required to disconnect.

Four ways to test port connectivity on Linux

Method 4, wget method

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

wget ip:port

illustrate:

ip: is the ip address of the test host

port: is the port, such as 80

If the port does not exist on the remote host, you will always be prompted to connect to the host.

Four ways to test port connectivity on Linux

If the remote host has a port, you will see the corresponding information, as shown in the figure below.

Four ways to test port connectivity on Linux

related suggestion:

How to install third-party fonts in Red Hat Linux?

How to test port connectivity under Linux system?

What command is used in Linux system to check the port occupancy?

The above is the detailed content of Four ways to test port connectivity on Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template