端口通不通 telnet wget ssh
如何测试端口通不通(四种方法)
投稿:mrr
一般情况下使用"telnet ip port"判断端口通不通,其实测试方法不止这一种,还有很多种方法,下面小编给大家分享了几种方法,具体内容请往下看:
准备环境
启动一个web服务器,提供端口.
[wyq@localhost ~]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...
用其它web服务器提供端口也一样,由于python比较方便,这里就用它
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...
4、使用端口扫描工具
[root@localhost ~]# nmap ... -p
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
PORT STATE SERVICE
/tcp closed http
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
[root@localhost ~]# nmap ... -p
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
PORT STATE SERVICE
/tcp open http-proxy
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
[root@localhost ~]# nmap ...
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
Not shown: closed ports
PORT STATE SERVICE
/tcp open ssh
/tcp open rpcbind
/tcp open http-proxy
/tcp open unknown
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
总结
提供端口服务,则使用了tcp协议,上面是以web服务器为例。如果服务器是更简单的tcp服务器,三个工具同样适用.
三个工具的共同点是:1.以tcp协议为基础;2.能访问指定端口. 遵循这两点可以找到很多工具.
一般在windows下使用telnet比较方便,linux下个人就比较喜欢用wget.
端口通不通 telnet wget ssh的更多相关文章
- 批量telnet端口通不通
每读一行就运行一次telnet IP port #!/bin/bash port="22" cat *.txt | while read line do telnet ${line ...
- Linux服务器可以ping,但是telnet端口超时,网站wget超时,访问超时的解决办法
最近无法通过SSH连接Linux服务器,访问该服务器上的HTTP服务也出现异常.可以ping,但是telnet端口超时,网站wget超时,访问超时. 最后排查是内核配置问题 原来是 net.ipv4. ...
- linux远程登录(Telnet、SSH)
系统:RHEL 5.5 64位,使用CentOS的yum源并作更新处理 参考书目<Linux兵书>/电子工业出版社/刘丽霞,细节之处稍有变动. 一.Telnet(远程登录推荐SSH) 1. ...
- Telnet、SSH和VNC
以下内容出自<Red Hat Linux服务器配置与应用>第17章:Telnet.SSH和VNC服务的配置与应用.俗话说:“前人栽树,后人乘凉”.我懒得再照书本打一遍了,就从这里拷贝了一份 ...
- Telnet、SSH和VNC 区别
Telnet Telnet是进行远程登录的标准协议,它是当今Internet上应用最广泛的协议之一.它把用户正在使用的终 端或计算机变成网络某一远程主机的仿真终端,使得用户可以方便地使用远程主机上的软 ...
- Telnet和SSH
1. 协议用途 Telnet和SSH用于远程访问服务器的的两大常用协议.利用它们,我们可以管理并监控生产服务器和企业服务器,更新服务器内核,安装最新的软件包和补丁,能够远程登录服务器,开展软件开发.测 ...
- openstack 主机无法ping通instance,无法ssh到instance
https://docs.openstack.org/zh_CN/user-guide/cli-nova-configure-access-security-for-instances.html 好不 ...
- 教你如何暴力破解-telnet ftp ssh mysql mssql vnc 等
大家应该都知道暴力破解的原理,但却不知道遇见telnet和ftp等服务和数据库如何破解,今天小R就教大家如何利用一个工具就能对其破解. 今天要给大家介绍的工具是:hydra(中文名:九头蛇) 这个名听 ...
- Shell命令-网络操作之基础之telnet、ssh
文件及内容处理 - telnet.ssh 1. telnet:使用TELNET协议远程登录 telnet命令的功能说明 telnet 命令用于远端登入.执行 telnet 指令开启终端机阶段作业,并登 ...
随机推荐
- Python 全国考级二级
第1章 Python概述 [Python语言简介] Python是一种跨平台.开源.免费的解释型高级动态编程语言,是一种通用编程语言. Python支持命令式编程和函数式编程两种方式,并且完全支持面 ...
- 搜索栏UISearchBar的使用
本文结构: 1.首先是对UISearchBar的简介文字 2.初始化展现UISearchBar,并解析它的结构 3.属性.方法.代理等的一一介绍 4.日常的使用,包括单独对UISearchBar的配置 ...
- PyCharm破解安装方法
1.在3322下载站下好压缩包之后,直接点击安装文件“pycharm-professional-2018.1.exe”进行安装,默认点击“next”下一步进行操作2.选择文件所创建的位置.位置可以选择 ...
- 敌兵布阵-HDU1166 点修改+区间查询
题目:C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况 ...
- 吴裕雄--天生自然PYTHON爬虫:用API爬出天气预报信息
天气预报网址:https://id.heweather.com/,这个网站是需要注册获取一个个人认证后台密钥key的,并且每个人都有访问次数的限制,这个key就是访问API的钥匙. 这个key现在是要 ...
- B. Light bulbs
B. Light bulbs There are NNN light bulbs indexed from 000 to N−1N-1N−1. Initially, all of them are o ...
- day06 python 3中的编码
#python2 和 python3 的一些区别 ''' #python2 print('aaa') print'aaa' range() xrange()生成器 raw_input() #pytho ...
- ionic3记录之栅格布局使文字居中
{ display:flex; align-items:center; } 未完待续...
- 蓝桥杯java 迷宫
0101010100101100100101011001011010010000100010101000001000100000101010010000100000001001100110100101 ...
- Pytorch【直播】2019 年县域农业大脑AI挑战赛---初级准备(一)切图
比赛地址:https://tianchi.aliyun.com/competition/entrance/231717/introduction 这次比赛给的图非常大5万x5万,在训练之前必须要进行数 ...