When it comes to troubleshooting an issue on any Linux flavor, at times, it becomes very confusing with respect to the commands/syntax, etc as there is infinitesimal difference. However, here is what you need to do if you hit an issue where in Ubuntu VM loses IP Address after every reboot.
Ubuntu Version: To view maximized version of below image click here
1. Deployed Ubuntu VM with IP Address configured to be assigned by DHCP Server
2. Updated the repository using sudo apt-get update command
3. Rebooted the VM & observed SSH connection could not be established
4. Checked through VM Console, there was no IP for the interface ens160
5. Checked that contents in /etc/network/interfaces doesn’t have the entry for ens160, however, confirmed that a similar VM in the same resource pool had the same contents & still ens160 got the IP Address after rebooting the VM.
6. Any other commands you try (like ifup or ifdown), it returns unknown interface ens160
Ran below command, post which ens160 got IP Address from DHCP Server, however, it doesn’t stay persistent upon reboot.
sudo dhclient ens160
Add below entry to /etc/network/interfaces file
iface ens160 inet dhcp