Ethernet interface always reverts to DHCP

I’m a BSD guy playing around with EndeavourOS in a vm. Very cool, but I’ve hit a snag. When I first installed, it leased an ip by DHCP. Now I’m trying to set up a static ip and route, but the system will not save my configuration. At every reboot, it reverts to the address it initially leased. If I use the gui network manager to disconnect and reconnect the ethernet interface thereafter, it will pick up my static configuration and work as intended. It seems I need to turn off DHCP somewhere for this interface, but I have yet to find it. Any ideas?

I think maybe before setting static ip

systemctl stop dhcpd.service


systemctl disable dhcpd.service

Edit: Welcome to EndeavourOS

First off, what is the host computer OS for the vm, I am not sure if one can set a static IP in a vm and have it keep it as I assume the host computer is on DHCP or a different Static IP address. I know very little about vm’s, but I am sure there are more knowledgeable people here that can address that.

Since I am not sure what “If I use the gui network manager to disconnect and reconnect” means, I will start with the obvious.

An EdeavourOS install includes an app called “Advanced Network Configuration”. Click on that and you will get the left window. Highlight the network, click the options button in the lower left of the window, and get the window on the right.

Choose the IPv4 Settings tab and enter your information. Then click the Save button.

If you have already tried this, or it doesn’t work, we might try to eliminate Network Manager and use netctl which is what I use for my servers. netctl is much simpler and uses a configuration file that the user has complete control of.


Copy Cat EDIT:
Welcome to the forum. Thanks for giving EndeavourOS a try. I hope you enjoy your time here.

Well that line flew right over my head even though i read it. (vm) Wasn’t even thinking about that after reading the rest of the post. You are likely right and i don’t think you could have dhcp on the host and static on the vm? Not sure if that is what the OP was intending or not? I took it as setting the host. :man_shrugging:

1 Like

Not an expert at all when it’s up to networking, but maybe setting up a network bridge could solve the problem.

Pretty sure you can. At work, I work with a machine (for learning purposes) running Hyper-V, with DHCP enabled, and in any VM (Windows 10 and Windows Server, both 2016 and 2019) I can have DHCP or static. I hate assuming, but I’d be surprised if the same wouldn’t apply to other hosts, other hypervisors, and other guests. I haven’t tried this though, and I have zero experience with any BSD, so it’s not much more than an educated guess.

My guess would indeed be to simply disable dhcpd like you said in your first reply.

My impression is that OP has BSD running as the host, and EOS as a guest, and that it’s EOS he wants to do this in.

1 Like

You correctly guessed the gui network manager to which I referred. My configuration in the section you showed is ignored, as I described in my earlier post. When I said I use the gui to connect and reconnect, I meant I can click the ethernet icon in the system tray, choose disconnect, then immediately reconnect in the same way, and my configuration is then observed.

To clarify the networking, the interface on the vm is bridged to the internal network. So it should be able to set a static IP address just like any other device on the subnet.

1 Like

Correct, I’m talking about the EOS settings, which is the guest in this case.

Okay then …my original idea may be okay then. Easy to try. :wink:

I tried:

# systemctl stop dhcpd.service

Apparently it wasn’t running:

Failed to stop dhcpd.service: Unit dhcpd.service not loaded.

For good measure, I made sure it wasn’t enabled but stopped:

# systemctl disable dhcpd.service

I got:

Failed to disable unit: Unit file dhcpd.service does not exist.

I guess i would be looking at the vm documentation that you are using in BSD. As an example here is some info. I’m not sure if this is helpful or not?

From my perspective, this seems to have nothing to do with the vm host. The static ip configuration is done on the guest (EOS), and the host bridges its interface to my LAN. It has no problem soliciting and receiving a lease from the LAN’s DHCP server, and no problem assigning the static address after I have disabled and enabled the interface manually through the gui. But for some reason, EOS is disregarding the configuration done through the gui after boot. I am only slightly familiar with the boot process involved here, but it seems to me that some other mechanism is assigning an address to this interface.

Coming from my (limited) experience: have you created a different (virtual) network adapter dedicated for the VM? Because as far as I know if you use the same network adapter for the host and the guest then the guest will always revert to DHCP (or in some cases not even switch to static, depending of the guest OS).

I couldn’t follow your logic here. The network interface EOS sees is bridged by the vm host to my real LAN. It’s as common a configuration as there is. The vm guest is able to communicate with this network just fine, but something is causing it to solicit an address by DHCP instead of observing the saved configuration, which indicates a static ip and default route.

How exactly are you setting this up? What vm is it running on? Do you set static ip for it in your router?

In this case, EOS is the guest in VMWare Fusion on macOS 11.4, which is running on a machine connected by ethernet to my LAN. No router configuration is required to bring up this kind of guest bridged to the network. To cut to the chase, this is a configuration issue within EOS. There are many other guest systems running on that same host with every kind of network setup, from bridged to the LAN to routed to a private subnet.

I have no problems with an Arch guest on the same host. EOS only. That’s why I came here. Basically EOS provides this gui network manager, which I am using, but its configuration is being ignored or superseded.

From the Arch wiki.

Static IP address settings revert to DHCP

Due to an unresolved bug, when changing default connections to a static IP address, nm-applet may not properly store the configuration change, and will revert to automatic DHCP.

To work around this issue you have to edit the default connection (e.g. “Auto eth0”) in nm-applet, change the connection name (e.g. “my eth0”), uncheck the “Available to all users” checkbox, change your static IP address settings as desired, and click Apply. This will save a new connection with the given name.

Next, you will want to make the default connection not connect automatically. To do so, run nm-connection-editor (not as root). In the connection editor, edit the default connection (e.g. “Auto eth0”) and uncheck “Connect automatically”. Click Apply and close the connection editor.

1 Like

That’s quite a bug! For my purposes, this won’t work (too messy), but I appreciate everyone’s time and help. I’ll continue tinkering with EOS.