I have some pretty dumb IP devices on a subnet with my Ubuntu server, and the server receives streaming data from each device. I have run into a problem in that when an ARP request is issued to the device while it is streaming data to the server, the request is ignored, the cache entry times out and the server stops receiving the stream.

So, to prevent the server from sending ARP requests to these devices altogether, I would like to add a static ARP entry for each, something like

arp -i eth2 -s ip.of.the.device mac:of:the:device

But these "static" ARP entries are lost if networking is disabled / enabled or if the server is rebooted. Where is the best place to automatically add these entries, preferably somewhere that will re-add them every time the interface eth2 is brought up?

I really don't want to have to write a script that monitors the output of arp and re-adds the cache entries if they're missing.

Edit to add what my final script was:

Created the file


With the contents:


arp -i eth0 -s 00:50:cc:44:55:55
arp -i eth0 -s 00:50:cc:44:55:56
arp -i eth0 -s 00:50:cc:44:55:57

And then obviously add the permission to allow it to be executed:

chmod +x /etc/network/if-up.d/add-my-static-arp

And these arp entries will be manually added or re-added every time any network interface is brought up.

  • I don't have the rep to add "arp" as a tag, so apologies for that.
    – John Lyon
    Jan 24 '11 at 7:04
  • I see in older versions of Ubuntu I could add an entry to /etc/sysconfig/network-scripts/ifup-post, but it doesn't look like this is the way things are done any more. Where would ifup-post live in 10.04?
    – John Lyon
    Jan 24 '11 at 7:06
  • can you post your script snippet here once you have it working?
    – belacqua
    Jan 25 '11 at 15:29
  • @jgbelacqua -- done, thanks for the suggestion.
    – John Lyon
    Feb 27 '11 at 22:59

Take a look at the scripts in /etc/network/if-up.d. Those are called every time an interface goes to up state. You can create a script with the needed commands and put it there.

  • 1
    Make sure your scripts don't have a ".sh" extension, otherwise they won't run. Jan 8 '12 at 7:46

This file must contain:

mac    ip-address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.