liurhyme 发表于 2011-12-21 08:43

linux arp 命令常用参数详解

<span class="Apple-style-span" style="font-family: verdana, sans-serif; line-height: 21px; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; "><strong><span style="line-height: 21px; font-family: Verdana; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;linux arp 命令常用参数详解&nbsp;</span><br></strong><br>显示和修改地址解析协议(ARP)使用的“IP 到物理”地址转换表。<br>ARP -s inet_addr eth_addr <br>ARP -d inet_addr <br>ARP -a [-N if_addr] [-v]<br>&nbsp;-a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;通过询问当前协议数据,显示当前 ARP 项。如果指定 inet_addr,则只显示指定计算机的 IP 地址和物理地址。如果不止一个网络接口使用 ARP,则显示每个 ARP 表的项。<br>&nbsp;-g &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;与 -a 相同。<br>&nbsp;-v &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;在详细模式下显示当前 ARP 项。所有无效项和环回接口上的项都将显示。<br>&nbsp;inet_addr &nbsp; &nbsp; 指定 Internet 地址。<br>&nbsp;-N if_addr &nbsp; &nbsp;显示 if_addr 指定的网络接口的 ARP 项。<br>&nbsp;-d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;删除 inet_addr 指定的主机。inet_addr 可以是通配符 *,以删除所有主机。<br>&nbsp;-s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;添加主机并且将 Internet 地址 inet_addr与物理地址 eth_addr 相关联。物理地址是用连字符分隔的 6 个十六进制字节。该项是永久的。<br>&nbsp;eth_addr &nbsp; &nbsp; &nbsp;指定物理地址。<br>&nbsp;if_addr &nbsp; &nbsp; &nbsp; 如果存在,此项指定地址转换表应修改的接口的 Internet 地址。如果不存在,则使用第一个适用的接口。<br>示例:<br>添加静态项。这个很有用,特别是局域网中中了arp病毒以后<br>&nbsp;&gt; arp -s 123.253.68.209 00:19:56:6F:87:D2&nbsp;<br>&nbsp;&gt; arp -a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.... 显示 ARP 表。<br>但是arp -s 设置的静态项在用户登出之后或重起之后会失效,如果想要任何时候都不失效,可以将ip和mac的对应关系写入arp命令默认的配置文件/etc /ethers中<br>例如:<br></p><div class="quote"><div class="quote-title">引用</div><div class="quote-content">root@ubuntu:/# vi /etc/ethers&nbsp;<br><br>211.144.68.254 00:12:D9:32:BF:44</div></div><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; "><br>写入之后重起以下网络就好了</p></span>
页: [1]
查看完整版本: linux arp 命令常用参数详解