Linux系统测试端口连通性的方法

mac2022-06-30  22

Linux系统测试端口连通性的方法

有四种常用方法:1. telnet 方法2. wget 方法3. ssh 方法4. curl 方法

下面一一介绍。

1. telnet用法: telnet ip port(1)连接不存在的端口  telnet 1.1.1.1 8    Trying 1.1.1.1...    telnet: connect to address 1.1.1.1: Connection timed out(2)连接存在的端口telnet 1.1.1.1 8000    Trying 1.1.1.1...    Connected to 1.1.1.1.    Escape character is '^]'.    Connection closed by foreign host.

2. wget用法: wget ip:port(1)连接不存在的端口 wget 1.1.1.1:8      --2017-01-24 11:38:34-- http://1.1.1.1:8/   Connecting to 1.1.1.1:8...     failed: Connection timed out. Retrying.

(2)连接存在的端口 wget 1.1.1.1:8000    --2017-01-24 11:39:03--  http://1.1.1.1:8000/    Connecting to 1.1.1.1:8000... connected.    HTTP request sent, awaiting response... 200 OK

3. ssh用法: ssh -v -p port username@ip-v 调试模式(会打印日志)-p 指定端口这里没有给出测试,留给读者自己测试。

4. curl用法: curl ip:port(1)连接不存在的端口    没有结果。(2)连接存在的端口    curl  1.1.1.1:8000    <!DOCTYPE html>    <html>        <head>xxx</head>        <body>            ......        </body>    </html>

———————————————— 版权声明:本文为博主「iw1210」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/iw1210/article/details/78847363

转载于:https://www.cnblogs.com/cnqfz/p/11416264.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)