Recently I am doing a test migration from XenServer to Proxmox Virtual Enviroment, then the guest VM lost it’s network. Here’s how to get it back on track.
1. Find out the network adapter name, here we will take note of the altname: enp0s18
ip a
2. Then we can proceed to setup the network configuration using netplan.
sudo nano /etc/netplan/01-netcfg.yaml
3. Follow the setup below to setup network interface, IP address, replace addresses, netmask, gateway, dns as necessary.
network:
version: 2
renderer: networkd
ethernets:
enp0s18:
dhcp4: no
addresses:
- 192.168.0.15/24
routes:
- to: default
via: 192.168.0.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
4. Apply the network configuration.
sudo netplan apply
5. Check if IP configured:
ip a
6. Check if ping is working:
ping -c3 www.ubuntu.com
Source: https://linuxconfig.org/setting-a-static-ip-address-in-ubuntu-24-04-via-the-command-line
For Ubuntu 16 and earlier:
Source: https://www.snel.com/support/static-ip-configuration-ubuntu-16-04/