{"id":54,"date":"2025-03-03T06:51:48","date_gmt":"2025-03-02T22:51:48","guid":{"rendered":"https:\/\/coiio.eu.org\/?p=54"},"modified":"2025-03-03T06:58:42","modified_gmt":"2025-03-02T22:58:42","slug":"%e4%bb%8e%e4%b8%80%e5%8f%b0%e4%b8%bb%e6%9c%baping%e5%8f%a6%e5%a4%96%e4%b8%80%e5%8f%b0%e4%b8%bb%e6%9c%ba%e7%9a%84%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/coiio.eu.org\/?p=54","title":{"rendered":"\u4ece\u4e00\u53f0\u4e3b\u673aping\u53e6\u5916\u4e00\u53f0\u4e3b\u673a\u7684\u8fc7\u7a0b"},"content":{"rendered":"<p>\u5f53\u4e00\u53f0\u4e3b\u673a\uff08\u4f8b\u5982A\uff09<code>ping<\/code> \u53e6\u4e00\u53f0\u4e3b\u673a\uff08\u4f8b\u5982B\uff09\u65f6\uff0c\u6574\u4e2a\u8fc7\u7a0b\u6d89\u53ca\u591a\u4e2a\u7f51\u7edc\u534f\u8bae\u548c\u6b65\u9aa4\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u6d41\u7a0b\uff1a<\/p>\n<hr \/>\n<h3><strong>1. \u89e3\u6790\u76ee\u6807IP\u5730\u5740<\/strong><\/h3>\n<p>\u5982\u679cA\u4f7f\u7528\u7684\u662fB\u7684\u4e3b\u673a\u540d\uff08\u5982<code>ping example.com<\/code>\uff09\uff0c\u9996\u5148\u9700\u8981\u89e3\u6790\u5176IP\u5730\u5740\uff1a<\/p>\n<ul>\n<li>A\u4f1a\u67e5\u8be2\u672c\u5730DNS\u7f13\u5b58\u3002<\/li>\n<li>\u5982\u679c\u7f13\u5b58\u6ca1\u6709\u5bf9\u5e94\u8bb0\u5f55\uff0cA\u4f1a\u5411DNS\u670d\u52a1\u5668\u53d1\u9001DNS\u67e5\u8be2\u8bf7\u6c42\uff0c\u83b7\u53d6B\u7684IP\u5730\u5740\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>2. \u751f\u6210ICMP\u8bf7\u6c42<\/strong><\/h3>\n<ul>\n<li><code>ping<\/code> \u4f7f\u7528 <strong>ICMP\uff08Internet Control Message Protocol\uff0c\u4e92\u8054\u7f51\u63a7\u5236\u62a5\u6587\u534f\u8bae\uff09<\/strong>\uff0c\u4f1a\u751f\u6210 <strong>ICMP Echo Request<\/strong>\uff08\u56de\u663e\u8bf7\u6c42\uff09\u62a5\u6587\u3002<\/li>\n<li>\u8be5\u62a5\u6587\u5305\u542b\uff1a\n<ul>\n<li>ICMP\u7c7b\u578b\uff1a<code>8<\/code>\uff08Echo Request\uff09<\/li>\n<li>ICMP\u6807\u8bc6\u7b26\u3001\u5e8f\u5217\u53f7\uff08\u7528\u4e8e\u5339\u914d\u8bf7\u6c42\u548c\u56de\u590d\uff09<\/li>\n<li>\u53ef\u9009\u7684\u8d1f\u8f7d\u6570\u636e\uff08\u7528\u4e8e\u8ba1\u7b97RTT\uff09<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>3. \u67e5\u627e\u76ee\u6807MAC\u5730\u5740\uff08ARP\u89e3\u6790\uff09<\/strong><\/h3>\n<p>\u5728\u53d1\u9001ICMP\u8bf7\u6c42\u4e4b\u524d\uff0cA\u9700\u8981\u77e5\u9053B\u7684MAC\u5730\u5740\uff1a<\/p>\n<ul>\n<li>A\u68c0\u67e5\u672c\u5730ARP\u7f13\u5b58\u662f\u5426\u5df2\u6709B\u7684MAC\u5730\u5740\u3002<\/li>\n<li>\u5982\u679c\u6ca1\u6709\uff0cA\u4f1a\u53d1\u9001 <strong>ARP\u8bf7\u6c42<\/strong>\uff08\u5e7f\u64ad\uff09\uff1a\n<ul>\n<li>\u6e90IP\uff1aA\u7684IP<\/li>\n<li>\u76ee\u6807IP\uff1aB\u7684IP<\/li>\n<li>\u76ee\u6807MAC\uff1a<code>FF:FF:FF:FF:FF:FF<\/code>\uff08\u5e7f\u64ad\uff09<\/li>\n<\/ul>\n<\/li>\n<li>B\u6536\u5230ARP\u8bf7\u6c42\u540e\uff0c\u53d1\u9001 <strong>ARP\u54cd\u5e94<\/strong>\uff0c\u544a\u8bc9A\u5b83\u7684MAC\u5730\u5740\u3002<\/li>\n<li>A\u7f13\u5b58B\u7684MAC\u5730\u5740\uff0c\u4ee5\u5907\u540e\u7eed\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<p>\uff08\u26a0\ufe0f \u5982\u679cA\u548cB\u4e0d\u5728\u540c\u4e00\u7f51\u6bb5\uff0cA\u9700\u8981\u5411\u7f51\u5173\u53d1\u9001ARP\u8bf7\u6c42\uff0c\u83b7\u53d6\u7f51\u5173\u7684MAC\u5730\u5740\uff0c\u7136\u540e\u901a\u8fc7\u7f51\u5173\u8f6c\u53d1ICMP\u62a5\u6587\u3002\uff09<\/p>\n<hr \/>\n<h3><strong>4. \u53d1\u9001ICMP Echo Request<\/strong><\/h3>\n<p>A\u6784\u9020ICMP\u6570\u636e\u5305\uff0c\u5e76\u5c01\u88c5\u5728IP\u6570\u636e\u62a5\u4e2d\uff1a<\/p>\n<ul>\n<li><strong>\u6570\u636e\u94fe\u8def\u5c42<\/strong>\uff08Ethernet\uff09\uff1a\n<ul>\n<li>\u6e90MAC\uff1aA\u7684MAC<\/li>\n<li>\u76ee\u6807MAC\uff1aB\u7684MAC\uff08\u6216\u7f51\u5173\u7684MAC\uff09<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7f51\u7edc\u5c42<\/strong>\uff08IP\uff09\uff1a\n<ul>\n<li>\u6e90IP\uff1aA\u7684IP<\/li>\n<li>\u76ee\u6807IP\uff1aB\u7684IP<\/li>\n<li>\u534f\u8bae\uff1aICMP<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u4f20\u8f93\u5c42<\/strong>\uff1aICMP\u4e0d\u4f9d\u8d56TCP\/UDP\uff0c\u76f4\u63a5\u5728IP\u4e0a\u627f\u8f7d\u3002<\/li>\n<li><strong>\u5e94\u7528\u5c42<\/strong>\uff1a\u65e0\u7279\u6b8a\u5e94\u7528\u5c42\u534f\u8bae\uff0c\u76f4\u63a5\u7531<code>ping<\/code>\u5de5\u5177\u53d1\u9001ICMP\u8bf7\u6c42\u3002<\/li>\n<\/ul>\n<p>A\u53d1\u9001\u8be5\u6570\u636e\u5305\u5230\u7f51\u7edc\u3002<\/p>\n<hr \/>\n<h3><strong>5. \u76ee\u6807\u4e3b\u673aB\u63a5\u6536ICMP\u8bf7\u6c42\u5e76\u5904\u7406<\/strong><\/h3>\n<ul>\n<li>B\u7684\u7f51\u5361\u63a5\u6536\u6570\u636e\u5305\uff0c\u68c0\u67e5\u76ee\u6807MAC\u5730\u5740\u662f\u5426\u5339\u914d\u81ea\u5df1\uff08\u6216\u7f51\u5173\uff09\u3002<\/li>\n<li>\u82e5\u5339\u914d\uff0cB\u7684\u64cd\u4f5c\u7cfb\u7edf\u89e3\u6790IP\u5305\uff0c\u53d1\u73b0\u662fICMP Echo Request\uff1a\n<ul>\n<li>\u68c0\u67e5ICMP\u62a5\u6587\u7ed3\u6784\u662f\u5426\u6b63\u786e\u3002<\/li>\n<li>\u751f\u6210 <strong>ICMP Echo Reply<\/strong>\uff08\u56de\u663e\u5e94\u7b54\uff09\uff1a\n<ul>\n<li>\u7c7b\u578b\uff1a<code>0<\/code>\uff08Echo Reply\uff09<\/li>\n<li>\u590d\u5236\u539f\u59cb\u6570\u636e\u5e76\u56de\u4f20\u7ed9A\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>6. \u76ee\u6807\u4e3b\u673aB\u53d1\u9001ICMP Echo Reply<\/strong><\/h3>\n<p>B\u5c01\u88c5ICMP\u56de\u663e\u5e94\u7b54\uff0c\u5e76\u6309\u7167\u7c7b\u4f3c\u7684\u65b9\u5f0f\u8fd4\u56de\uff1a<\/p>\n<ul>\n<li>\u76ee\u6807IP\uff1aA\u7684IP<\/li>\n<li>\u76ee\u6807MAC\uff1aA\u7684MAC\uff08\u82e5\u8de8\u7f51\u6bb5\uff0c\u5219\u901a\u8fc7\u7f51\u5173\uff09<\/li>\n<\/ul>\n<p>\u6570\u636e\u5305\u901a\u8fc7\u7f51\u7edc\u8fd4\u56deA\u3002<\/p>\n<hr \/>\n<h3><strong>7. A\u63a5\u6536ICMP Echo Reply \u5e76\u8ba1\u7b97RTT<\/strong><\/h3>\n<ul>\n<li>A\u7684\u7f51\u5361\u63a5\u6536\u5230ICMP Echo Reply\u3002<\/li>\n<li>\u64cd\u4f5c\u7cfb\u7edf\u5339\u914d\u8bf7\u6c42\u7684\u6807\u8bc6\u7b26\u548c\u5e8f\u5217\u53f7\uff0c\u8ba1\u7b97\u5f80\u8fd4\u65f6\u95f4\uff08RTT\uff09\u3002<\/li>\n<li><code>ping<\/code> \u5de5\u5177\u663e\u793a\u54cd\u5e94\u65f6\u95f4\u3001TTL\u7b49\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>8. \u7ed3\u675f\u6216\u7ee7\u7eed<\/strong><\/h3>\n<ul>\n<li><code>ping<\/code> \u9ed8\u8ba4\u4f1a\u8fde\u7eed\u53d1\u9001\u591a\u4e2aICMP\u8bf7\u6c42\uff08\u901a\u5e38\u95f4\u96941\u79d2\uff09\u3002<\/li>\n<li>\u82e5B\u672a\u54cd\u5e94\uff0c<code>ping<\/code> \u4f1a\u663e\u793a <strong>\u8bf7\u6c42\u8d85\u65f6\uff08Request Timeout\uff09<\/strong>\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3><strong>\u603b\u7ed3<\/strong><\/h3>\n<p><code>ping<\/code> \u7684\u5b8c\u6574\u8fc7\u7a0b\uff1a<\/p>\n<ol>\n<li><strong>DNS\u89e3\u6790<\/strong>\uff08\u82e5\u8f93\u5165\u7684\u662f\u4e3b\u673a\u540d\uff09\u3002<\/li>\n<li><strong>ARP\u89e3\u6790<\/strong>\uff08\u83b7\u53d6\u76ee\u6807MAC\u5730\u5740\uff09\u3002<\/li>\n<li><strong>\u53d1\u9001ICMP Echo Request<\/strong>\uff08A \u2192 B\uff09\u3002<\/li>\n<li><strong>B\u89e3\u6790\u5e76\u56de\u590d ICMP Echo Reply<\/strong>\uff08B \u2192 A\uff09\u3002<\/li>\n<li><strong>A\u8ba1\u7b97RTT\uff0c\u663e\u793a\u7ed3\u679c<\/strong>\u3002<\/li>\n<\/ol>\n<p>\u5728\u590d\u6742\u7f51\u7edc\u73af\u5883\u4e0b\uff0c\u8fd8\u53ef\u80fd\u6d89\u53ca <strong>\u7f51\u5173\u8f6c\u53d1<\/strong>\u3001<strong>ICMP\u4e0d\u53ef\u8fbe\u62a5\u6587<\/strong>\uff08\u5982<code>Destination Host Unreachable<\/code>\uff09\u3001<strong>TTL\u9650\u5236<\/strong>\u7b49\u60c5\u51b5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u4e00\u53f0\u4e3b\u673a\uff08\u4f8b\u5982A\uff09ping \u53e6\u4e00\u53f0\u4e3b\u673a\uff08\u4f8b\u5982B\uff09\u65f6\uff0c\u6574\u4e2a\u8fc7\u7a0b\u6d89\u53ca\u591a\u4e2a\u7f51\u7edc\u534f\u8bae\u548c\u6b65\u9aa4\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u6d41\u7a0b\uff1a 1. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-networking"],"_links":{"self":[{"href":"https:\/\/coiio.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coiio.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coiio.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coiio.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coiio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54"}],"version-history":[{"count":1,"href":"https:\/\/coiio.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions"}],"predecessor-version":[{"id":55,"href":"https:\/\/coiio.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions\/55"}],"wp:attachment":[{"href":"https:\/\/coiio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coiio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coiio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}