Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are all scripts in /etc/network/if-up.d run when a network interface is brought up?

If so, what is the post-up command for in the interfaces file?

share|improve this question
All ".d" folders contents, conventionally, is executed. Some of them actually need ".sh" filename extension. All of the files should be executable. – kolypto Nov 6 '09 at 15:36
up vote 4 down vote accepted

Yes generally any script that is marked as executable and placed in that folder is ran. The files do have are limited to a specific set of names because run-parts is used.

The post-up does the same thing as using up. Placing a script in the if-up.d is the same as simply using a post-up that points to a script or command somewhere else. Usually you would use the up|post-up when you just needed to run a single command for a single interface. When you have something more complex you would create a script.

man interfaces

up command

post-up command
      Run  command  after  bringing the interface up.  If this command
      fails then ifup aborts, refraining from marking the interface as
      configured  (even  though it has really been configured), prints
      an error message, and exits with status 0.   This  behavior  may
      change in the future.
There  exists  for  each  of  the  above  mentioned options a directory
/etc/network/if-<option>.d/ the scripts in which are run (with no argu-
ments) using run-parts(8) after the option itself has been processed.

man run-parts

run-parts  runs  all  the  executable  files  named  within constraints
described below,

If  the  --lsbsysinit  option  is not given then the names must consist
entirely of upper and lower  case  letters,  digits,  underscores,  and
Files are run in the lexical sort  order  of  their  names  unless  the
--reverse  option  is given, in which case they are run in the opposite
share|improve this answer
So if you want a script being run only after the interface is up and it needs stuff in the if-up.d folder to be ready, you either have to name it so it will fall in lexical order after the command you need to operate, or put into another directory and run via the post-up command. Does that sound right? – Spig Nov 4 '09 at 22:17
Yes, I believe so. – Zoredache Nov 4 '09 at 22:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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