目录

  • ping
    • 简介
    • 使用
  • tcping
    • 简介
    • 下载
    • 使用
  • 总结

ping

简介

ping (Packet Internet Groper)是一种英特网包探索器,用于测试网络连接量的程序 。Ping是工作在TCP/IP网络体系结构中应用层的一个服务命令, 主要是向特定的目的主机发送ICMP(Internet Control Message Protocol 因特网报文控制协议)Echo请求报文,测试目的站是否可达及了解其有关状态。ping用于确定本地主机是否能与另一台主机成功交换(发送与接收)数据包,再根据返回的信息,就可以推断TCP/IP参数是否设置正确,以及运行是否正常、网络是否通畅等。

Ping命令可以进行以下操作

  • 通过将ICMP并侦听回显回复数据包来验证与一台或多台远程计算机的连接
  • 每个发送的数据包最多等待一秒
  • 打印已传输和接收的数据包数

需要注意的是,Ping成功并不一定就代表TCP/IP配置正确,有可能还要执行大量的本地主机与远程主机的数据包交换,才能确信TCP/IP配置的正确性。如果执行ping成功而网络仍无法使用,那么问题很可能出在网络系统的软件配置方面,ping成功只保证当前主机与目的主机间存在一条连通的物理路径。


使用

用法

ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS][-r count] [-s count] [[-j host-list] | [-k host-list]][-w timeout] [-R] [-S srcaddr] [-c compartment] [-p][-4] [-6] target_name

选项

选项 描述
-t Ping 指定的主机,直到停止。若要查看统计信息并继续操作,请键入 Ctrl+Break;若要停止,请键入 Ctrl+C。
-a 将地址解析为主机名。
-n count 要发送的回显请求数。
-l size 发送缓冲区大小。
-f 在数据包中设置“不分段”标记(仅适用于 IPv4)。
-i TTL 生存时间。
-v TOS 服务类型(仅适用于 IPv4。该设置已被弃用,对 IP 标头中的服务类型字段没有任何影响)。
-r count 记录计数跃点的路由(仅适用于 IPv4)。
-s count 计数跃点的时间戳(仅适用于 IPv4)。
-j host-list 与主机列表一起使用的松散源路由(仅适用于 IPv4)。
-k host-list 与主机列表一起使用的严格源路由(仅适用于 IPv4)。
-w timeout 等待每次回复的超时时间(毫秒)。
-R 同样使用路由标头测试反向路由(仅适用于 IPv6)。根据 RFC 5095,已弃用此路由标头。如果使用此标头,某些系统可能丢弃回显请求。
-S srcaddr 要使用的源地址。
-c compartment 路由隔离舱标识符。
-p Ping Hyper-V 网络虚拟化提供程序地址。
-4 强制使用 IPv4。
-6 强制使用 IPv6。

示例

  • ping ip 端口(ICMP协议是属于ip层协议,通信不需要端口所以无法测试 tcp udp 运输层的端口)
ping www.baidu.com 80

结果:

错误的参数 80。
  • ping ip
ping www.baidu.com

结果:

正在 Ping www.a.shifen.com [14.215.177.39] 具有 32 字节的数据:
来自 14.215.177.39 的回复: 字节=32 时间=92ms TTL=52
来自 14.215.177.39 的回复: 字节=32 时间=89ms TTL=52
来自 14.215.177.39 的回复: 字节=32 时间=92ms TTL=52
来自 14.215.177.39 的回复: 字节=32 时间=94ms TTL=5214.215.177.39 的 Ping 统计信息:数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):最短 = 89ms,最长 = 94ms,平均 = 91ms

-选项 后的字段都是需要填入值的

  • ping -n count(要发送的回显请求数)
ping -n 7 www.baidu.com

结果:

