Clear ARP table in Checkpoint


Update 2022: On modern Check Point systems you don't have to run the script below (which still works) as they come with up-to-date iproute2 network tools. So, to clear all dynamic ARP entries learned on a specific interface, use ip neighbor flush dev interface-name.

Yesterday my colleague asked how to clear all entries in the ARP table of the NGX in question (Splat). I thought the arp command of the Linux would include some switch for that case too - but it didn't. To delete ARP entry from the ARP  cache you use #arp -d IP address to be deleted , and it has no provision for deleting multiple entries in one go. So here is the one-liner that does just that - clears all entries in ARP cache. I found it in Google and slightly rearranged for brevity (note- it is one line of text) :

for ip in $(awk '/([[:digit:]].)+/ {print $1}' /proc/net/arp) ; do  arp -d $ip ; done

Follow me on https://www.linkedin.com/in/yurislobodyanyuk/ not to miss what I publish on Linkedin, Github, blog, and more.