Home  >  Article  >  Operation and Maintenance  >  How to test whether the port is accessible in Linux

How to test whether the port is accessible in Linux

WBOY
WBOYOriginal
2022-01-06 10:38:5547400browse

Method: 1. Use the telnet command to test, the syntax is "telnet ip port"; 2. Use ssh to test, the syntax is "ssh -v -p port username@ip"; 3. Use wget to test, the syntax is "wget ​​ip:port".

How to test whether the port is accessible in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to test whether the port is accessible in Linux

Start a web server and provide the port.

[wyq@localhost ~]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...

Use other web servers to provide it The same goes for the port. Since python is more convenient, I will use it here

1. Use telnet to determine

Telnet is a standard Windows service and can be used directly; if it is a Linux machine, you need to install telnet.

Usage: telnet ip port

1) First use telnet to connect to the non-existent port

How to test whether the port is accessible in Linux

2) Then connect to the existing port

How to test whether the port is accessible in Linux

2. Use ssh to determine

Ssh is the standard configuration of Linux and is the most commonly used. Can it be used to determine the port?

Usage: ssh -v -p port username@ip

-v debug mode (log will be printed).

-p specified port

username Feel free to

1) Connect to a non-existing port

How to test whether the port is accessible in Linux

2) Connect to an existing port

How to test whether the port is accessible in Linux

3. Use wget to determine

wget is a download tool under Linux and needs to be installed first.

Usage: wget ip:port

1) Connect to a non-existent port

How to test whether the port is accessible in Linux

2) Connect to the existing port

How to test whether the port is accessible in Linux

4. Use the port scanning tool

How to test whether the port is accessible in Linux

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to test whether the port is accessible in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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