arping强制抢夺ip

arping命令
    可以测试局域网之间的互通性
    可以用来测试局域网中某个特定的IP地址是否已经被占用
        如果返回结果为1,说明局域网中已经存在该IP地址
        如果返回结果为0,说明局域网中暂时无人使用该IP地址,可以使用

# 通过em2网卡,向10.100.2.254请求10.100.2.249是否可用,并广播通知其他机器(抢占10.100.2.249 IP)
arping -Uq -s10.100.2.249 -Iem2 10.100.2.254

Usage: arping [-fqbDUAV] [-c count] [-w timeout] [-I device] [-s source] destination
  -f : quit on first reply, 在收到第一个响应包后就退出
  -q : be quiet, 不显示任何信息
  -b : keep broadcasting, don't go unicast. 用于发送以太网广播帧(FFFFFFFFFFFF)。arping一开始使用广播地址,在收到响应后就使用unicast地址
  -D : duplicate address detection mode. IP探测
  -U : Unsolicited ARP mode, update your neighbours. 与 -s 配合使用
  -A : ARP answer mode, update your neighbours. 与 -s 配合使用
  -c count : how many packets to send
  -w timeout : how long to wait for a reply. 单位是秒
  -I device : which ethernet device to use (eth0). 设置ping使用的网络接口
  -s source : source ip address. 设定 arping 发送的 arp 数据包中的 SPA 字段的值。如果为空,则按下面处理
      如果是 DAD 模式(-D 冲突地址探测),则设置为 0.0.0.0;
      如果是 Unsolicited ARP 模式(-U)则设置为目标地址;
      否则从路由表得出;
  destination : ask for what ip address. 向此地址进行请求

参考
http://www.2cto.com/os/201309/246287.html

Linux实现的ARP缓存老化时间原理解析
http://blog.csdn.net/dog250/article/details/7251689



请使用浏览器的分享功能分享到微信等