The ARP cache exists in one form or another on every host that communicates via IP over Ethernet. The cache holds the mapping between IP address and Ethernet Media Access Control (MAC) address. If you change an Ethernet adapter on a host named SERVER-1 or replace SERVER-1 with newer / faster hardware all the hosts on the local Ethernet segment that communicate with SERVER-1 will need their ARP cache updated. SERVER-1 may send out a gratuitous ARP packet that should update all hosts but since it is Ethernet there is a possibility that the ARP packet will be corrupted or just dropped so you cannot rely on it.
The ARP cache entries in the STCP stack on OpenVOS have a 10 minute lifetime, that is, after 10 minutes they are automagically deleted and will be added back the next time a packet needs to be sent. When you display the ARP cache it shows the time left for each entry. So the worst case scenario is that after changing SERVER-1 it will take 10 minutes for the old (incorrect) mapping to expire and a new (correct) mapping to be added in. During that time communication with SERVER-1 will not be possible.
You can delete a given entry with the arp -delete command. Figure 1 shows an instance of the arp command displaying the MAC address and the lifetime time followed by the arp -delete command to delete the entry and another instance of the arp command showing that there is no longer an entry in the cache.
arp 192.168.50.5 Internet Address MAC Address Type Life 192.168.50.5 00-04-96-1F-67-0C temp 6 min ready 14:01:30 arp -delete 192.168.50.5 Mapping for 192.168.50.5 deleted ready 14:01:39 arp 192.168.50.5 arp: no mapping for 192.168.50.5 ready 14:01:44
|Figure 1 – “arp” and “arp -delete” commands|
The old TCP_OS stack had an arp -flush command that would delete all the entries in the ARP cache. If you have more than one entry to delete it can be easier (less typing) to just delete them all. Since entries are automagically added as they are needed the only down side of this is a few extra packets on the network and some extra delay (while the ARP cache is being repopulated) in sending the first packet. From the point of view of the typist there is no down side at all.
The STCP stack does not have a flush option
---------------------------------- arp --------------------------------- hostname: -all: no -network: -delete: no -set: no mac_addr:
|Figure 2 – STCP arp command form|
So I wrote a short macro (figure 3) to do it. The macro redirects the output of arp -all to a file in the process directory, then parses the file to extract the IP addresses and calls arp -delete with each address. By the time it completes some of the entries will be back but they will all have been refreshed with the current mapping.
& arp_flush.cm begins here & & Version 1.00 11-04-17 & firstname.lastname@example.org & & This scripts clears the arp cache by individually deleting each entry. & By the time it is done some entries will be back. & & & This software is provided on an "AS IS" basis, WITHOUT ANY WARRANTY OR & ANY SUPPORT OF ANY KIND. The AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED & WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. & This disclaimer applies, despite any verbal representations of any & kind provided by the author or anyone else. & &set_string FILE (process_dir)>arp_list attach_default_output &FILE& arp -all detach_default_output &set LINE 2 &label again &set LINE (calc &LINE& + 1) &set_string IP (substr (contents &FILE& &LINE& -hold) 1 16) &if (end_of_file &FILE&) = 1 &then &return &if (length X&IP&) = 1 &then &return arp -delete &IP& &goto again & & arp_flush.cm ends here
|Figure 3 – arp_flush command macro|
Figure 4 shows an instance of the arp -all command to see what is in the arp cache then an execution of the arp_flush macro followed by another instance of arp -all, note that all the lifetimes in the second arp -all are 10 minutes. I removed many of the lines from the first arp -all and arp_flush output to reduce the space required.
arp -all Internet Address MAC Address Type Life 10.10.1.200 00-90-E8-1F-4B-EA temp 8 mins 192.168.50.1 00-04-96-19-0B-20 temp 10 mins 192.168.50.4 00-04-96-35-3F-B5 temp 1 mins 192.168.50.2 00-04-96-20-C7-EC temp 4 mins 192.168.50.19 00-0C-29-6B-CA-AE temp 6 mins 192.168.50.21 00-23-54-79-C5-81 temp 7 mins . . . . . 192.168.51.252 00-50-56-BB-4D-8C temp 5 mins 192.168.51.253 00-0C-29-86-AD-CC temp 3 mins ready 13:46:14 arp_flush Mapping for 10.10.1.200 deleted Mapping for 192.168.50.1 deleted Mapping for 192.168.50.4 deleted Mapping for 192.168.50.2 deleted Mapping for 192.168.50.19 deleted Mapping for 192.168.50.21 deleted . . . . . . . Mapping for 192.168.51.252 deleted Mapping for 192.168.51.253 deleted ready 13:46:23 arp -all Internet Address MAC Address Type Life 192.168.50.2 00-04-96-20-C7-EC temp 10 mins 192.168.51.4 00-04-FC-01-02-3E temp 10 mins 192.168.51.11 00-00-A8-80-80-4A temp 10 mins 192.168.51.49 00-50-56-46-08-2C temp 10 mins 192.168.51.50 00-23-54-52-18-6E temp 10 mins 192.168.51.76 00-23-54-52-1B-F5 temp 10 mins 192.168.51.100 00-0C-29-A9-85-44 temp 10 mins 192.168.51.128 00-00-A8-43-52-22 temp 10 mins 192.168.51.158 00-26-B9-BC-B7-37 temp 10 mins 192.168.51.180 5C-26-0A-06-BD-29 temp 10 mins 192.168.51.203 00-00-A8-C0-86-A1 temp 10 mins ready 13:46:27
|Figure 4 – Execution of arp_flush command macro|