Add static ARP entries when network is brought up

Posted by jozzas on Ask Ubuntu See other posts from Ask Ubuntu or by jozzas
Published on 2011-01-24T07:04:18Z Indexed on 2011/02/27 23:32 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

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

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

With the contents:

#!/bin/sh

arp -i eth0 -s 192.168.0.4 00:50:cc:44:55:55
arp -i eth0 -s 192.168.0.5 00:50:cc:44:55:56
arp -i eth0 -s 192.168.0.6 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.

© Ask Ubuntu or respective owner

Related posts about 10.04

  • An increase to 3 Gig of RAM slows down Ubuntu 10.04 LTS

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have Ubuntu 10.04 running from an external hard drive (installed on an enclosure) connected via USB port. Like a month or so ago, I increased RAM on my pc from 2 Gigs to 3 Gigs. This resulted on extremely long boot times and slow application loads. While I was understanding the nature of my problem… >>> More

  • Default /etc/apt/sources.list?

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I need default source list for ubuntu 10.04. Can anybody help me? Here is Mine:--- Ubuntu supported packages deb http://archive.ubuntu.com/ubuntu/ lucid main restricted multiverse universe deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse deb http://archive… >>> More

  • Postgresql fails to start on Ubuntu 10.04.4 LTS

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I installed postgresql 9.2 from add-apt-repository ppa:pitti/postgresql using apt-get install postgresql-9.2 At the end of the install and every time I try to launch postgresql by using the following command /etc/init.d/postgresql start or service postgresql start I get this error: Error:… >>> More

  • SSH main process ended

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have a running ubuntu server 10.04.1. When I tried to login to the server via ssh, I could not. Instead, I got connection refused error. I tried to ping the machine and I got reply! So, the clear reason is that SSH daemon is stopped. After reboot, I was able to login to my server via ssh. After… >>> More

  • PPA causing 404 error?

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I need default source list for ubuntu 10.04. Can anybody help me? Here is Mine:--- Ubuntu supported packages deb http://archive.ubuntu.com/ubuntu/ lucid main restricted multiverse universe deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse deb http://archive… >>> More

Related posts about networking