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

33 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="arp">arp</h1>
<p>arp 命令用于显示和修改 IP 到 MAC 转换表。ARP 是 Address Resolution Protocol地址解析协议是通过解析网络层地址来找寻数据链路层地址的一个网络协议包中极其重要的网络传输协议。而该命令可以显示和修改 arp 协议解析表中的缓冲数据。</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>arp 命令</strong> 用于操作主机的 arp 缓冲区,它可以显示 arp 缓冲区中的所有条目、删除指定的条目或者添加静态的 ip 地址与 MAC 地址对应关系。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">arp选项参数</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-a 主机 :显示 arp 缓冲区的所有条目;
-H 地址类型 :指定 arp 指令使用的地址类型;
-d 主机 :从 arp 缓冲区中删除指定主机的 arp 条目;
-D使用指定接口的硬件地址
-e以 Linux 的显示风格显示 arp 缓冲区中的条目;
-i 接口 :指定要操作 arp 缓冲区的网络接口;
-s 主机 MAC 地址 :设置指定的主机的 IP 地址与 MAC 地址的静态映射;
-n以数字方式显示 arp 缓冲区中的条目;
-v显示详细的 arp 缓冲区条目,包括缓冲区条目的统计信息;
-f 文件 :设置主机的 IP 地址与 MAC 地址的静态映射。</code></pre>
<h3 id="参数">参数</h3>
<p>主机:查询 arp 缓冲区中指定主机的 arp 条目。</p>
<h3 id="实例">实例</h3>
<p>显示arp 缓冲区内容</p>
<pre><code class="language-bash">[root@localhost ~]# arp -v
Address HWtype HWaddress Flags Mask Iface
192.168.0.134 ether 00:21:5E:C7:4D:88 C eth1
115.238.144.129 ether 38:22:D6:2F:B2:F1 C eth0
Entries: 2 Skipped: 0 Found: 2</code></pre>
<p>添加静态 arp 映射</p>
<pre><code class="language-bash">arp -s IP MAC-ADDRESS
arp -s 192.168.1.1 00:b1:b2:b3:b4:b5</code></pre>
<p>删除 arp 缓存条目</p>
<pre><code class="language-bash">arp -d 192.168.1.1</code></pre>
<!-- Linux 命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->