Virtualmin: Default IPv4 Address of 127.0.0.2

If you’ve installed Virtualmin on your fresh VPS, ran through its initial checks, and then try to add a new Virtual Server only to find that it keeps detecting and setting 127.0.0.2 as the default IPv4 address, here’s how to fix this problem.

For reference, you can determine the proper network interface to use by going to Webmin -> Networking -> Network Configuration -> Network Intefaces, which will bring you to the screen you see here.

Webmin - Network InterfacesThe line that has the red marker blocking out the IP would be the one of importance. This should be where your actual external IPv4 address is shown. Due to the fact that this seems to be an issue mainly for OpenVZ VPS servers, it’s likely that the interface will be the same for you as it is in my example: venet0:0.

To fix the issue, head over to Virtualmin -> System Settings -> Virtualmin Configuration, and then in the drop-down menu at the top of the page select Network settings. There’s a chance that the value for Network interface for virtual addresses will be defined rather than being set to Detect automatically. If so, it will likely beĀ venet0. Either way, the setting needs to be changed. This is what the configuration page looks like in my situation.

Virtualmin - Network Configuration (Original)It needs to be changed to whatever interface was configured with your real external IPv4 address from the Network Interfaces section in Webmin – which is likely venet0:0, as already mentioned. Whatever the case, manually set the interface to whatever it is for your situation and click Save.

Virtualmin - Network Configuration (Changed)As soon as the change is applied and the page reloads, Virtualmin should display an alert informing you that the primary address has changed and virtual servers using the incorrect address may be unreachable or serving the wrong material. Simply click the button Update Incorrect IP Addresses to have Virtualmin bring you to the configuration page where you can correct the address for all Virtual Servers you have configured simultaneously.

Virtualmin - Update Incorrect IP AddressesThe Change IP Addresses configuration page should have all necessary changes automatically populated for you. You should only have to hit the Change Now button to apply the changes and complete the process.

Virtualmin - Change IP AddressesI hope this helps.