{"id":51995,"date":"2024-12-03T08:47:44","date_gmt":"2024-12-03T00:47:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/51995\/"},"modified":"2024-12-03T08:47:44","modified_gmt":"2024-12-03T00:47:44","slug":"linux-arp%e6%9c%89%e4%bb%80%e4%b9%88%e4%bd%9c%e7%94%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/51995\/","title":{"rendered":"linux arp\u6709\u4ec0\u4e48\u4f5c\u7528"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>linux arp\u6709\u4ec0\u4e48\u4f5c\u7528<\/h1>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u7262\u56fa\u624e\u5b9e\u7684\u57fa\u7840\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u7c73\u4e91\u5c31\u6765\u5e26\u5927\u5bb6\u4e00\u70b9\u70b9\u7684\u638c\u63e1\u57fa\u7840\u77e5\u8bc6\u70b9\u3002\u4eca\u5929\u672c\u7bc7\u6587\u7ae0\u5e26\u5927\u5bb6\u4e86\u89e3\u300alinux arp\u6709\u4ec0\u4e48\u4f5c\u7528\u300b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u5feb\u70b9\u6536\u85cf\u8d77\u6765\u5427\uff0c\u5426\u5219\u9700\u8981\u65f6\u5c31\u627e\u4e0d\u5230\u4e86\uff01<\/p>\n<\/p>\n<blockquote>\n<p>linux arp\u4f5c\u7528\u662f\u7ba1\u7406\u7cfb\u7edf\u7684arp\u7f13\u51b2\u533a\uff0c\u5e76\u4e14\u53ef\u4ee5\u663e\u793a\u3001\u5220\u9664\u3001\u6dfb\u52a0\u9759\u6001mac\u5730\u5740\uff1bARP\u4ee5\u5404\u79cd\u65b9\u5f0f\u64cd\u7eb5\u5185\u6838\u7684ARP\u7f13\u5b58\uff0c\u4e3b\u8981\u9009\u9879\u662f\u6e05\u9664\u5730\u5740\u6620\u5c04\u9879\u5e76\u624b\u52a8\u8bbe\u7f6e\uff1b\u4e3a\u4e86\u8c03\u8bd5\u76ee\u7684\uff0cARP\u7a0b\u5e8f\u8fd8\u5141\u8bb8\u5bf9ARP\u7f13\u5b58\u8fdb\u884c\u5b8c\u5168\u8f6c\u50a8\u3002<\/p>\n<\/blockquote>\n<p><strong>arp<\/strong><\/p>\n<p>arp\u6307\u4ee4\u7528\u6765\u7ba1\u7406\u7cfb\u7edf\u7684arp\u7f13\u51b2\u533a\uff0c\u53ef\u4ee5\u663e\u793a\u3001\u5220\u9664\u3001\u6dfb\u52a0\u9759\u6001mac\u5730\u5740\u3002ARP\u4ee5\u5404\u79cd\u65b9\u5f0f\u64cd\u7eb5\u5185\u6838\u7684ARP\u7f13\u5b58\u3002\u4e3b\u8981\u9009\u9879\u662f\u6e05\u9664\u5730\u5740\u6620\u5c04\u9879\u5e76\u624b\u52a8\u8bbe\u7f6e\u3002\u4e3a\u4e86\u8c03\u8bd5\u76ee\u7684\uff0cARP\u7a0b\u5e8f\u8fd8\u5141\u8bb8\u5bf9ARP\u7f13\u5b58\u8fdb\u884c\u5b8c\u5168\u8f6c\u50a8\u3002<\/p>\n<p>\u6b64\u547d\u4ee4\u7684\u9002\u7528\u8303\u56f4\uff1aRedHat\u3001RHEL\u3001Ubuntu\u3001CentOS\u3001SUSE\u3001openSUSE\u3001Fedora\u3002<\/p>\n<p><strong>1<\/strong><strong>\u3001\u8bed\u6cd5<\/strong><\/p>\n<p><strong> &nbsp; &nbsp; arp [-evn] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-a &nbsp;[hostname]<\/strong><\/p>\n<p><strong> &nbsp; &nbsp; arp [-v] &nbsp;[-i if] &nbsp;-d &nbsp;hostname [pub]<\/strong><\/p>\n<p><strong> &nbsp; &nbsp; arp [-v] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-s &nbsp;hostname &nbsp;hw_ addr [temp]<\/strong><\/p>\n<p><strong> &nbsp; &nbsp; arp [-v] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-s &nbsp;hostname hw_ addr &nbsp;[netmask nm] &nbsp;pub<\/strong><\/p>\n<p><strong> &nbsp; &nbsp; arp [-v] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-Ds &nbsp;hostname ifa &nbsp;[netmask nm] &nbsp;pub<\/strong><\/p>\n<p><strong> &nbsp; &nbsp; arp [-vnD] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-f &nbsp;[filename]<\/strong><\/p>\n<p><strong>2<\/strong><strong>\u3001\u9009\u9879\u5217\u8868<\/strong><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"28%\">\n<p>\u9009\u9879<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u8bf4\u660e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>&#8211;help<\/strong><\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u663e\u793a\u5e2e\u52a9\u6587\u6863<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>&#8211;version<\/strong><\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u663e\u793a\u547d\u4ee4\u7248\u672c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-H <\/strong>type<\/p>\n<p><strong>&#8211;hw-type<\/strong>type<\/p>\n<p><strong>-t<\/strong> type<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u5728\u8bbe\u7f6e\u6216\u8bfb\u53d6ARP\u7f13\u5b58\u65f6\uff0c\u8fd9\u4e2a\u53ef\u9009\u53c2\u6570\u544a\u8bc9ARP\u5e94\u8be5\u68c0\u67e5\u54ea\u7c7b\u6761\u76ee\u3002\u6b64\u53c2\u6570\u7684\u9ed8\u8ba4\u503c\u4e3a<strong>ether<\/strong>(\u5373IEEE 802.3 10 Mbps\u4ee5\u592a\u7f51\u7684\u786c\u4ef6\u4ee3\u78010x01)\u3002\u5176\u4ed6\u53ef\u80fd\u7684\u503c\u6709\uff0c\u5982<strong>ARCnet<\/strong>(Arcnet)\u3001<strong>PROnet<\/strong>(PRINET)\u3001<strong>AX.25<\/strong>(Axis 25)\u548c<strong>Net\/ROM<\/strong>(Netrom)\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-a<\/strong>[hostname] | &#8211;all [hostname]<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u663e\u793a\u672c\u673a\u7684arp\u7f13\u51b2\u533a\u5185\u5bb9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-d<\/strong>hostname | <strong>&#8211;delete<\/strong>hostname<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u4ece\u7f13\u51b2\u533a\u5220\u9664\u6307\u5b9a\u7684\u5730\u5740\u7c7b\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-D | -use-device<\/strong><\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u4f7f\u7528\u6307\u5b9a\u63a5\u53e3\u7684mac\u5730\u5740<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-e<\/strong><\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u4f7f\u7528Linux\u98ce\u683c\u663e\u793a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-i <\/strong>if | <strong>&#8211;device<\/strong> if<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u663e\u793a\u6307\u5b9a\u8bbe\u5907\u7684arp\u7f13\u51b2\u533a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-s<\/strong>hostnamehw_addr<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u8bbe\u7f6e\u6307\u5b9a\u4e3b\u673a\u7684mac\u5730\u5740\u6620\u5c04<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p>-f filename | &nbsp;&#8211;file filename<\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u7c7b\u4f3c\u4e8e-s\u9009\u9879\uff0c\u53ea\u662f\u8fd9\u6b21\u5730\u5740\u4fe1\u606f\u662f\u4ecefilename\u8bbe\u7f6e\u7684\u3002\u6570\u636e\u6587\u4ef6\u7684\u540d\u79f0\u901a\u5e38\u662f\u201c\/etc\/ether\u201d\uff0c\u4f46\u8fd9\u4e0d\u662f\u6b63\u5f0f\u7684\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u6587\u4ef6\u540d\u201c\/etc\/ether\u201d\u4f5c\u4e3a\u9ed8\u8ba4\u503c\u3002\u8be5\u6587\u4ef6\u7684\u683c\u5f0f\u5f88\u7b80\u5355\uff1b\u5b83\u53ea\u5305\u542b\u5e26\u6709\u786c\u4ef6\u5730\u5740\u548c\u7531\u7a7a\u683c\u5206\u9694\u7684\u4e3b\u673a\u540d\u7684ASCII\u6587\u672c\u884c\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528<strong>pub<\/strong>\u3001<strong>temp<\/strong>\u548c<strong>netmask<\/strong>\u6807\u5fd7\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-n | &#8211;numeric<\/strong><\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u4f7f\u7528\u6570\u5b57\u65b9\u5f0f\u663e\u793a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"28%\">\n<p><strong>-v | &#8211;verbose<\/strong><\/p>\n<\/td>\n<td width=\"71%\">\n<p>\u663e\u793a\u6267\u884c\u8fc7\u7a0b<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728\u6240\u6709\u9700\u8981\u4e3b\u673a\u540d\u7684\u5730\u65b9\uff0c\u4eba\u4eec\u4e5f\u53ef\u4ee5\u7528\u865a\u7ebf\u5c0f\u6570\u70b9\u8868\u793a\u6cd5\u8f93\u5165IP\u5730\u5740\u3002\u4f5c\u4e3a\u517c\u5bb9\u6027\u7684\u7279\u4f8b\uff0c\u4e3b\u673a\u540d\u548c\u786c\u4ef6\u5730\u5740\u7684\u987a\u5e8f\u53ef\u4ee5\u4ea4\u6362\u3002ARP\u7f13\u5b58\u4e2d\u7684\u6bcf\u4e2a\u5b8c\u6574\u6761\u76ee\u90fd\u5c06\u88ab\u6807\u8bb0\u4e3aC\u6807\u5fd7\u3002\u6c38\u4e45\u6761\u76ee\u7528M\u6807\u8bb0\uff0c\u5df2\u53d1\u5e03\u7684\u6761\u76ee\u5e26\u6709P\u6807\u5fd7\u3002<\/p>\n<p><strong>3<\/strong><strong>\u3001\u5b9e\u4f8b<\/strong><\/p>\n<p>1\uff09\u6dfb\u52a0\u9759\u6001\u6620\u5c04<\/p>\n<pre>[root@localhost&nbsp;~]#&nbsp;arp&nbsp;-i&nbsp;eth0&nbsp;-s&nbsp;192.168.1.6&nbsp;ff:ee:ee:ee:ee:ee&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5c06\u76ee\u6807ip\u5730\u5740\u6620\u5c04\u56fa\u5b9amac\n\n[root@localhost&nbsp;~]#&nbsp;arp&nbsp;\u2013a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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nbsp;&nbsp;&nbsp;CM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eth0\n\nEntries:&nbsp;2&nbsp;Skipped:&nbsp;0Found:&nbsp;2<\/pre>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300alinux arp\u6709\u4ec0\u4e48\u4f5c\u7528\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux arp\u6709\u4ec0\u4e48\u4f5c\u7528 \u5bf9\u4e8e\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u7262\u56fa\u624e\u5b9e\u7684\u57fa\u7840\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u7c73\u4e91\u5c31\u6765\u5e26\u5927\u5bb6\u4e00\u70b9\u70b9\u7684\u638c\u63e1\u57fa\u7840\u77e5\u8bc6\u70b9\u3002\u4eca\u5929\u672c\u7bc7\u6587\u7ae0\u5e26\u5927\u5bb6\u4e86\u89e3\u300alinux arp\u6709\u4ec0\u4e48\u4f5c\u7528\u300b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u5feb\u70b9\u6536\u85cf\u8d77\u6765\u5427\uff0c\u5426\u5219\u9700\u8981\u65f6\u5c31\u627e\u4e0d\u5230\u4e86\uff01 linux arp\u4f5c\u7528\u662f\u7ba1\u7406\u7cfb\u7edf\u7684arp\u7f13\u51b2\u533a\uff0c\u5e76\u4e14\u53ef\u4ee5\u663e\u793a\u3001\u5220\u9664\u3001\u6dfb\u52a0\u9759\u6001mac\u5730\u5740\uff1bARP\u4ee5\u5404\u79cd\u65b9\u5f0f\u64cd\u7eb5\u5185\u6838\u7684ARP\u7f13\u5b58\uff0c\u4e3b\u8981\u9009\u9879\u662f\u6e05\u9664\u5730\u5740\u6620\u5c04\u9879\u5e76\u624b\u52a8\u8bbe\u7f6e\uff1b\u4e3a\u4e86\u8c03\u8bd5\u76ee\u7684\uff0cARP\u7a0b\u5e8f\u8fd8\u5141\u8bb8\u5bf9ARP\u7f13\u5b58\u8fdb\u884c\u5b8c\u5168\u8f6c\u50a8\u3002 arp arp\u6307\u4ee4\u7528\u6765\u7ba1\u7406\u7cfb\u7edf\u7684arp\u7f13\u51b2\u533a\uff0c\u53ef\u4ee5\u663e\u793a\u3001\u5220\u9664\u3001\u6dfb\u52a0\u9759\u6001mac\u5730\u5740\u3002ARP\u4ee5\u5404\u79cd\u65b9\u5f0f\u64cd\u7eb5\u5185\u6838\u7684ARP\u7f13\u5b58\u3002\u4e3b\u8981\u9009\u9879\u662f\u6e05\u9664\u5730\u5740\u6620\u5c04\u9879\u5e76\u624b\u52a8\u8bbe\u7f6e\u3002\u4e3a\u4e86\u8c03\u8bd5\u76ee\u7684\uff0cARP\u7a0b\u5e8f\u8fd8\u5141\u8bb8\u5bf9ARP\u7f13\u5b58\u8fdb\u884c\u5b8c\u5168\u8f6c\u50a8\u3002 \u6b64\u547d\u4ee4\u7684\u9002\u7528\u8303\u56f4\uff1aRedHat\u3001RHEL\u3001Ubuntu\u3001CentOS\u3001SUSE\u3001openSUSE\u3001Fedora\u3002 1\u3001\u8bed\u6cd5 &nbsp; &nbsp; arp [-evn] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-a &nbsp;[hostname] &nbsp; &nbsp; arp [-v] &nbsp;[-i if] &nbsp;-d &nbsp;hostname [pub] &nbsp; &nbsp; arp [-v] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-s &nbsp;hostname &nbsp;hw_ addr [temp] &nbsp; &nbsp; arp [-v] &nbsp;[-H type] &nbsp;[-i if] &nbsp;-s &nbsp;hostname hw_ addr &nbsp;[netmask [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-51995","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=51995"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51995\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=51995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=51995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=51995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}