如何在Linux中使用Ping命令

下载PDF文件下载PDF文件

本文教你如何使用“ping”命令来测试Linux电脑和另一台电脑之间的连接。你还可以使用一种叫做“traceroute”的更高级的“ping”命令,以便查看电脑请求被路由到其他电脑地址的不同IP地址。

方法 1
方法 1 的 2:

使用Ping命令

下载PDF文件
  1. How.com.vn 中文: Step 1 打开电脑的“终端”。
    点击或双击“终端”应用图标——图标类似于一个黑框,里面有一个白色的“>_”,或者同时按Ctrl+Alt+T
  2. How.com.vn 中文: Step 2 输入“ping”命令。
    输入ping,然后输入要ping的网站地址或IP地址。
    • 例如,要ping Facebook网站,你需要输入ping www.facebook.com
  3. How.com.vn 中文: Step 3 按Enter。
    这样将会运行“ping”命令,并开始向这个地址发送请求。
  4. How.com.vn 中文: Step 4 查看ping速度。
    在出现的每一行的右端,你会看到一个数字,后面跟着“ms”;这是目标电脑响应你的数据请求所需的毫秒数。
    • 数字越小,你的电脑与其他电脑或网站之间的连接速度就越快。
    • 当你在终端ping网页地址时,第二行显示你正在ping的站点的IP地址。你可以用它来ping网站而不是IP地址。
  5. How.com.vn 中文: Step 5 停止ping。
    “ping”命令会一直运行;要想停止ping,按Ctrl+C。这样会让命令停止运行,并在“^C”行下面显示ping的结果。
    • 要查看另一台电脑响应的平均时间,查看“#数据包传输、#数据包接收”部分下面一行中第一个斜杠(/)后面的数字。
    广告
方法 2
方法 2 的 2:

使用Traceroute命令

下载PDF文件
  1. How.com.vn 中文: Step 1 打开电脑上的“终端”。
    点击或双击“终端”应用图标——图标类似于一个黑框,里面有一个白色的“>_”,或者同时按Ctrl+Alt+T
  2. How.com.vn 中文: Step 2 输入“traceroute”命令。
    输入traceroute,然后输入要追踪的网站地址或IP地址。
    • 例如,要追踪从路由器到Facebook服务器的路由,需要输入以下命令traceroute www.facebook.com
  3. How.com.vn 中文: Step 3 按Enter。
    这样就会运行“traceroute”命令。
  4. How.com.vn 中文: Step 4 查看你的请求所采用的路由。
    在出现的每一行左侧,你应该能看到处理追踪请求的路由器的IP地址。你还可以在这条线的右端看到这个过程所花费的毫秒数。
    • 如果你看到其中一条路由出现了星号行,这说明你的电脑本该连接的服务器超时了,从而导致尝试另一个地址。
    • Traceroute命令在数据抵达目的地后会超时。
    广告

小提示

  • 本文所写的“ping”命令可以完全照搬到Windows 上的“命令提示符”和Mac上的“终端”上使用。
广告

警告

  • 不是所有的网站都允许你ping他们的真实地址,所以你ping的结果可能并不总是准确的。
广告

关于本How.com.vn

How.com.vn 中文: How.com.vn员工
共同创作者是 :
How.com.vn专职作家
这篇文章由我们训练有素的编辑和研究团队共同创作,他们对文章的准确性和全面性进行了验证。

How.com.vn的内容管理团队会严密监督编辑人员的工作,确保每篇文章都符合我们的高质量标准要求。 这篇文章已经被读过9,884次。
本页面已经被访问过9,884次。

这篇文章对你有帮助吗?

⚠️ Disclaimer:

Content from Wiki How 中文 language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

Notices:
  • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
  • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
  • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
  • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

广告