正在 Ping www.a.shifen.com [14.215.177.38] 具有 32 字节的数据:
来自 14.215.177.38 的回复: 字节=32 时间=107ms TTL=52
来自 14.215.177.38 的回复: 字节=32 时间=76ms TTL=52
来自 14.215.177.38 的回复: 字节=32 时间=121ms TTL=52
来自 14.215.177.38 的回复: 字节=32 时间=122ms TTL=52
来自 14.215.177.38 的回复: 字节=32 时间=179ms TTL=52
来自 14.215.177.38 的回复: 字节=32 时间=78ms TTL=52
来自 14.215.177.38 的回复: 字节=32 时间=83ms TTL=5214.215.177.38 的 Ping 统计信息:数据包: 已发送 = 7,已接收 = 7,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):最短 = 76ms,最长 = 179ms,平均 = 109ms
  • ping -l size(发送缓冲区大小)
ping -l 666 www.baidu.com

结果:

正在 Ping www.a.shifen.com [14.215.177.38] 具有 666 字节的数据:
来自 14.215.177.38 的回复: 字节=666 时间=95ms TTL=52
来自 14.215.177.38 的回复: 字节=666 时间=124ms TTL=52
来自 14.215.177.38 的回复: 字节=666 时间=99ms TTL=52
来自 14.215.177.38 的回复: 字节=666 时间=90ms TTL=5214.215.177.38 的 Ping 统计信息:数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):最短 = 90ms,最长 = 124ms,平均 = 102ms

tcping

简介

tcping(Transmission Control Packet Internet Groper)命令使用TCP传输层协议,可以检测IP端口状态和查看ping值,即使服务器禁 ping 也可以通过 tcping 来监控服务器网络状态。如果没有通过服务器端口,则默认为80。

tcping命令可操作

  • 可以在对方阻止ping的情况下探测指定端口的连通性
  • 可以检测IP端口状态和查看ping 值
  • 使用TCP协议进行数据连通性检测的程序

下载

tcping下载

下载后放到目录:C:\Windows\System32,这样就可以在任意路径下运行tcping命令了,ping也是在这个目录下,两者不影响。之后按下win+r输入cmd,打开控制台,输入tcping,如果输出帮助文档,则表示成功


使用

用法

tcping [-t] [-d] [-i interval] [-n times] [-w ms] [-b n] [-r times] [-s] [-v] [-j] [-js size] [-4] [-6] [-c] [-g count] [-S source_address] [--file] [--tee filename] [-h] [-u] [--post] [--head] [--proxy-port port] [--proxy-server server] [--proxy-credentials username:password] [-f] server-address [server-port]

选项

选项
-t ping continuously until stopped via control-c(持续Ping直到通过Ctrl-c停止)
-n 5 for instance, send 5 pings(例如,发送5个tcping)
-i 5 for instance, ping every 5 seconds(例如,每5秒tcping一次)
-w 0.5 for instance, wait 0.5 seconds for a response(例如,等待响应0.5秒)
-d include date and time on each line(每行包括日期和时间)
-b 1 enable beeps (1 for on-down, 2 for on-up, 3 for on-change, 4 for always)(启用哔哔声(1为关机,2为开机,3为重启,4为始终))
-r 5 for instance, relookup the hostname every 5 pings(例如,每5次tcping就重新查找主机名)
-s automatically exit on a successful ping(在tcping成功时自动退出)
-v print version and exit(打印版本并退出)
-j include jitter, using default rolling average(包括抖动,使用默认滚动平均)
-js 5 include jitter, with a rolling average size of (for instance) 5.(包括抖动,滚动平均大小为(例如)5。)
–tee mirror output to a filename specified after ‘–tee’(镜像输出到’——tee’之后指定的文件名)
–append Append to the --tee filename rather than overwriting it(追加到——tee文件名,而不是覆盖它)
-4 prefer ipv4(优先ipv4)
-6 prefer ipv6(优先ipv6)
-c only show an output line on changed state(只显示已更改状态的输出行)
–file treat the “server-address” as a filename instead, loop through file line by line Note: --file is incompatible with options such as -j and -c as it is looping through different targets Optionally accepts server-port. For example, “example.org 443” is valid. Alternately, use -p to force a port at command line for everything in the file.(注意:——file与选项如-j和-c不兼容,因为它是循环通过不同的目标可选地接受服务器端口。例如,“example.org 443”有效。另外,使用-p强制在命令行为文件中的所有内容设置端口。)
-g 5 for instance, give up if we fail 5 times in a row(例如,如果我们连续失败5次,就放弃)
-S _X_ Specify source address X. Source must be a valid IP for the client computer.(指定源地址_X_。源必须是客户端计算机的有效IP。)
-p _X_ Alternate method to specify port(另一种指定端口的方法)
–fqdn Print domain name on each line if available(如果可以,在每一行打印域名)
–ansi Use ANSI color sequences (cygwin)(使用ANSI颜色序列(cygwin))
–color Use Windows color sequences(使用Windows颜色序列)

