判断端口通不通的几种方法「建议收藏」

判断端口通不通的几种方法「建议收藏」判断端口通不通的几种方法

大家好,又见面了,我是你们的朋友全栈君。

1、使用telnet判断
telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet.
用法: telnet ip port
1)先用telnet连接不存在的端口
[root@localhost ~]# telnet 10.0.250.3 80
Trying 10.0.250.3...
telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝

2)再连接存在的端口
[root@localhost ~]# telnet localhost 22
Trying ::1...
Connected to localhost. #看到Connected就连接成功了
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
a
Protocol mismatch.
Connection closed by foreign host.

2、使用ssh判断
ssh是linux的标准配置并且最常用,可以用来判断端口吗?
用法: ssh -v -p port username@ip
-v 调试模式(会打印日志).
-p 指定端口
username可以随意
1)连接不存在端口
[root@localhost ~]# ssh 10.0.250.3 -p 80
ssh: connect to host 10.0.250.3 port 80: Connection refused
[root@localhost ~]# ssh 10.0.250.3 -p 80 -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.0.250.3 [10.0.250.3] port 80.
debug1: connect to address 10.0.250.3 port 80: Connection refused
ssh: connect to host 10.0.250.3 port 80: Connection refused

2)连接存在的端口
[root@localhost ~]# ssh ... -p
a
^]
^C
[root@localhost ~]# ssh ... -p -v
OpenSSH_.p, OpenSSL ..e-fips Feb
debug: Reading configuration data /etc/ssh/ssh_config
debug: Applying options for *
debug: Connecting to ... [...] port .
debug: Connection established.
debug: permanently_set_uid: /
debug: identity file /root/.ssh/identity type -
debug: identity file /root/.ssh/identity-cert type -
debug: identity file /root/.ssh/id_rsa type -
debug: identity file /root/.ssh/id_rsa-cert type -
debug: identity file /root/.ssh/id_dsa type -
debug: identity file /root/.ssh/id_dsa-cert type -
a
^C

不用-v选项也可以咯
3、使用wget判断
wget是linux下的下载工具,需要先安装.
用法: wget ip:port
1)连接不存在的端口
[root@localhost ~]# wget ...:
---- ::-- http://.../
Connecting to ...:... failed: Connection refused.

2)连接存在的端口
[root@localhost ~]# wget ...:
---- ::-- http://...:/
Connecting to ...:... connected.
HTTP request sent, awaiting response...
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/106107.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • SpringCloud架构图

    SpringCloud架构图直接上图

    2022年6月9日
    50
  • android 中string.xml中的%1$s

    android 中string.xml中的%1$s

    2021年9月11日
    45
  • 暴力破解(一)——python脚本暴力破解 加密的zip压缩文件

    暴力破解(一)——python脚本暴力破解 加密的zip压缩文件简介:zip格式是常见的压缩文件格式,它支持压缩时设置解压密码;有两种加密方式:1传统加密方式和普通的加密方式。传统加密方式是一种比较简单的加密方式,现在一般很少有人使用,而且压缩时系统默认选择的是普通的加密方式。因此网上很多破解zip的软件和脚本都是针对传统加密方式开发的,所以我们拿来使用时,无法对zip进行破解,所以博主使用python搞了一个针对所有压缩加密方式通用的pytho…

    2022年4月29日
    286
  • curl命令具体解释

    curl命令具体解释

    2021年12月3日
    55
  • Python可视化库

    现如今大数据已人尽皆知,但在这个信息大爆炸的时代里,空有海量数据是无实际使用价值,更不要说帮助管理者进行业务决策。那么数据有什么价值呢?用什么样的手段才能把数据的价值直观而清晰的表达出来?答案是要提供像人眼一样的直觉的、交互的和反应灵敏的可视化环境。数据可视化将技术与艺术完美结合,借助图形化的手段,清晰有效地传达与沟通信息,直观、形象地显示海量的数据和信息,并进行交互处理。数据可视化的应用…

    2022年4月5日
    77
  • IPlImage的width和widthStep

    IPlImage的width和widthStep学习opencv过程中,使用IPLImage结构,调用数据时定位数据区别width和widthStep:1.width表示图像的像素个数,也就是图像的水平长度2.widthStep是保存的数组长度,等于width*nChannes(通道数),比如对于RGB图像,有3通道(B、G、R),widthStep=width*3;灰度图只有1通道,widthStep=width。

    2022年6月12日
    34

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号