判断端口通不通的几种方法

判断端口通不通的几种方法,第1张

一般情况下使用"telnet ip port"判断端口通不通,其实测试方法不止这一种,还有很多种方法,下面小编给大家分享了几种方法,具体内容请往下看:

准备环境

启动一个web服务器,提供端口

12[wyq@localhost ~]$ python -m Simple>

1、使用telnet判断

telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet

用法: telnet ip port

1)先用telnet连接不存在的端口

123[root@localhost ~]# telnet 1002503 80Trying 1002503telnet: connect to address 1002503: Connection refused #直接提示连接被拒绝

2)再连接存在的端口

12345678[root@localhost ~]# telnet localhost 22Trying ::1Connected to localhost #看到Connected就连接成功了Escape character is '^]'SSH-20-OpenSSH_53aProtocol mismatchConnection closed by foreign host

2、使用ssh判断

ssh是linux的标准配置并且最常用,可以用来判断端口吗?

用法: ssh -v -p port username@ip

-v 调试模式(会打印日志)

-p 指定端口

username可以随意

1)连接不存在端口

123456789[root@localhost ~]# ssh 1002503 -p 80ssh: connect to host 1002503 port 80: Connection refused[root@localhost ~]# ssh 1002503 -p 80 -vOpenSSH_53p1, OpenSSL 101e-fips 11 Feb 2013debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for debug1: Connecting to 1002503 [1002503] port 80debug1: connect to address 1002503 port 80: Connection refusedssh: connect to host 1002503 port 80: Connection refused

2)连接存在的端口

12345678910111213141516171819[root@localhost ~]# ssh -p a^]^C[root@localhost ~]# ssh -p -vOpenSSH_p, OpenSSL e-fips Feb debug: Reading configuration data /etc/ssh/ssh_configdebug: Applying options for debug: Connecting to [] port debug: Connection establisheddebug: 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)连接不存在的端口

123[root@localhost ~]# wget :---- ::-- >

可以通过”telnet ip 端口“的形式进行端口查看。

点击左下角的开始菜单,之后在搜索中输入”cmd “;直接回车,之后再命令行输入“telnet ip 端口”。如果可以访问的话,会直接进入端口页面,不能访问的话,会出现端口“连接失败”提示。

Telnet协议是TCP/IP协议族中的一员,是Internet远程登录服务的标准协议和主要方式。它为用户提供了在本地计算机上完成远程主机工作的能力。在终端使用者的电脑上使用telnet程序,用它连接到服务器。

终端使用者可以在telnet程序中输入命令,这些命令会在服务器上运行,就像直接在服务器的控制台上输入一样。可以在本地就能控制服务器。要开始一个telnet会话,必须输入用户名和密码来登录服务器。Telnet是常用的远程控制Web服务器的方法。

原本想在Windows10上面,安装SVN,通过右键「SVN CheckOut」检出,拉取阿里云服务器ECS中的数据,结果一直连不上,所以想通过验证ip或端口是否连通,于是有了本文。
来,和艾兜兜儿一起学习,如何通过Windows 自带的cmd命令,检测服务端ip或端口是否接通吧。

① 快捷键:Ctrl + R,即Windows键(徽标) + R
② 输入:cmd ,回车或按「确定」/「Enter」键
③ 输入:ping + IP地址或域名

① 打开控制面板
② 程序和功能,找到或直接搜索:启用或关闭Windows功能

③ 查看本机是否开启 telnet client(Telnet客户端),如图 *** 作:

End by 艾兜兜儿

如果是tcp端口,可以使用telnet命令登录到该端口来测试该端口是否打开:如果telnet能够连上,说明该端口已经打开,否则是关闭的。 如果是udp端口,可以使用端口扫描工具,比如nmap。 当然,nmap也可以用来扫描tcp端口,只是telnet更方便 另外,


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13078841.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-30
下一篇 2023-05-30

发表评论

登录后才能评论

评论列表(0条)

保存