Main IP Address Changing After Reboot

Hi everyone,

I’m facing an issue with my server’s IP configuration.

I initially set up my server with one website using the main shared IP, and everything worked fine. Then, I added two more websites, each with its own dedicated IP address, and they also worked without issues.

However, after rebooting the server, the last configured IP is being considered the main IP, while the original main IP is treated as an additional IP. This causes a problem when I try to add new websites to the main shared IP, as one of the dedicated IPs is being used as the default shared IP instead.

I attempted to set the main IP as static instead of using DHCP, but after applying the configuration and rebooting, the server becomes unreachable. I then have to use my hosting provider’s rescue feature to revert the changes.

Has anyone encountered this issue before? Any advice on how to properly configure the main IP to remain consistent after a reboot?

Thanks in advance!

SYSTEM INFORMATION
OS type and version Debian Linux 12
Webmin version 2.202
Virtualmin version 7.30.4
Webserver version nginx

From my experience this has been like this ubuntu 20.04 (when netplan became the default ? ) as ubuntu is a derivative of debain I guess the same applies, I reported this back then but nothing came of it so I use a work around that sets the original ip as the default. That said the way I worked this out was to save the original netplan config to another file then make changes to the current file using webmin and working out the differences and then adjusting the config from a mixture of what webmin wrote and the original

Yeah, I think Linux always had a ‘peculiar’ way of handling address order. I ran into it years ago when adding additional network cards. Not sure this helps but what does this show?

The way webmin does this is by adding a virtual to the existing network interface rather than a secondary interface it was fine before netplan, but fails when you use netplan

Is there anything indicating this user is using netplan? I don’t think that’s common on Debian. If there are still issues with netplan support in Webmin/Virtualmin, make a new topic, as we’d like to fix it. But, I think it’s off-topic for this thread.

You shouldn’t change your network configuration on a system at a hosting provider. Network configuration on a server owned by someone else is generally none of your business, and nothing you do can make things better.

If the configuration they provided doesn’t work in a reasonable way, you should talk to the provider about it. You can’t make their network (routing, firewall, etc.) operate in any way different than what they’ve configured…so, if you change your system network configuration, you should expect it to lose connectivity.

[quote=“Joe”]
Is there anything indicating this user is using netplan? [/quote]

the server is indeed using netplan.
On webmin’s network configuration page, it says: Network config type: Netplan. Also, the file /etc/netplan/50-cloud-init.yaml gets updated whenever I change something on this network configuration page.

is there any way to force the main IP to stay as it ? here is the configuration I have on “activated at Boot” and on “Active Now”


Are those netmasks correct? On is a /32 and the others a /24.

The IPs should be /24, but the main IP—used as a virtual IP from DHCP—is listed as /32 for some reason. Changing all the IPs to /32 doesn’t make a difference; the main IP is still treated as a virtual IP.

As a workaround, I removed the additional IPs from the configuration file and created a bash script that I trigger with a service once the main IP is configured via DHCP. It’s a bit of a dirty solution, but it works. Hopefully, someone can suggest a cleaner method ?