Networking, Opensource and Experience

top line

Split interface configuration into a single file

On Debian variant system they will put interface configuration into single configuration file "/etc/network/interfaces" but if we have a lot off interface to manage that will be great to put each configuration into different file(similar to CentOS like), so its possible for us to separate that interface configuration? Absolutely YES.

For the detail, how does it work you should read the interface man page, but I will include a fragment of the man page here.
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.)
On Debian variant system there is a specific dictionary to save interface file configuration "/etc/network/interfaces.d" you can store every single file interface configuration into that folder, and recall that configuration file on "/etc/network/interfaces" file using "source" command.

For example:
auto lo
iface lo inet loopback

source /etc/network/interfaces.d/*.cfg
auto eth0
iface eth0 inet static
    address x.x.x.x


An ordinary person who use a keyboard to print a word on his screen, "an experienced keyboard user".

No comments :

Post a Comment

Leave a Comment...