Redhat – How to configure permanent arp entries on Red Hat Enterprise Linux

arpredhatrhel5

I'm configuring a Red Hat Linux server which will be sending UDP packets out but never receiving ARP responses. So a static ARP entry is required.

The obvious way to do this is.

arp -s 10.0.0.1 distant_server

However that won't survive a network restart or a reboot. I could put it in the rc.local but that doesn't survive an ifdown && ifup.

The way I've found which seems to work is:

Add an entry to /etc/ethers along the lines of:

10.0.0.1 distant_server

And create a /sbin/ifup-local:

#!/bin/sh
arp -f

This feels really hacky, is there a better way?

Best Answer

This is the proper way to both store a permanent arp entry, and to run a command on interface start.

A less hacky way would be to have ARP working properly on the network...