2019独角兽企业重金招聘Python工程师标准>>>

以下摘自http://wiki.wireshark.org/Gratuitous_ARP。

Gratuitous ARP

Gratuitous ARP could mean both gratuitous ARP request or gratuitous ARP reply. Gratuitous in this case means a request/reply that is not normally needed according to the ARP specification (RFC 826) but could be used in some cases. A gratuitous ARP request is anAddressResolutionProtocol request packet where the source and destination IP are both set to the IP of the machine issuing the packet and the destination MAC is the broadcast addressff:ff:ff:ff:ff:ff. Ordinarily, no reply packet will occur. A gratuitous ARP reply is a reply to which no request has been made.

Gratuitous ARPs are useful for four reasons:

  • They can help detect IP conflicts. When a machine receives an ARP request containing a source IP that matches its own, then it knows there is an IP conflict.
  • They assist in the updating of other machines' ARP tables. Clustering solutions utilize this when they move an IP from one NIC to another, or from one machine to another. Other machines maintain an ARP table that contains the MAC associated with an IP. When the cluster needs to move the IP to a different NIC, be it on the same machine or a different one, it reconfigures the NICs appropriately then broadcasts a gratuitous ARP reply to inform the neighboring machines about the change in MAC for the IP. Machines receiving the ARP packet then update their ARP tables with the new MAC.

  • They inform switches of the MAC address of the machine on a given switch port, so that the switch knows that it should transmit packets sent to that MAC address on that switch port.
  • Every time an IP interface or link goes up, the driver for that interface will typically send a gratuitous ARP to preload the ARP tables of all other local hosts. Thus, a gratuitous ARP will tell us that that host just has had a link up event, such as a link bounce, a machine just being rebooted or the user/sysadmin on that host just configuring the interface up. If we see multiple gratuitous ARPs from the same host frequently, it can be an indication of bad Ethernet hardware/cabling resulting in frequent link bounces.

Examples

  • The networking stack in many operating systems will issue a gratuitous ARP if the IP or MAC address of a network interface changes, to inform other machines on the network of the change so they can report IP address conflicts, to let other machines update their ARP tables, and to inform switches of the MAC address of the machine. The networking stack in many operating systems will also issue a gratuitous ARP on an interface every time the link to that interface has been brought to the up state. The gratuitous ARP then is used to preload the ARP table on all local hosts of the possibly new mapping between MAC and IP address (for failover clusters that do not take over the MAC address) or to let the switch relearn behind which port a certain MAC address resides (for failover clusters where you do pull the MAC address over as well or when you simply just move the network cable from one port to another on a normal nonclustered host)
  • The High-Availability Linux Project utilizes a command-line tool called send_arp to perform the gratuitous ARP needed in their failover process. A typical clustering scenario might play out like the following:

    • Two nodes in a cluster are configured to share a common IP address 192.168.1.1. Node A has a hardware address of 01:01:01:01:01:01 and node B has a hardware address of 02:02:02:02:02:02.

    • Assume that node A currently has IP address 192.168.1.1 already configured on its NIC. At this point, neighboring devices know to contact 192.168.1.1 using the MAC01:01:01:01:01:01.

    • Using the heartbeat protocol, node B determines that node A has died.
    • Node B configures a secondary IP on an interface withifconfig eth0:1 192.168.1.1.

    • Node B issues a gratuitous ARP withsend_arp eth0 192.168.1.1 02:02:02:02:02:02 192.168.1.255. All devices receiving this ARP update their table to point to 02:02:02:02:02:02 for the IP address 192.168.1.1.

Example Traffic

Ethernet II, Src: 02:02:02:02:02:02, Dst: ff:ff:ff:ff:ff:ffDestination: ff:ff:ff:ff:ff:ff (Broadcast)Source: 02:02:02:02:02:02 (02:02:02:02:02:02)Type: ARP (0x0806)Trailer: 000000000000000000000000000000000000
Address Resolution Protocol (request/gratuitous ARP)Hardware type: Ethernet (0x0001)Protocol type: IP (0x0800)Hardware size: 6Protocol size: 4Opcode: request (0x0001)Sender MAC address: 02:02:02:02:02:02 (02:02:02:02:02:02)Sender IP address: 192.168.1.1 (192.168.1.1)Target MAC address: ff:ff:ff:ff:ff:ff (Broadcast)Target IP address: 192.168.1.1 (192.168.1.1)
0000  ff ff ff ff ff ff 02 02 02 02 02 02 08 06 00 01   ................
0010  08 00 06 04 00 01 02 02 02 02 02 02 c0 a8 01 01   ................
0020  ff ff ff ff ff ff c0 a8 01 01 00 00 00 00 00 00   ................
0030  00 00 00 00 00 00 00 00 00 00 00 00               ............

Discussion

What's a good choice for example MACs? I picked 02:02:02:02:02:02. Is there a better one? -- RandyMcEoin

-The '02' byte at the start of the MAC indicates that this is a 'locally administered address' which has been set by the local user or system. Most normal ethernet devices are allocated a MAC with 00 as the most significant byte.

I updated the article to differentiate between gratuitous ARP request and reply.

Note that some devices will respond to the gratuitous request and some will respond to the gratuitous reply. If one is trying to write software for moving IP addresses around that works with all routers, switches and IP stacks, it is best to send both the request and the reply. These are documented by RFC 2002 and RFC 826. Software implementing the gratuitious ARP function can be found in the Linux-HA source tree. A request may be preceded by a probe to avoid polluting the address space. For an ARP Probe the Sender IP address field is 0.0.0.0. ARPprobes were not considered by the original ARP RFC.

