|OS type and version
||Windows 11 Pro running Ubuntu 20.04 on WSL2
Hi i’m Running Virtualmin on Ubuntu within Windows WSL2. Every time I restart my machine/WSL the IP address of WSL2 changes, which is not great but is fine as its expected (WSL2 flaw no static IP).
When I startup Webmin ‘sudo services webmin start’ and then login via the browser I get the warning: ‘Warning! Your system’s primary IP address appears to have changed from (IP address) to (IP address)’
I click ‘update IP addresses’ for both of my virtual servers, start APACHE2 and MYSQL and it works fine.
So my question:
How can I automate this process so I don’t have to click ‘update IP addresses’ and Virtualmin just does this automatically every time it starts up for my virtual servers?
I will be forever in your debt as this issue has consumed a lot of my time so far.
Search for “dynamic IP”.
There are a couple of possible solutions. Probably best to just use no IP for your virtual hosts.
But, also, maybe just don’t use a dynamic IP. Since this is certainly, I hope, not a production server and you’re just using it for development, just give your system a local IP alias that never changes and use that one for Virtualmin virtual hosts.
Thats not quite what i’m asking.
WSL2 does not support having an internal static IP.
DDNS in the manner you have suggested is not possible within WSL2 as it is not an ip address on my routers dns.
What I am asking in other words as above, the prompt that virtualmin gives : Warning! Your system’s primary IP address appears to have changed from (IP address) to (IP address)’
I click ‘update IP addresses’ and all is good.
Rather than me ‘click’ the button to update, is there an option for this to happen automatically within virtualmin or could it be a possible settings toggle to be added as a feature request.
And, I told you the simplest way to solve it: Don’t use an IP. In Virtualmin Configuration->Defaults for new domains->Address format for Apache virtual hosts choose
You’ll need to update existing virtual hosts to use
Apologies I misinterpreted your original message.
I’ve nailed it! Partly…
I’ve figured it out however there is 1 more thing to nail the finish line:
So I managed to amend the Apache virtualhost to use * instead of an ip address, however I had to do this via command line ‘sudo nano /etc/sites-available/ [domain name].conf’. In webmin under apache virtual hosts the config files ‘edit directives’ didnt have the virtualhost directive inside?
So that last issue is I boot up now, the virtual sites load in the browser on boot.
I do however still get the notification ‘Your system’s primary IP address appears to have changed from…to…’.
I assume if I click 'update incorrect IP address it will remove * and add IP address to config file.
How do I stop the amber notification on Webmin boot?
Thankyou for your patience,
Hmm…That shouldn’t be happening if you set it to always use
*. I’m not sure what to make of that.
I assume you are either not using the DNS feature (because you can’t host DNS on a dynamic IP) or you’ve configured management of some dynamic DNS service (like DynDNS) in Virtualmin? (And, if you were using the DNS feature, you’d need it to use the public IP, rather than the private one.)
@Jamie why would this IP change warning persist after switching to
* for VirtualHosts?
In response to your question, What is the DNS feature your referring to? I havent configured anything ‘within’ virtualmin in that sense. I have a dynamic IP address already setup with no-ip within my router. The DDNS is refreshed and always points to my routers IP as I dont have a static IP from my ISP.
Essentially I have migrated my two virtual Ubuntu 20.04 webservers INTO Virtualmin as before I configured and maintained them manually via command line.
I assume I guessed right, if i click the 'ipdate IP address button it will rewrite my apache config file and replace * with an IP address?
In Features and Plugins, is the DNS feature enabled? It should not be, if you are not managing DNS with Virtualmin (Virtualmin can manage dynamic DNS via DynDNS, but that won’t be useful in your case, I don’t think, since you’re not hosting on the public dynamic IP but a non-routable local one).
BIND DNS domain is checked? I havent changed any of these things since I installed virtualmin.
DNS management is enabled, by default, because we assume you’re running on a server on a public IP and want Virtualmin to manage everything you need to manage a website with all the accoutrement. You obviously are not the usual case for Virtualmin.
So, disable the features that do not fit your deployment. You also probably don’t want mail processing features enabled, as they’re extremely resource intensive and you can’t realistically run a mail server on a dynamic IP (your host probably doesn’t even allow port 25).
Unless, of course, you’ve configured Virtualmin to manage your DynDNS records. But it sounds like you’re handling that separately (and I don’t know that it’d work in your deployment, anyway).
So I tried to disable BIND DNS domain and got the failed response below for both of my virtual servers:
Yes, you can’t disable a feature that is in use. You’ll need to disable it for those domains first. There’s a bulk update feature (in List Domains), but it might only be in Pro. You can also update all virtual hosts using the command line client in a shell script. But, if you’ve only got a few (as I imagine must be the case in a dev environment like this), you can just go to the domain and turn it off. Select the domain in the dropdown, click Edit Virtual Server, and uncheck “DNS domain enabled” in the “Enabled features” section.
Wow it never ends lol. So I did what you asked, restarted WSL. and got the same prompt that the IP address had changed. only this time when I go to my virtual servers web address I was met with the below screen for nextlcoud:
I have re-enabled bind dns and I still get the same screen so I am now going to restore the whole thing from a backup.
DNS feature has nothing to do with the NextCloud error. (And, it also almost certainly has nothing to do with the change to
* for VirtualHosts…if it did, you’d get the wrong site, not an error from the app in the site.)
You’ll need to look at the error log for that domain to know why it’s failing.
Just checked again. as soon as I uncheck ‘DNS Domain enabled’ I get that error. And I STILL get the prompt that IP address’s have changed:
Yeah, I’m not sure why at this point. It seems bug-like. I’ve asked Jamie to chime in, as he’d know what else it’s looking at.
No problem, I’ll wait for an update.
Virtualmin still wants to know what each domain’s IP address is, even if it’s not used in the Apache or DNS configs, because you might enable DNS for a domain later. I think what we need is a command-line tool to do these IP updates that you can run at boot time …
In the next release, I’ll add an API command called
modify-all-ips that can be called from a shell script at boot time to correct Virtualmin’s IP records in a situation like this.