Customize /etc/network/interfaces the OMV way [>= 1.11]

  • The file '/etc/network/interfaces' will be (re-)generated by OMV on demand. Thus custom changes that are done by the user will get lost. To prevent this, the config generation now supports custom scripts to add additional configuration to the '/etc/network/interfaces' file when OMV is generating it. Using this new feature it is no problem to add bridge or VLAN configurations.


    To do that a script must be located at /usr/share/openmediavault/mkconf/interfaces.d/. The script should look like the following:


    The feature will be available with openmediavault 1.11 (see http://sourceforge.net/p/openmediavault/code/1661).


    This is obsolete starting with openmediavault 4.0.18 (see https://github.com/openmediava…d3f27749566afe2ae690033a2). Simply put your custom inetrface stanzas in a file below the /etc/network/interfaces.d directory.

  • I can't quite seem to get a vlan interface to load.


    First I installed vlan, ie apt-get install vlan


    Then, I created a file called /usr/share/openmediavault/mkconf/interfaces.d/99vlan with the following contents.


    I then added 8021q to /etc/modules.


    I rebooted, but /etc/network/interfaces does not have the interface added. Neither does the OMV web interface.


    Not sure what I did wrong. Any help would be greatly appreciated.


    Eddie

  • A word of advise using this method which is good, but to be taken in account:


    If you setup static ip address in the main interface via the web panel, and you want to assign another ip address to the same interface you would simply add:


    Code
    cat <<EOF >> ${OMV_INTERFACES_CONFIG}
    # Another ip address for eth0
    iface eth0 inet static
    address 10.10.10.45
    netmask 255.255.255.0
    EOF


    This will completely overwrite /etc/resolv.conf with no dns servers, so try to match the dns servers of the main interfaces so it looks something like this




    Code
    cat <<EOF >> ${OMV_INTERFACES_CONFIG}
    # Another ip address for eth0
    iface eth0 inet static
    address 10.10.10.45
    netmask 255.255.255.0
    dns-nameservers 10.10.10.1 8.8.8.8
    dns-search lan
    EOF
  • Unfortunately, I don't get it quite. I'd like my /etc/network/interfaces file to look like:




    Can anybody please show, how the shell script in /usr/share/openmediavault/mkconf/interfaces.d/ would look like? [I am not sure, whether my interfaces file is optimal, but it does work] OMV 2.x up to date.

    OMV 4.1.13-1 (typically everything up to date), only plugin: flash memory; HP Microserver, 4 internal ext4 HDDs, SSD for OS, SD-Card for booting (can't boot on SSD with 4 HDD used …), external USB3 HDDs (ext4 + NTFS)

  • In case it's of any use to someone coming after me...


    I was trying to set up my new OMV box with a bridge on eth0, and I found this thread which says it's "no problem" but doesn't actually give any clues as to how to go about it - how the new script will interact with the GUI settings, what to put in the file etc.


    This is what I did, which seems to work.


    1. Take a backup copy of /etc/network/interfaces in case you mess up and need to restore it so you can regain access to the GUI to change things.
    2. Create a file /usr/share/openmediavault/mkconf/interfaces.d/25bridge containing:


    3. Go in to the GUI network settings and change the entry for eth0 to "Disabled". Save it and apply the changes.


    In my case, I didn't even lose connectivity to the OMV box. The bit that took a bit of checking though was setting eth0 to "Disabled". It doesn't actually disable it - it just puts an entry in /etc/network/interfaces saying that device is "manual", which is just what you want then to attach it to your bridge.


    Posting in the hope that the job will then be just that tiny bit easier for the next person to come along.

  • Just in case you haven't had coffee yet today,


    chmod u+x /usr/share/openmediavault/mkconf/interfaces.d/99myface


    (make sure the file is executable before running omv-mkconf interfaces if you're having troubles)


    :whistling:

  • Although I am having some network issues, I did want to look at the above. I am running under OMV4, so I what should I be placing in my /etc/network/interface.d? I have been battling with getting my VLAN interface working correctly and I would like to make sure that I am not goig to lose my /etc/network/interface file with a reboot.

  • i'm trying in OMV5 to add a Bridge Network to use with KVM.


    I created the following file /etc/network/interfaces.d/bridge ( and chmod +x):






    and executed the build command :



    Code
    omv-salt deploy run systemd-networkd


    i have the following output :



    ip a output :


    Somehow the build is not taking the "bridge" file into account. Any tip?

  • OMV5 uses systemd-networkd to configure the network.


    Glad to see this confirmed here. But I'm confused: why is my fresh OMV 5.5.3-1 instance nevertheless affected by changes in `/etc/network/interfaces`? It was my understanding that this file becomes irrelevant when switching to systemd.networkd. What am I missunderstanding?

  • OMV overrides the /etc/network/interfaces with a warning, see https://github.com/openmediava…etworkd/10cleanup.sls#L28. If a user still wants to use this outdated feature, then custom configurations muts be located in /etc/network/interfaces.d.

    I'm not sure I quite understand how this works. The part I understand is that changes should go to /etc/network/interfaces.d. But what I don't understand is why those changes would even be picked up by OMV when it is no longer using this outdated feature. Or is it possible to mix /etc/network/interfaces with netplan and systemd, i.e. to have some settings specified in the old system and some in the new?

  • systemd-networkd still supports the /etc/network/interfaces configuration. But i would always use systemd nowadays. OMV configures the oldstyle config file because software or users that don't want or don't know how to use systemd-networkd or netplan should not be cut off.

  • /etc/network/interfaces.d/* doesn't seem to work at all as of omv 5.5.14-1. I put some stanzas in there and nothing happens on reboot. However, the systemd network configuration locations seem to accept the old fashioned interface style stanzas fine, without wrapping them in ExecStart and the typical systemd syntax. So you can just do mv /etc/network/interfaces.d/* /etc/systemd/network and it should all work. However, it may be better long term to move everything into the correct systemd sytnax.


    As above, it would be best to update the comments in /etc/network/interfaces. Perhaps remove the

    source-directory /etc/network/interfaces.d so not as to give people the false impression that that folder will do anything.

  • /etc/network/interfaces.d/* doesn't seem to work at all as of omv 5.5.14-1. I put some stanzas in there and nothing happens on reboot. However, the systemd network configuration locations seem to accept the old fashioned interface style stanzas fine, without wrapping them in ExecStart and the typical systemd syntax. So you can just do mv /etc/network/interfaces.d/* /etc/systemd/network and it should all work. However, it may be better long term to move everything into the correct systemd sytnax.


    As above, it would be best to update the comments in /etc/network/interfaces. Perhaps remove the

    source-directory /etc/network/interfaces.d so not as to give people the false impression that that folder will do anything.

    This thread is very old. OMV 5.x uses netplan. The comment or source-directory comment in interfaces means nothing.

    omv 5.5.17-2 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.4.2
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!