HTTP选项

HTTP选项 描述
-h HTTP mode (use url without http:// for server-address)(HTTP模式(使用url,不使用http://作为服务器地址))
-u include target URL on each line(每行包含目标URL)
–post use POST rather than GET (may avoid caching)(使用POST而不是GET(可以避免缓存))
–head use HEAD rather than GET(使用HEAD而不是GET)
–proxy-server specify a proxy server(指定代理服务器)
–proxy-port specify a proxy port(指定代理端口)
–proxy-credentials specify ‘Proxy-Authorization: Basic’ header in format username:password(指定“代理授权:基本”头,格式为用户名:密码)

调试选项

调试选项 描述
-f force tcping to send at least one byte(强制tcp至少发送一个字节)
–header include a header with original args and date. Implied if using --tee.(包含一个带有原始参数和日期的标题。如果使用——tee则暗示)
–block 使用“阻塞”套接字进行连接。这将阻止-w工作并使用默认超时(在我的例子中长达20秒)。然而,它可以主动检测拒绝连接与超时。

示例

  • tcping ip 端口
tcping www.baidu.com 80

结果:

Probing 14.215.177.38:80/tcp - Port is open - time=104.043ms
Probing 14.215.177.38:80/tcp - Port is open - time=95.994ms
Probing 14.215.177.38:80/tcp - Port is open - time=99.670ms
Probing 14.215.177.38:80/tcp - Port is open - time=105.977msPing statistics for 14.215.177.38:804 probes sent.4 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 95.994ms, Maximum = 105.977ms, Average = 101.421ms
  • tcping -t ip(一直检测,Ctrll+C停止)
tcping -t www.baidu.com 80

结果:

** Pinging continuously.  Press control-c to stop **Probing 14.215.177.38:80/tcp - Port is open - time=85.118ms
Probing 14.215.177.38:80/tcp - Port is open - time=84.338ms
Probing 14.215.177.38:80/tcp - Port is open - time=82.035ms
Probing 14.215.177.38:80/tcp - Port is open - time=86.691ms
Probing 14.215.177.38:80/tcp - Port is open - time=104.070ms
Probing 14.215.177.38:80/tcp - Port is open - time=122.593ms
Probing 14.215.177.38:80/tcp - Port is open - time=163.882ms
Probing 14.215.177.38:80/tcp - Port is open - time=106.062ms
Probing 14.215.177.38:80/tcp - Port is open - time=242.789ms
Probing 14.215.177.38:80/tcp - Port is open - time=91.095ms
Probing 14.215.177.38:80/tcp - Port is open - time=118.070ms
Probing 14.215.177.38:80/tcp - Port is open - time=131.803ms
Probing 14.215.177.38:80/tcp - Port is open - time=171.199ms
Probing 14.215.177.38:80/tcp - Port is open - time=94.432ms
Probing 14.215.177.38:80/tcp - Port is open - time=170.511ms
Control-CPing statistics for 14.215.177.38:8015 probes sent.15 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 82.035ms, Maximum = 242.789ms, Average = 123.646ms
  • tcping --fqdn www.baidu.com 80(每一行打印域名)
tcping --fqdn www.baidu.com 80

结果:

Probing www.baidu.com:80/tcp - Port is open - time=89.863ms
Probing www.baidu.com:80/tcp - Port is open - time=97.284ms
Probing www.baidu.com:80/tcp - Port is open - time=222.348ms
Probing www.baidu.com:80/tcp - Port is open - time=86.891msPing statistics for 14.215.177.38:804 probes sent.4 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 86.891ms, Maximum = 222.348ms, Average = 124.096ms
  • tcping -n 5 www.baidu.com 80(发送5个tcping)
tcping -n 5 www.baidu.com 80

结果:

Probing 14.215.177.38:80/tcp - Port is open - time=88.883ms
Probing 14.215.177.38:80/tcp - Port is open - time=88.871ms
Probing 14.215.177.38:80/tcp - Port is open - time=85.013ms
Probing 14.215.177.38:80/tcp - Port is open - time=81.591ms
Probing 14.215.177.38:80/tcp - Port is open - time=90.829msPing statistics for 14.215.177.38:805 probes sent.5 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 81.591ms, Maximum = 90.829ms, Average = 87.037ms
  • tcping -w 3 www.baidu.com 80(等待响应3秒)
tcping -w 3 www.baidu.com 80

结果:

Probing 14.215.177.39:80/tcp - Port is open - time=89.445ms
Probing 14.215.177.39:80/tcp - Port is open - time=91.247ms
Probing 14.215.177.39:80/tcp - Port is open - time=94.874ms
Probing 14.215.177.39:80/tcp - Port is open - time=81.502msPing statistics for 14.215.177.39:804 probes sent.4 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 81.502ms, Maximum = 94.874ms, Average = 89.267ms
  • tcping -h www.baidu.com 80(使用HTTP模式url)
tcping -h www.baidu.com 80

结果:

Probing 14.215.177.39:80/tcp - HTTP is open - time=99.764ms rcv_time=96.177 status=200 bytes=8102 kbit/s=~673.926
Probing 14.215.177.39:80/tcp - HTTP is open - time=86.338ms rcv_time=98.719 status=200 bytes=8102 kbit/s=~656.569
Probing 14.215.177.39:80/tcp - HTTP is open - time=77.414ms rcv_time=92.856 status=200 bytes=8102 kbit/s=~698.024
Probing 14.215.177.39:80/tcp - HTTP is open - time=80.852ms rcv_time=93.861 status=200 bytes=8102 kbit/s=~690.555Ping statistics for 14.215.177.39:804 probes sent.4 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 77.414ms, Maximum = 99.764ms, Average = 86.092ms
Approximate download times in milli-seconds:Minimum = 92.856ms, Maximum = 98.719ms, Average = 95.403ms
  • tcping --block www.baidu.com 80(检测连接与超时)
tcping --block www.baidu.com 80

结果:

Probing 14.215.177.39:80/tcp - Port is open - time=82.162ms
Probing 14.215.177.39:80/tcp - Port is open - time=138.086ms
Probing 14.215.177.39:80/tcp - Port is open - time=110.414ms
Probing 14.215.177.39:80/tcp - Port is open - time=105.083msPing statistics for 14.215.177.39:804 probes sent.4 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:Minimum = 82.162ms, Maximum = 138.086ms, Average = 108.936ms

总结

以上就是关于ping和tcping的相关知识了,其实平时项目部署过程中用的比较多的还是端口监测,可以用来检测项目是否运行。
有问题可以评论区留言,看到第一时间回复,感谢支持!


猿创征文|【实用工具tcping】ping tcping的区别,使用命令,超全超详细使用手册(建议收藏)相关推荐

  1. 猿创征文|工具百宝箱-代码编辑器-版本控制工具-终端神器-项目与事务跟踪工具-SFTP客户端

    工具没有绝对意义上的好坏之分,只有需求适合与否,这些需求可能包括:功能.价格.安全.服务.技术等诸多方面. 技术在更新迭代,开发者工具也在更新迭代.一个高效趁手的工具在工作上锦上添花.给大家推荐一下我 ...

  2. 猿创征文|工具百宝箱-编辑器-笔记工具-日常小工具-原型设计工具

    这篇文主要介绍了开发者工具之外的一些日常小工具,我用这些小工具主要完成什么工作.分享给大家 官方活动入口:「猿创征文 」第四季 | 2022 年我的开发者工具 猿创征文|工具百宝箱-代码编辑器-版本控 ...

  3. 猿创征文 | linux 工具yum和vim

    目录 linux 工具 yum 什么是yum 怎么使用这个工具呢? 查找包 vim **1. vim的基本概念** **2. vim的基本操作** 3.vim配置 **配置文件的位置** 举例代码 举 ...

  4. 猿创征文|工具虽小,五脏俱全(这些年常用的开发者小工具)

  5. 猿创征文 | Linux运维工程师的10个日常使用工具分享

    猿创征文 | Linux运维工程师的10个日常使用工具分享 一.本次分享工具导航 二.Adminer数据库管理工具 1.Adminer介绍 2.Adminer的特点 3.Adminer的使用 4.Ad ...

  6. 猿创征文 | DevOps运维的10个日常使用工具分享

    猿创征文 | DevOps运维的10个日常使用工具分享 一.DevOps介绍 1.DevOps的简介 2.个人分享的10个工具导航 二.jenkins 1.jenkins介绍 2.jenkins的优点 ...

  7. 猿创征文 | 国产数据实战之docker部署MyWebSQL数据库管理工具

    猿创征文 | 国产数据实战之docker部署MyWebSQL数据库管理工具 一.MyWebSQL介绍 1.MyWebSQL简介 2.MyWebSQL特点 二.检查本地环境 1.检查docker状态 2 ...

  8. 猿创征文|2022 年我的开发者工具

    猿创征文|2022 年我的开发者工具 文章目录 猿创征文|2022 年我的开发者工具 摘要 版本控制工具-Github Github Desktop git-cola SSH工具-X Shell 7 ...

  9. 猿创征文|六年一日,我的焚膏继晷之路

    猿创征文|我在Python领域的焚膏继晷之路 一.自我介绍 二.我和师父的机缘 三.拜师 or 闹剧? 四.我在CSDN的收获 五.关于我的学习 六.我的憧憬 一.自我介绍 大家好,我是 热爱科技的刘 ...

  10. 猿创征文 | 开箱即用 yyg-cli:快速创建 vue3 组件库和vue3 全家桶项目

    1 yyg-cli 是什么 yyg-cli 是优雅哥开发的快速创建 vue3 项目的脚手架.在 npm 上发布了两个月,11月1日进行了大升级,发布 1.1.0 版本:支持创建 vue3 全家桶项目和 ...

最新文章

  1. mysql kill 脚本_批量 kill mysql 中运行时间长的sql
  2. Spark配置属性详解
  3. C# 参数签名字符串按 ASCII码排序,注意其中的坑
  4. 【HDU - 6514】Monitor(二维差分,前缀和)
  5. Spring Boot整合Servlet,Filter,Listener,访问静态资源
  6. Linux C/C++开发环境搭建指针
  7. 阅读笔记——《R数据可视化手册》肖楠等;主要ggplot2
  8. 190106每日一句
  9. Matlab仿真信号检测实验---基于贝叶斯准则的二元信号检测
  10. Mac下移动硬盘的使用
  11. 2021年9月国产数据库大事记-墨天轮
  12. 小米下拉导航栏,36kr 下拉导航栏解决方法
  13. 计算机一级网络题连接网络,计算机一级MSOffice模拟试题及答案
  14. 云计算HCIA学习笔记-云计算基础概念
  15. 罗技 Logitech flow 连接
  16. 2019-1-5-问答-产品经理有哪些细分领域,对应特点是什么?
  17. L Javabeans
  18. 金立android怎么升级到7.o,金立手机怎么刷机?只需七步轻松刷机
  19. 【平面设计】AI CS 6 软件安装教程
  20. 排序算法(冒泡排序)

热门文章

  1. linux crontab清理脚本,crontab定时清理日志
  2. Git命令提交项目代码
  3. 逍遥 android adb,逍遥模拟器 Android adb shell getprop获取系统信息
  4. android模拟器装包,逍遥模拟器如何安装本地应用包apk?
  5. 中国好同事!帮程序猿跟姑娘表白,他们组了一支乐队
  6. 优化 RxJS 改造示例
  7. 安装Win10之后如何进入BIOS
  8. 岁月无痕人有迹,时光无影人有踪
  9. 从键盘输入n个数 求其中的最大数
  10. 一文讲透商业智能BI 到底是什么[转]