Main Contents

CentOS custom network scripts on ifup and ifdown

July 29, 2008

To automatically run custom scripts as interfaces are brought up and down, create the following files:

/sbin/ifup-local
/sbin/ifdown-local

and mark them executable:

chmod +x /sbin/ifup-local
chmod +x /sbin/ifdown-local

These will be called everytime an interface comes up or goes down. The device name will be passed to it as an argument so you can use it in the script. For example, my /sbin/ifup-local looks like this:

#!/bin/bash
if [ -x /root/qos-up-${1}.sh ]; then
    exec /root/qos-up-${1}.sh
fi

 

Filed under: Linux |

Sorry, the comment form is closed at this time.