美文网首页
linux 测试机器端口连通性方法

linux 测试机器端口连通性方法

作者: 老猫头 | 来源:发表于2018-05-08 10:00 被阅读596次
  1. telnet方法
  2. wget方法
  3. ssh方法
  4. curl方法

1. telnet

用法: telnet ip port
(1) telnet连接不存在的端口
telnet 1.1.1.1 8
Trying 1.1.1.1...
telnet: connect to address 1.1.1.1: Connection timed out
(2) telnet 链接存在端口
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 指定端口
监听20022端口:
ssh -f -g -N -L 20022:127.0.0.1:22 appoper@10.3.156.177

4. curl

用法: curl ip:port
(1) 不存在端口
获取不到结果
(2) 存在端口
curl 1.1.1.1:8000
<!DOCTYPE html>
<html>
<head>xxx</head>
<body>
......
</body>
</html>

相关文章

网友评论

      本文标题:linux 测试机器端口连通性方法

      本文链接:https://www.haomeiwen.com/subject/jzrirftx.html