Introduction
This article aims to help users who encounter an issue with their Ubuntu Virtual Machine (VM) in Hyper-V after upgrading their host machine. Specifically, this article covers the scenario where the Network Interface Card (NIC) of the Ubuntu VM fails to obtain an IP address after the upgrade.
Hyper-V and Ubuntu
Hyper-V is a native hypervisor for Windows 10 Pro and Enterprise, which allows users to create and manage virtual machines (VMs) on their host machines. Ubuntu is a popular Linux distribution that can be installed as a guest operating system on Hyper-V.
Upgrade Scenario
In this scenario, we assume that the user has an Intel Core i5 or Ryzen 5 9600X-powered machine running Ubuntu as a guest OS in Hyper-V. After upgrading the host machine, the user notices that the Ubuntu VM's NIC is no longer able to obtain an IP address.
Check Network Adapter
The first step in troubleshooting this issue is to check the network adapter settings in the Ubuntu VM. You can do this by logging into the Ubuntu VM using Remote Desktop Protocol (RDP) or by using the console of Hyper-V.
sudo nm-connection show
This command will list all the network connections available on the Ubuntu VM. Check if the connection for the NIC is present and enabled.
Enable Network Manager
If the network manager is not enabled, you can enable it by running the following command:
sudo systemctl start NetworkManager
sudo systemctl enable NetworkManager
Reinstall Network Driver
If the network adapter is not detected, you may need to reinstall the network driver. For Ubuntu, the open-source driver for most Intel NICs is called e1000e. You can reinstall it by running the following commands:
sudo apt-get update
sudo apt-get install e1000e
Configure Network Interface
After ensuring that the network adapter is detected and enabled, you can configure the network interface by editing the network interface configuration file. You can do this by running the following command:
sudo nano /etc/network/interfaces
Add the following lines to the file:
auto ens33
iface ens33 inet dhcp
Replace "ens33" with the name of your network interface.
Restart VM After Changes
After making the necessary changes, restart the Ubuntu VM to apply the changes.
Conclusion
In this article, we have covered the scenario where the Ubuntu VM in Hyper-V fails to obtain an IP address after upgrading the host machine. We have discussed various troubleshooting steps, including checking the network adapter settings, enabling the network manager, reinstalling the network driver, and configuring the network interface. By following these steps, you should be able to resolve the issue and get your Ubuntu VM back online.