Syntax for include files in /etc/network/interfaces

5,826

from man 5 interfaces KNOWN BUGS/LIMITATIONS section:

It is not currently possible to divide up /etc/network/interfaces into multiple files. A feature that would make this possible is some sort of inclusion directive. No such feature exists in the current ifupdown program. For more information see Debian bug #159884.

UPDATE:

Since ubuntu 11.10:

Lines beginning with "source" are used to include stanzas from other files, so configuration can be split into many files. The word "source" is followed by the path of file to be sourced. Shell wildcards can be used. (See wordexp(3) for details.)

So the syntax is:

source path/to/configfile
Share:
5,826

Related videos on Youtube

r_2
Author by

r_2

Updated on September 18, 2022

Comments

  • r_2
    r_2 over 1 year

    I want to organize interface aliases (for example eth0:1) in separate files (/etc/network/conf.d/eth0_1.cnf).

    Anyone know the syntax to load this external file from /etc/network/interfaces, or where I can find it? I do not want the interface to start automatically.

    I've had a look at man interfaces(8) without any luck. But I have seen this done before, and know it's possible.

    I tried load /etc/network/conf.d/eth0_1.cnf and include /etc/network/conf.d/eth0_1.cnf directives, no dice.

    OS is ubuntu 11. Any ideas are really appreciated.

    Edit: Thanks. When I saw this done before it was on centos/rh.

    Edit: source looks promising but I can't seem to get it going. When I put:

    source /etc/network/interfaces.d/*.conf

    at the top of

    /etc/network/interfaces

    I get the error: /etc/network/interfaces:3: misplaced option

    So maybe this didn't get included in Ubuntu 11.04? Where did you see that it was included there?

    • samina
      samina over 12 years
      The magic word is source. See updated answer.