Hi all :)

Apologies for the long writeup, but I’m not sure if the background is important or not.

I’ve got a media server currently running Xubuntu (getting ready to be transitioned to a proper server OS before anyone asks), and I’ve been having a problem with static IP addresses.

About a year ago I was having a problem with the ethernet card switching from a static IP to DHCP, and screwing up the services that depended on the IP address. It appeared to be a problem with my ISP router (BT SmartHub 2). I thought I’d fixed it, and didn’t have any trouble for a while.

I added a second ethernet card to split my traffic. My VPN doesn’t allow split tunneling on Linux, and I wanted some traffic to go through the VPN while some bypassed it. I hadn’t set anything up for that yet, but did give the second ethernet card a static IP address. I changed the DNS servers on both to go through my AdGuard installation on the same machine, and some other ad blocking DNS servers.

When I first installed the second ethernet card I had a few problems, but my network switch died at the same time, and replacing it appeared to cure the issues. The issues were similar to before, in that I couldn’t get a static IP to stick.

To now - Last night we were having some power issues in the area, power surges and brownouts. In the time that it took me to get to my PC and log in to the media server to shut it down, it had rebooted at least three times. I shut everything down successfully, and after I turned everything back on this morning, the services like Plex that don’t need the IP all seemed to be working properly.

After my kid went to bed, I tried to log onto the server to check it. Nothing that needed the IP address would work. I tried the second IP address and that was the same. I managed to log in with NoMachine and saw that there were two new ethernet connections, both set to DHCP, and they were being used instead of the previous connections. The previous connections apparently haven’t been used for the last six days.

I tried deleting one of the new connections to see if it would force Xubuntu to use the old ones, and it seemed to work, but deleting the second one cut off the network connections completely. After connecting a monitor and peripherals to the server, I could see an option for an Auto Connection in the network dropdown menu, and that let me connect again.

My previous connections are still in the network manager with all the static IP settings, but there are two new Auto Ethernet connections too, using DHCP.

Can anyone give me a clue as to what’s happened here please? I thought it was a problem caused by the power problems, but it’s apparently been going on for almost a week.

Apologies in advance if I’m slow to reply for the next few days, and thank you in advance for any help :)

  • pete_the_cat@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    11 months ago

    One of the network managers is apparently set to enable DHCP on the interface it manages, that’s the only reason that I can think of why a device set with a static IP is switching to using DHCP.

    You’re going to want to check the systemd units (sudo systemctl list-unit-files --state=enabled, if that doesn’t work you can replace the state flag with –no_pager and grep for enabled ) to see what is managing the interface(s) and then ensure that their config is set to static. You may have two conflicting services like systemd-networkd and NetworkManager fighting.

    • Tippon@lemmy.dbzer0.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      Thanks, I’ll try that tonight and see how it’s set up.

      P.S. Apologies for the slow reply, I accidentally switched accounts and didn’t see the replies here.

        • Tippon@lemmy.dbzer0.comOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          11 months ago

          I couldn’t see anything obvious, but I noticed something else

          I noticed last night that the ethernet adapters changed, and the static profiles didn’t update to match. The adapters were named something like enp6so, but used to be enp2so, for example.

          The DHCP profiles matched the new device names, and the static profiles were stuck on the old names.

          Changing the static profiles to match the updated device names and deleting the DHCP profiles seems to have worked for now, but I don’t know why they changed in the first place.

          • pete_the_cat@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            11 months ago

            Glad that helped you, they shouldn’t be changing since the names are based on their location in the PCI bus instead of being generic (eth0, eth1, etc…). IIRC you can specify udev rules to name the devices what you want using UUIDs or something that way you’ll always know what they’re called. I’d suggest reading about Ethernet device naming in Linux if you want to know more.

            • Tippon@lemmy.dbzer0.comOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              10 months ago

              I’ve always dealt with names like eth0 and eth1 in the past, but now I’m only getting enp2s0 and enp5s0. I assumed that it was something that had changed over the last few years that I hadn’t noticed, but I’ll look into it further. Thanks :)

          • pete_the_cat@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            11 months ago

            Glad that helped you, they shouldn’t be changing since the names are based on their location in the PCI bus instead of being generic (eth0, eth1, etc…). IIRC you can specify udev rules to name the devices what you want using UUIDs or something that way you’ll always know what they’re called. I’d suggest reading about Ethernet device naming in Linux if you want to know more.

  • SteveTech
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    11 months ago

    Have you disabled auto start in the DHCP profile?

    Edit: Also you should probably think about getting a cheap UPS if you can afford it, if your power is that bad during storms.

    • Tippon@lemmy.dbzer0.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      Apologies for the slow reply, I accidentally switched accounts on here without realising >.<

      Have you disabled auto start in the DHCP profile?

      I have no idea. That’s a setting that I didn’t know existed until now. I’ll have a look tonight and see if I can find it.

      The power here is usually fine, but a transformer blew during the storm, and the one I’m on apparently took some of the strain.

      • SteveTech
        link
        fedilink
        English
        arrow-up
        2
        ·
        11 months ago

        Apologies for the slow reply

        No worries, I’m also not that much of a fast replyer.

        Have you disabled auto start in the DHCP profile?

        I probably could have been a bit clearer what I mean too: Those profiles with DHCP enabled in network manager should have a ‘Connect automatically’ toggle, maybe try just turning them off instead of deleting them, and make sure they’re turned on for the static IP profile.

        I also haven’t used Xubuntu in a while, and this is mostly for Debian KDE and Ubuntu, so I’m hoping it’s the same.

        • Tippon@lemmy.dbzer0.comOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          11 months ago

          I thought that might have been it. The DHCP profiles didn’t exist last time I looked, but the static address profiles were set to auto start.

          I noticed last night that the ethernet adapters changed, and the static profiles didn’t update to match. The adapters were named something like enp6so, but used to be enp2so, for example.

          The DHCP profiles matched the new device names, and the static profiles were stuck on the old names.

          Changing the static profiles to match the updated device names and deleting the DHCP profiles seems to have worked for now, but I don’t know why they changed in the first place.