Issues: Static IP + MAC address changing

    • Issues: Static IP + MAC address changing

      New

      Ok, so my goal here is to set a static IP address to my NAS running on a NanoPi M4 with OMV + Debian Stretch (latest updates installed), but I have encountered two issues:

      The cleanest way to achieve this (IMO) is to set the static IP via the router, which is perfectly possible except for the fact that my M4 changes its mac address every time it is rebooted. I searched in this forum and I found this old post from Jan 2018, but apparently the error was not reproducible so there is not much info there. Then, I searched in Armbian's forum and found 2 similar threads (one from February 2018 regarding a NanoPi Neo and one from May 2017 regarding and Opi Zero) and the suggested solution is to edit the /etc/interfaces file to hardcode the MAC address, but this thread of September-December 2018 says that editing the interfaces file is not a good idea as it may clash with whatever the Network Manager is doing.

      So, the not cleanest way (but still functional) is to set the static IP via the OMV web GUI. I encountered a loooot of issues about how changing the interfaces may break the web GUI's network section (which I think have been described a lot in this forum. See the May 2017 post mentioned above, for example), but still I managed to do it.

      The issue now is that I found that if I reboot my router (there are weeks I have to do it every day) while the M4 is on, when the router gets back and re-assigns IP addresses, apparently it ignores the static IP configuration and the N4 ends up with a completely different IP address, which is not the behavior I want.

      So, as I still prefer to set the static IP directly in the router via de MAC address, my main question is:

      How can I prevent the MAC address from changing on every reboot?

      If that is not possible (for whatever reason, which would be odd), then my question would be:

      How can I prevent the IP address from changing on every router reboot? Is it an issue with the router or with the N4?
    • New

      peguerosdc wrote:

      The cleanest way to achieve this (IMO) is to set the static IP via the router, which is perfectly possible except for the fact that my M4 changes its mac address every time it is rebooted.
      That's very true, but someone like myself for instance my router does allow me to do that nor does have the ability for mac address filtering. So for me I have to do it the old fashioned way and use a static ip address outside of the DHCP scope (this prevents ip conflicts).
      As you are experiencing issues in allowing the router to do the work the old fashioned way might be the way to go.

      If I am right your system is using Network Manager, which again is the right way :) for whatever reason I bookmarked this which should help you resolve what you are experiencing.
      Raid is not a backup! Would you go skydiving without a parachute?
    • New

      geaves wrote:

      If I am right your system is using Network Manager, which again is the right way :) for whatever reason I bookmarked this which should help you resolve what you are experiencing.
      Thanks! So I checked on my N4 and apparently the OMV web GUI configures the static IP the same way it is explained in your link, except that I found the /etc/network/interfaces file was edited directly instead of creating a new instance under /etc/network/interfaces.d/, so maybe the Network Manager is not being used (?).

      Anyway, my issue is that despite I can setup the static IP directly in the N4 successfully, the configuration doesn't survive router reboots as the N4 ends up with a different IP address given by the DHCP. That's really the issue I want to overcome (or to find a way to set the MAC address).
    • New

      peguerosdc wrote:

      Anyway, my issue is that despite I can setup the static IP directly in the N4 successfully, the configuration doesn't survive router reboots as the N4 ends up with a different IP address given by the DHCP.
      If you set the static ip in the GUI that will add it directly to /etc/network/interfaces, if that does not survive a reboot then the N4 is using Network Manager so you would have to edit both files to set the static ip which the link explains.
      Raid is not a backup! Would you go skydiving without a parachute?
    • New

      Still not working. I've just set the interfaces file to:

      Source Code

      1. # The loopback network interface
      2. auto lo
      3. iface lo inet loopback
      4. iface lo inet6 loopback
      5. # eth0 network interface
      6. allow-hotplug eth0
      7. # Include additional interface stanzas.
      8. source-directory interfaces.d
      And created the new file with the static IP address:

      Source Code: /etc/network/interfaces/interfaces.d/eth0

      1. iface eth0 inet static
      2. address MY IP ADDRESS
      3. gateway MY GATEWAY
      4. netmask THE NETMASK
      5. iface eth0 inet6 auto
      6. privext 2
      7. pre-up echo 1 > /proc/sys/net/ipv6/conf/$IFACE/autoconf
      8. pre-up echo 1 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra
      9. pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/disable_ipv6
      Rebooted the N4 and got the static IP address that I set (which was already the result I had), but still the IP address is changing whenever the router reboots.
    • New

      peguerosdc wrote:

      but still the IP address is changing whenever the router reboots.
      What's the router?

      My OMV uses a static IP, if I reboot OMV nothing changes, if I restart my router (which I very rarely do) it doesn't issue an IP address to OMV because the static IP is in the routers IP table.

      EDIT: If you used the solution from the Nano Pi Neo and added a Mac address to the /etc/network/interfaces, then create the static IP in the router with that MAC address that should resolve it? But you would have to remove the static IP from the GUI and/or at least from the two config files.
      Raid is not a backup! Would you go skydiving without a parachute?

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

    • New

      geaves wrote:

      EDIT: If you used the solution from the Nano Pi Neo and added a Mac address to the /etc/network/interfaces, then create the static IP in the router with that MAC address that should resolve it? But you would have to remove the static IP from the GUI and/or at least from the two config files.
      So, I removed the static IP from both config files I had edited and from the web GUI and was preparing to set the MAC address with the NanoPi Neo's solution when I found in the OMV docs / Advanced Configuration site that editing the interfaces file directly is a bad idea as "The file /etc/network/interfaces will be (re-)generated by openmediavault on demand. Thus custom changes that are done by the user will get lost." and they suggest to add any custom configuration to an executable script located at "usr/share/openmediavault/mkconf/interfaces.d/", so I put the NanoPi Neo's code snippet into that script and followed the instructions on the doc, but it didn't work.
      Apparently, it was just being ignored and the MAC address was still randomly generated, but I found out that just by adding the configuration to the custom file in the /etc/network/interfaces.d/ folder does the trick, so that's how I have it now. The MAC address doesn't change anymore and I can set the static IP directly in my router's table.

      Thanks for your support!