2019-04-21 11:50:48 +08:00

37 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="ping">ping</h1>
<p>测试主机之间网络的连通性</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>ping命令</strong> 用来测试主机之间网络的连通性。执行ping指令会使用ICMP传输协议发出要求回应的信息若远端主机的网络功能没有问题就会回应该信息因而得知该主机运作正常。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">ping(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-d使用Socket的SO_DEBUG功能
-c&lt;完成次数&gt;:设置完成要求回应的次数;
-f极限检测
-i&lt;间隔秒数&gt;:指定收发信息的间隔时间;
-I&lt;网络界面&gt;:使用指定的网络界面送出数据包;
-l&lt;前置载入&gt;:设置在送出要求信息之前,先行发出的数据包;
-n只输出数值
-p&lt;范本样式&gt;:设置填满数据包的范本样式;
-q不显示指令执行过程开头和结尾的相关信息除外
-r忽略普通的Routing Table直接将数据包送到远端主机上
-R记录路由过程
-s&lt;数据包大小&gt;:设置数据包的大小;
-t&lt;存活数值&gt;设置存活数值TTL的大小
-v详细显示指令的执行过程。</code></pre>
<h3 id="参数">参数</h3>
<p>目的主机指定发送ICMP报文的目的主机。</p>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">[root@AY1307311912260196fcZ ~]# ping www.jsdig.com
PING host.1.jsdig.com (100.42.212.8) 56(84) bytes of data.
64 bytes from 100-42-212-8.static.webnx.com (100.42.212.8): icmp_seq=1 ttl=50 time=177 ms
64 bytes from 100-42-212-8.static.webnx.com (100.42.212.8): icmp_seq=2 ttl=50 time=178 ms
64 bytes from 100-42-212-8.static.webnx.com (100.42.212.8): icmp_seq=3 ttl=50 time=174 ms
64 bytes from 100-42-212-8.static.webnx.com (100.42.212.8): icmp_seq=4 ttl=50 time=177 ms
...按Ctrl+C结束
--- host.1.jsdig.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2998ms
rtt min/avg/max/mdev = 174.068/176.916/178.182/1.683 ms</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->