-Does the target MAC address ever matter in requests? I gather Solaris usesff:ff:ff:ff:ff:ff in its standard ARP requests and most other OSes use00:00:00:00:00:00 instead. Is the use of the ff:ff:ff:ff:ff:ff MAC in the target address above significant in any way? Obviously having a destination address offf:ff:ff:ff:ff:ff is critical.yes

RFC 3927, which is based on Gratuitous ARP, specifies 00:00:00:00:00:00 for the target MAC. However many simple TCP/IP stacks have an API which permits the specification of only one MAC value, and when the Ethernet Destination field is set to 'broadcast', the ARP target is also set 'broadcast'. Note: Normal ARP requests have the same value in the ARP Packet Target MAC address as in the Ethernet Destination field.

- How can we explain if the source Ethernet MAC address is different from sender's MAC address in a GARP packet? The ARP packet value is for the ARP machine, the Ethernet value is for the Ethernet machine. Originally, they were intended to be redundant information, targeted at different layers. It is possible to consider a hypothetical network appliance that routes ARP packets, where the source Ethernet MAC address changes as the packet is routed, but normally ARP packets are not routed.

转载于:https://my.oschina.net/letiantian/blog/192369

什么是Gratuitous ARP相关推荐

  1. DHCP服务器如何检测穿过中继代理的IP地址冲突(gratuitous ARP肯定是不行的)

    建议:先阅读本人所发表的博文,DHCP原理篇及IP地址冲突检测 1关于DHCP服务器的冲突检测的总结 2取证DHCP中继代理的工作原理与IP地址冲突(因为不在一个子网,所以gratuitous ARP ...

  2. ARP协议具体解释之Gratuitous ARP(免费ARP)

    ARP协议具体解释之Gratuitous ARP(免费ARP) Gratuitous ARP(免费ARP) Gratuitous ARP也称为免费ARP.无故ARP.Gratuitous ARP不同于 ...

  3. 免费ARP(gratuitous ARP)简介

    免费ARP,也有称无故ARP,其英文原词是Gratuitous ARP,Gratuitous直译为中文是"免费的, 无理由的",小编还是觉得英文原词更能表达其所代表的含义,字面上G ...

  4. ARP协议详解之Gratuitous ARP(免费ARP)

    ARP协议详解之Gratuitous ARP(免费ARP) Gratuitous ARP(免费ARP) Gratuitous ARP也称为免费ARP,无故ARP.Gratuitous ARP不同于一般 ...

  5. GARP(Gratuitous ARP)

    内核函数arp_is_garp判断ARP报文是否为GARP,先决条件是发送者IP和目标IP地址相同,另外,对于ARP回复(REPLAY)报文,要求如果目标硬件地址存在,需要与发送者硬件地址相等.最后, ...

  6. Gratuitous ARP

    Gratuitous ARP 也叫做免费ARP,与普通ARP不一样,普通ARP是请求对方IP地址对应的MAC地址,而免费ARP是当主机或者路由器端口UP的时候所发出的,请求的是自己IP对应的MAC地址 ...

  7. 【博客421】无偿arp(Gratuitous ARP)

    无偿arp(Gratuitous ARP) 本质 设备主动使用自己的IP地址作为目的IP地址发送ARP请求,此种方式称为免费ARP. 免费ARP本质是ARP协议的实现,所以只要有支持TCP/IP的网卡 ...

  8. 浅谈---免费ARP 【Gratuitous ARP】

    1.免费ARP定义 ARP Request 报文中Sender IP 和 Target IP 都是自己的报文被称为免费ARP报文(Gratuitous ARP). 2.免费ARP作用 免费ARP报文主 ...

  9. 免费ARP(Gratuitous ARP)的介绍

    问题引入 我们很多系统都是使用双机热备份系统(即一个主用,另一个备用,如果主用没有问题,备用一直处于空闲状态:如果主用出现问题,备用立刻接管).假设主用服务器的MAC地址为:1111-1111-111 ...

最新文章

  1. 年终盘点篇:2018年开源市场5大发展趋势
  2. 四种方法使Map线程安全
  3. base64补等号规则说明
  4. Tomcat性能优化总结
  5. linux 获取本机的所有IP地址
  6. 安卓桌面壁纸_安卓视频桌面哪个好用 让手机桌面更炫酷
  7. milvus入门学习
  8. 整理了81个Python实战项目列表,都有完整且详细的教程
  9. 《计算机网络教程》(微课版 第五版)第七章 网络安全 课后习题及答案
  10. c++逆天改命进阶--多态
  11. python画版图_关于回收站正确的说法是_____。
  12. 巴士博弈_自主穿梭巴士内部和服务的设计
  13. 【Node.js】深度解析node的包和强大的包管理工具
  14. CSS如何设置自定义渐变色? 线性渐变篇
  15. vue实现一个日历切换功能
  16. 一个垃圾的网上论坛(Oracle+JavaWeb相关技术实现)
  17. 信息学奥赛一本通(c++):1168:大整数加法
  18. 基于R语言的Meta分析【全流程、不确定性分析】方法与Meta机器学习应用
  19. 利用函数实现一个锯齿脉冲信号
  20. 电子计算机工程专业介绍,电子与计算机工程专业介绍

热门文章

  1. Python基础编程03
  2. 云滋味:微信点餐系统案例分析
  3. python——快递分拣
  4. 2020雷军小米10周年演讲PPT 附下载地址
  5. 7-42 圆形体体积计算器 (20分)
  6. 语音用户累计破1.4亿!百度AI地图成智能交通基础设施
  7. mysql中phpmyadmin安装教程_安装phpMyAdmin图文教程
  8. Android EditText java 设置 maxLength
  9. 如何快速拆分PDF文件?
  10. mac 解决安装Android Studio 报错The Android SDK location canot be at the filesystem root