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

    • OMV 1.0

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 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:

      Shell-Script

      1. #!/bin/sh
      2. #
      3. # This file is part of OpenMediaVault.
      4. #
      5. # @license http://www.gnu.org/licenses/gpl.html GPL Version 3
      6. # @author Volker Theile <volker.theile@openmediavault.org>
      7. # @copyright Copyright (c) 2009-2015 Volker Theile
      8. #
      9. # OpenMediaVault is free software: you can redistribute it and/or modify
      10. # it under the terms of the GNU General Public License as published by
      11. # the Free Software Foundation, either version 3 of the License, or
      12. # any later version.
      13. #
      14. # OpenMediaVault is distributed in the hope that it will be useful,
      15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
      16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      17. # GNU General Public License for more details.
      18. #
      19. # You should have received a copy of the GNU General Public License
      20. # along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
      21. set -e
      22. . /etc/default/openmediavault
      23. . /usr/share/openmediavault/scripts/helper-functions
      24. OMV_INTERFACES_CONFIG=${OMV_INTERFACES_CONFIG:-"/etc/network/interfaces"}
      25. cat <<EOF >> ${OMV_INTERFACES_CONFIG}
      26. # The loopback network interface
      27. auto lo
      28. iface lo inet loopback
      29. iface lo inet6 loopback
      30. EOF
      Display All
      The feature will be available with openmediavault 1.11 (see sourceforge.net/p/openmediavault/code/1661).

      This is obsolete starting with openmediavault 4.0.18 (see github.com/openmediavault/open…d3f27749566afe2ae690033a2). Simply put your custom inetrface stanzas in a file below the /etc/network/interfaces.d directory.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • 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.

      Shell-Script

      1. #!/bin/sh
      2. #
      3. # This file is part of OpenMediaVault.
      4. #
      5. # @license http://www.gnu.org/licenses/gpl.html GPL Version 3
      6. # @author Volker Theile <volker.theile@openmediavault.org>
      7. # @copyright Copyright (c) 2009-2015 Volker Theile
      8. #
      9. # OpenMediaVault is free software: you can redistribute it and/or modify
      10. # it under the terms of the GNU General Public License as published by
      11. # the Free Software Foundation, either version 3 of the License, or
      12. # any later version.
      13. #
      14. # OpenMediaVault is distributed in the hope that it will be useful,
      15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
      16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      17. # GNU General Public License for more details.
      18. #
      19. # You should have received a copy of the GNU General Public License
      20. # along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
      21. set -e
      22. . /etc/default/openmediavault
      23. . /usr/share/openmediavault/scripts/helper-functions
      24. OMV_INTERFACES_CONFIG=${OMV_INTERFACES_CONFIG:-"/etc/network/interfaces"}
      25. cat <<EOF >> ${OMV_INTERFACES_CONFIG}
      26. # The vlan network interface
      27. auto eth0.2
      28. iface eth0.2 inet dhcp
      29. EOF
      Display All


      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
    • You have to build the new file with

      Source Code

      1. # omv-mkconf interfaces
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • 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:

      Source Code

      1. cat <<EOF >> ${OMV_INTERFACES_CONFIG}
      2. # Another ip address for eth0
      3. iface eth0 inet static
      4. address 10.10.10.45
      5. netmask 255.255.255.0
      6. 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



      Source Code

      1. cat <<EOF >> ${OMV_INTERFACES_CONFIG}
      2. # Another ip address for eth0
      3. iface eth0 inet static
      4. address 10.10.10.45
      5. netmask 255.255.255.0
      6. dns-nameservers 10.10.10.1 8.8.8.8
      7. dns-search lan
      8. EOF
      New wiki
      chat support at #openmediavault@freenode IRC | Spanish & English | GMT+10
      telegram.me/openmediavault broadcast channel
      openmediavault discord server
    • Unfortunately, I don't get it quite. I'd like my /etc/network/interfaces file to look like:


      Source Code

      1. # The loopback network interface
      2. auto lo
      3. iface lo inet loopback
      4. # Configure LACP
      5. auto bond0
      6. iface bond0 inet dhcp
      7. bond-slaves eth0 eth1
      8. bond-mode 4
      9. bond-miimon 100
      10. bond-updelay 800
      11. bond-downdelay 400
      Display All

      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.
      HP Microserver, 4 x 6 TB WD Red ext4, no RAID, 4 USB3 drives (ext4 + NTFS), OMV 4.1.8.2-1 , SSD for OS, SD-Card with Grub
    • 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:

      Shell-Script

      1. #!/bin/sh
      2. set -e
      3. . /etc/default/openmediavault
      4. . /usr/share/openmediavault/scripts/helper-functions
      5. OMV_INTERFACES_CONFIG=${OMV_INTERFACES_CONFIG:-"/etc/network/interfaces"}
      6. cat <<EOF >>${OMV_INTERFACES_CONFIG}
      7. auto br0
      8. iface br0 inet static
      9. bridge_ports eth0
      10. address <your ip address>
      11. netmask <your netmask>
      12. network <your network>
      13. broadcast <your broadcast address>
      14. gateway <your gateway>
      15. dns-nameservers <your dns servers>
      16. dns-search <your domain>
      17. EOF
      Display All
      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:
      :cursing: Intel NUC Kit DE3815TYKHE My NAS build / ARK
      Atom E3815 1.46GHz4GB RAM • 1TB SSHD • 4GB eMMC
      OMV 3.x | OMV-Extras | Flash Memory | Pi-hole

      RPi/3 №1: LibreElec 8.xRPi/3 №2: SickRage, PiVPN, noip2
    • The iscsitarget software is divided in two parts. The userland tools and the kernel modules both are provided by Debian repository system. Kernel modules are come in the form of DKMS. The upstream software is mantained in sourceforge. Debian only provides packages up to Jessie, this is because the DKMS modules do not built in kernels higher than 4.x. The last commit upstream was in 2010, right now iscsitarget is abandoned software. ShowBox VidMate Mobdro

      The post was edited 1 time, last by athman8 ().