While doing some NAT/private IP experiments with my experimental Virtualmin installation, I found the following problem:
The Vmin VM was reconfigured from a public IP to a private 10.* one.
I changed the option "System Settings / Virtualmin Configuration / Networking Settings : Default IP address for DNS records" to reflect the public IP, which gets forwarded to the private one via 1:1 NAT in a router.
Virtualmin noticed the primary IP address change and ushered me to the "Addresses and Networking / Change IP Addresses" dialog. I used that dialog to fix the IP address.
Result: Not only the virtual servers in Apache were IP-changed to the 10.* one, but also the BIND A records, despite the "Default IP address" setting above. Fail. ;)
(Creating new servers works okay: Apache gets the 10.* IP and BIND the public one.)
Submitted by JamieCameron on Sat, 11/24/2012 - 16:40 Comment #1
So the warning and dialog to change your IP addresses should only be invoked when the actual address of eth0 changes .. not if your external IP changes (which is what the "Default IP address for DNS records" controls).
However, if you switched eth0 from an external to internal IP, then when the IPs are changed any DNS records that were on the old eth0 IP would be switch to the new eth0 IP. The simplest fix (till I figure out a better way to handle this) would be to set the correct external IP for the domain at Edit Virtual Server -> Configurable Settings -> External IP address.
Submitted by Locutus on Sat, 11/24/2012 - 17:16 Comment #2
Yeah, the actual address of eth0 in fact did change, from the external to an internal IP. So the invocation of the Change dialog was all okay.
Your suggested quick fix would require me to go into each virtual server, which can be quite a lot. :) I used Webmin's BIND module, command "Update Records in Selected", to quickly change all A records from the wrong to the correct IP.
Just wanted to let you know about this bug (or at least unfortunate behavior) so that you can take care of it.
A possible way to fix it might be having separate edit boxes for "IP Address" and "Zone Address Records IP Address" in the "Change IP Addresses" function, and pre-populate the latter with the one from "Default IP address for DNS records" in the configuration.
Submitted by JamieCameron on Sat, 11/24/2012 - 19:16 Comment #3
You could also make the mass change with the shell command :
virtualmin modify-dns --all-nonvirt-domains --dns-ip a.b.c.d
Unfortunately, in a case like this Virtualmin doesn't really have any way of knowing that you wanted to keep the old IP for DNS records. So running the command above before or after changing your
eth0IP is the only correct solution.