Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >不使用telnet进行端口测试的方法

不使用telnet进行端口测试的方法

原创
作者头像
dumpcat
修改于 2022-07-08 02:43:05
修改于 2022-07-08 02:43:05
3.7K0
举报
文章被收录于专栏:数据库技术数据库技术

1. curl

代码语言:shell
AI代码解释
复制
# 测试命令及参数
curl -v 10.10.251.132:22

# 端口连通示例
[oracle@dbtest ~]$ curl -v 10.10.251.132:22
* About to connect() to 10.10.251.132 port 22 (#0)
*   Trying 10.10.251.132...
* Connected to 10.10.251.132 (10.10.251.132) port 22 (#0)           <<<<<<<
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 10.10.251.132:22
> Accept: */*
> 
SSH-2.0-OpenSSH_7.4
Protocol mismatch.
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

# 端口未连通示例
[oracle@dbtest ~]$ curl -v 10.10.251.132:2222
* About to connect() to 10.10.251.132 port 2222 (#0)
*   Trying 10.10.251.132...
* Connection refused        <<<<<<<               
* Failed connect to 10.10.251.132:2222; Connection refused
* Closing connection 0
curl: (7) Failed connect to 10.10.251.132:2222; Connection refused

# IP地址错误或者防火墙限制示例
[oracle@dbtest ~]$ curl -v 10.10.251.220:22
* About to connect() to 10.10.251.220 port 22 (#0)
*   Trying 10.10.251.220...
* No route to host          <<<<<<<
* Failed connect to 10.10.251.220:22; No route to host
* Closing connection 0
curl: (7) Failed connect to 10.10.251.220:22; No route to host

2. ssh

代码语言:shell
AI代码解释
复制
# 测试命令及参数
ssh -v -p 22 root@10.10.251.132

# 端口连通示例
[root@dbtest ~]# ssh -v -p 22 root@10.10.251.132
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 10.10.251.132 [10.10.251.132] port 22.        <<<<<<<
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.10.251.132:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:YJD4VRC6wUMHaF1BMW78xPAz5gek40IrRC/lAFH3Eao
debug1: Host '10.10.251.132' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:0)
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:0)
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: password
root@10.10.251.132's password: 

# 端口未连通示例
[root@dbtest ~]# ssh -v -p 222 root@10.10.251.132
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 10.10.251.132 [10.10.251.132] port 222.
debug1: connect to address 10.10.251.132 port 222: Connection refused       <<<<<<<
ssh: connect to host 10.10.251.132 port 222: Connection refused

# IP地址错误或者防火墙限制示例
[root@dbtest ~]# ssh -v -p 22 root@10.10.251.220
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 10.10.251.220 [10.10.251.220] port 22.
debug1: connect to address 10.10.251.220 port 22: No route to host            <<<<<<
ssh: connect to host 10.10.251.220 port 22: No route to host

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Linux下ssh远程主机报错:ssh_exchange_identification: read: Connection 解决
ssh_exchange_identification: read: Connection reset by peer
非著名运维
2022/06/22
15.4K0
每天学一个 Linux 命令(60):scp
scp命令常用于在Linux系统下两个不同主机之间传输文件,其功能与cp命令相似,但是不同是,cp命令只能用于在本机环境下传输或复制拷贝文件,scp命令可以跨越不同主机,而scp传输文件是加密的。
民工哥
2021/03/15
5540
Hadoop 在 Centos7 下的单机布署(一). Standalone Operation
Hadoop 生态圈中的其它项目可以参考 Hadoop-related projects
franket
2021/08/12
5600
Linux端口不通检查
# Windows 检查端口 telnet ip port # Linux telnet 检查端口 telnet ip port ## 若报命令不存在时安装 sudo yum install telnet ## 成功 Trying 161.63.104.193... Connected to 161.63.104.193. Escape character is '^]'. ## 端口通但服务没启动 Trying 29.34.5.11... telnet: connect to address 29.34
林万程
2021/06/09
7.8K0
Ubuntu 22.04 SSH the RSA key isn't working since upgrading from 20.04
Up until last week I was running Ubuntu 20.04 happily, and then over the weekend decided to back everything up and install 22.04. I've had a couple of teething issues which I've solver, however I'm having real issues with SSH. I have two first generation WD MyCloud drives which handle all my backups and files both on and away from home. I can still connect to the shares with no problems, however I need to SSH onto both drives in order to run maintenance, backup between cloud drives, etc.
一个会写诗的程序员
2022/12/02
1.3K0
Linux——ssh_exchange_identification: read: Connection reset by peer
思索
2024/08/16
1770
Linux——ssh_exchange_identification: read: Connection reset by peer
Linux问题汇总
在Windows环境下用Notepad++写了个shell脚本,上传到Linux平台后运行报错如下:
雨临Lewis
2022/09/09
1.3K0
基于Linux下限制指定用户或IP地址通过SSH登录(访问控制)
同时设置上述两个文件时,hosts.allow文件中规则的优先级更高,参考上述两个文件进行设置时,服务器只允许192.168.2.130这个IP地址以及192.168.3.0/24这个IP地址段通过SSH进行登录,其他的IP都会被拒绝SSH登录。
非著名运维
2022/06/22
6.6K0
诡秘的sshd免密连接
gitlab上配置了ssh rsa 公钥,但在做连接测试时,发现一直提示你输入密码
天地一小儒
2022/12/28
3.1K0
诡秘的sshd免密连接
ssh常用命令总结
原文链接:https://rumenz.com/rumenbiji/ssh-common-commands.html
入门笔记
2021/10/03
5260
ssh: connect to host github.com port 22: Connection refused
这与 ssh 的运行机制有关,找到 known_hosts 文件中对应 ip 的 RSA 并删除便可解决。
攻城狮杰森
2022/07/09
1.2K0
判断端口通不通的几种方法「建议收藏」
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/106107.html原文链接:https://javaforall.cn
全栈程序员站长
2022/08/09
8.5K0
记一次诡异的 ssh 互信免密码登录失败
背景 因为 hadoop 环境需要 master 能免密码 ssh localhost,所以我们需要建立与本机 localhost 的互信,方法很简单: 1. ssh-keygen -t rsa #Press enter for each line 2. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 3. chmod og-wx ~/.ssh/authorized_keys 这三步执行下来就能顺利 ssh localhost 免密码登录了,但是昨天
用户1177713
2018/02/24
2.8K0
记一次诡异的 ssh 互信免密码登录失败
每天学一个 Linux 命令(59):ssh
ssh ( Secure Shell )命令是用于安全登录到远程系统的协议,它可用于在远程服务器上记录或执行命令。
民工哥
2021/03/15
1.1K0
ssh 无密码访问的问题
ssh 无密码登录失败 虚拟机 resize 需要配置计算节点之间 nova 用户无密码访问,但是在配置过程中有一台始终不能用密钥登录,对比了正常可以无密码登录的日志如下。 复制 # 正常登录 debug2: we did not send a packet, disable method debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authme
tanmx
2018/07/16
3.1K0
Linux问题汇总
在Windows环境下用Notepad++写了个shell脚本,上传到Linux平台后运行报错如下:
炒香菇的书呆子
2023/09/27
3130
Hadoop SSH免密码登录
记得要把authorized_keys文件放到.ssh目录下,与rsa等文件放在一起,否则免登录失败,debug如下(ssh -vvv localhost进行调试,查找错误原因):
smartsi
2019/08/07
2.1K0
Docker: Alpine Linux升级且安装openssh导致构建凉凉排查修正
最近在搞一个迭代,发现开发环境的持续集成有些地方可以优化,但需要动到前端基础镜像; 而搞完基础镜像准备用起来的时候,问题就冒出来了。本着不能半途而废的态度,搞起~~
CRPER
2022/09/01
1.5K0
Docker: Alpine Linux升级且安装openssh导致构建凉凉排查修正
linux基础:传输文件文件夹的10个scp命令
> scp source_file_name username@destination_host:destination_folder
Ponnie
2022/01/13
2.3K0
Linux SSH的SSL弱加密算法漏洞修复
Linux在做漏洞扫描时,会发现有个名为SSH Weak Encryption Algorithms Supporte的漏洞,这是因为ssh通信时默认使用的加密算法中有部分是不再安全的算法。如:arcfour,arcfour128,arcfour256等都是弱加密算法。
Power
2025/02/28
2510
推荐阅读
相关推荐
Linux下ssh远程主机报错:ssh_exchange_identification: read: Connection 解决
更多 >
领券
💥开发者 MCP广场重磅上线!
精选全网热门MCP server,让你的AI更好用 🚀
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档