Clear arp-cache vs clear ip arp

Cisco IOS CLI provides two different commands that seem the same on the surface but have a slightly different outcome on the wire. Based on the title you probably guessed that it’s clear arp-cache vs clear ip arp. To see the difference, I connected two routers on network 10.0.0.0/30 with a SPAN enabled switch in the middle.

To ensure ARP that the ARP cache is populated I ran a ping from R1 to R2.

RoutingLoop_R1#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms 

Now that the ARP entry is guaranteed to be populated, “clear ip arp 10.0.0.2” is issued to remove the entry. R1 immediately sends an ARP request to repopulate the entry. R2 replies with its MAC address.

For fun I ran the ping again, this did not generate any new ARP traffic.

RoutingLoop_R1#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms 

This time, I repeated the test but issued “clear arp-cache 10.0.0.2” instead. Interestingly, this not only triggered R1 to send an ARP request for 10.0.0.2, but R1 also send a gratuitous ARP reply. It’s a gratuitous ARP because nobody asked for it, it’s an ARP reply without an ARP request.

I have no idea why both commands exist and why one triggers a gratuitous ARP. If you know, please send me an email.

Commands Issued:

RoutingLoop_R1#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
RoutingLoop_R1#clear ip arp 10.0.0.2
RoutingLoop_R1#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
RoutingLoop_R1#clear arp-cache 10.0.0.2

Leave Comment

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.