CCNPآموزش شبکه

GARP – Gratuitous Address Resolution Protocol چیست؟

Setting up a GRE Tunnel on a Cisco Router

GARP – Gratuitous Address Resolution Protocol چیست؟ Gratuitous Address Resolution Protocol یا به اختصار GARP، در واقع کمک به شناسایی ip address تکراری می کند. یک درخواست GARP در واقع یک درخواستی از نوع broadcast برای یک آدرس IP اختصاصی خود روتر است. اگر روتر یک درخواست ARP را برای IP address خود ارسال کند، هیچ Reply ای دریافت نمی کند. IP address تخصیص داده شده به روتر توسط سایر node ها استفاده نمی شود و اگر Reply ای دریافت کرد به این معنی است که این ip address توسط Nod دیگری در شبکه در حال استفاده است و بدان از قبل تخصیص داده شده است.

GARP - Gratuitous Address Resolution Protocol
GARP – Gratuitous Address Resolution Protocol
GARP - Gratuitous Address Resolution Protocol
GARP – Gratuitous Address Resolution Protocol

GARP هم یک broadcast از نوع ARP است که در آن MAC Address مبدا و مقصد یکسان است این در درجه اول توسط host مورد استفاده قرار می گیرد تا شبکه را در مورد آدرس IP آن اطلاع دهد. یک gratuitous ARP ناخواسته یا جعلی می تواند اطلاعات مربوط به نقشه شبکه را غلط ذخیره کند و شبکه را با مشکل مواجه سازد.

هنگامی که یک اینترفیس ایجاد شود و یا وضعیت interface ای به حالت عملیاتی یا up تغییر کند، GARP یک روش ایجاد ارتباط بین IP address یا همان logical Address با آدرس سخت افزاری یا MAC Address است. از سوی دیگر، ARP به صورت داینامیک، IP address را به mac address صحیح bind می کند. دستگاهی که GARP را انتقال می دهد، فیلد مربوط مبدا و مقصد را با اطلاعات خود پر می کند. دستگاه هایی که درخواست های GARP دریافت می کنند، باید ARP caches خود را با اطلاعات جدید موجود در بسته های GARP بروز کنند.

بصورت پیشفرض، ARP cache در GARP reply ها غیرفعال هستند. در اینترفیس های اترنت، می توانید انتقال بسته های GARP را روی یک interface خاص و در مود Interface Configuration mode و با دستور ip gratuitous-arps انجام دهید و تعداد GARP packet هایی را که بسته به تغییرات IP interface settings تعیین می شود، مشخص کنید. اگر یک آدرس IP به طور مستقیم درEthernet interface فیزیکی پیکربندی شود و interface VLAN، در Ethernet interface برای VLAN encapsulation پیکربندی نشده باشد، انتقال بسته های GARP انجام نمی شود.

هنگامی که به اینترفیسی ip می دهید و وضعیت آن را up می کنید، سه بسته GARP برای هر آدرس IP ارسال می شود. هر بسته GARP در فاصله 10 ثانیه ارسال می شود و بصورت پیشفرض روتر درخواست GARP را تولید می کند. یک IP interfac می تواند حداکثر شانزده ip داشته باشد. بنابراین، با حداکثر تعداد آدرس های پیکربندی شده روی اینترفیس، در مجموع 48 پیام GARP برای هر IP interface ارسال می شود. در محیط یک شبکه کاملا مقیاس پذیر، پیام های GARP می توانند طوفان به پا کنند در چنین شبکه هایی کاهش تعداد بسته های GARP منتقل شده برای تغییرات interface، باعث کاهش عوامل تاثیر گذار در performance روی روتر شده و کارایی و پردازش روتر بهبود پیدا خواهد کرد.

Redundant IP Addresses
Redundant IP Addresses
Redundant IP and MAC Addresses
Redundant IP and MAC Addresses

 

Examples GARP – Gratuitous Address Resolution Protocol

  • 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 MAC 01: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 with ifconfig eth0:1 192.168.1.1.

    • Node B issues a gratuitous ARP with send_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 GARP – Gratuitous Address Resolution Protocol

Ethernet II, Src: 02:02:02:02:02:02, Dst: ff:ff:ff:ff:ff:ff
    Destination: 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: 6
    Protocol size: 4
    Opcode: 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               ............

 

Shares:

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *