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

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

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

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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 5 . 4 . 3 架构

    5 . 4 . 3 架构

    2022年4月3日
    44
  • java之多线程

    java之多线程简介:线程(thread)就是进程中的一个执行线索。Java虚拟机允许进程中同时执行多个线程。每个线程都有一个优先级。具有较高优先级的线程先执行。线程是操作系统分配CPU时间的基本实体。每一个

    2022年7月1日
    18
  • Config ConnectionStrings

    Config ConnectionStrings<connectionStrings><addname=”MyschoolConnectionString”connectionString=”DataSource=.;InitialCatalog=MySchool1;uid=sa;pwd=123456″/></connectionStrings>stringcon…

    2022年5月11日
    105
  • flowable工作流所有业务概念

    flowable工作流所有业务概念1.什么是工作流审批根据本人的理解,就是审批流程管理。2.什么是flowable1.官方解释官方解释如下:Flowable项目提供了一套核心的开源业务流程引擎,这些引擎紧凑且高效。它们为开发人员、系统管理员和业务用户提供工作流和业务流程管理(BPM)平台。它的核心是一个闪电般快速、久经考验的动态BPMN流程引擎,伴随着DMN决策表和CMMN案例管理引擎,所有这些引擎都是用Java编写的。它们是Apache2.0许可的开放源代码,拥有一个承诺社区。所有引擎都可以嵌入

    2022年5月11日
    43
  • 史记 乔布斯列传

    史记 乔布斯列传

    2021年8月14日
    111
  • kalman滤波融合原理及其matlab仿真「建议收藏」

    kalman滤波融合原理及其matlab仿真「建议收藏」1、kalman原理卡尔曼滤波是一种递推式滤波方法,不须保存过去的历史信息,新数据结合前一刻已求得的估计值及系统本身的状态方程按一定方式求得新的估计值。1.1、线性卡尔曼假设线性系统状态是k,卡尔曼原理可用以下五个公式表达:X(k|k-1)=AX(k-1|k-1)+BU(k)………..(1)P(k|k-1)=AP(k-1|k-1)A’+Q…………

    2022年5月28日
    45

发表回复

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

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