Hello everyone,
I’m facing a persistent networking issue while setting up Moodle on Ubuntu running inside VMware ESXi, and I’m looking for guidance or best practices from the community.
Environment
-
Hypervisor: VMware ESXi 8
-
OS: Ubuntu Server 20.04 / 22.04
-
Application: Moodle (Frontend VM)
-
Network Type:
-
Public IP:
117.x.x.x -
Private Network:
172.16.1.0/24
-
-
Interface:
ens34 -
Network Manager: Netplan + cloud-init
Problem Description
I attempted to assign a static private IP to the Moodle frontend VM so it can communicate with the database VM.
What happens:
-
Static IP works temporarily after applying netplan.
-
After reboot:
-
IPv4 disappears completely.
-
Only IPv6 (
fe80::) remains. -
ip ashows no IPv4 address.
-
-
netplan applyworks but the IP is lost again after reboot. -
The VM automatically reverts to a public IP (117.x.x.x).
-
Ping to DB server (
172.16.1.27) fails. -
Moodle frontend becomes unreachable.
⚠️ Observations
-
Netplan configuration is correct but not persistent.
-
Cloud-init appears to overwrite network settings.
-
ESXi seems to control the NIC behavior.
-
Static IP cannot be retained on reboot.
-
Interface resets even after:
-
Disabling NetworkManager
-
Recreating netplan files
-
Fixing file permissions
-
Flushing interfaces
-
❓ What I’m Trying to Understand
-
What is the correct way to assign a private IP to a VM in ESXi?
-
Should the private IP be configured in:
-
ESXi port group?
-
Netplan only?
-
A second NIC?
-
-
Is it wrong to assign a static IP when the VM is attached to a public network?
-
How should Moodle frontend + DB networking be designed properly?
Goal
I want:
-
Moodle frontend to run on Public IP (117.x.x.x)
-
Database to remain private
-
Network config to persist after reboot
-
No IP reset or loss after restart
Any advice, best practices, or architecture suggestions would be very helpful.
Thanks in advance! 🙏