Ubuntu Azure Tips

Migrating Ubuntu to Azure

Ubuntu 18.04 LTS

With the release of 18.04LTS, network configuration was moved over to netplan, from the old school /etc/init.d/network config file.

When the VM is on VMware the network adapter type is typically ens160 or ens32. However the Azure network card shows up as eth0. So in order for the machine to pull a dhcp assigned address you will need to add a netplan YAML file that sees the network adapters that are hyperv adapters and tells them to be DHCP.

On your Ubuntu 18.04LTS machine, change the working directory to /etc/netplan

[bash]cd /etc/netplan/[/bash]

Next we want to create/edit a new file called “90-hotplug-azure.yaml”

[bash]nano 90-hotplug-azure.yaml[/bash]

paste in the following information

[bash] # This netplan yaml is delivered in Azure cloud images to support # attaching and detaching nics after the instance first boot. # Cloud-init otherwise handles initial boot network configuration in # /etc/netplan/50-cloud-init.yaml network: version: 2 ethernets: ephemeral: dhcp4: true match: driver: hv_netvsc name: ‘!eth0’ optional: true hotpluggedeth0: dhcp4: true match: driver: hv_netvsc name: ‘eth0′[/bash]

Next save the file.

While we are editing configuration files we will also want to modify grub, and turn on the serial console, which is invaluable if you need to troubleshoot in Azure.

Edit the /etc/default/grub file and inset the following:

[bash]GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300"[/bash]

Then update grub with:

[bash]update-grub[/bash]

That’s about it. Now you can use Zerto to do a test failover of the VM, and you should be able to access the test VM in Azure.

Loading