[CentOS] Run commands automatically when bringing up/down network interfaces?

Devin Reade gdr at gno.org
Wed Sep 14 21:37:34 UTC 2011


--On Wednesday, September 14, 2011 12:26:10 PM -0700 Edward Morbius
<dredmorbius at gmail.com> wrote:

> I'm looking for a capability similar to Debian/Ubuntu's pre/post up/down
> network commands capability.
[...]
> We should be able to solve this by pinging the router directly when
> bringing up the interface, rather than waiting (a day) for the router's
> ARP cache to expire.

Have a look at arping(8) and it's -U flag in particular rather than ping.

Also read 'man ifup'.  That refers you to
     /usr/share/doc/initscripts*/sysconfig.txt
which talks about the ifup-post script.  Looking at the end of ifup-post,
we see the following:

   if [ -x /sbin/ifup-local ]; then
       /sbin/ifup-local ${DEVICE}
   fi

So it's probably the case that you could create a /sbin/ifup-local
that, based on the device name, may arping the gateway.

I was looking at my RHEL6 laptop when I was writing this, but C6 is almost
certainly the same.

Devin




More information about the CentOS mailing list