Skip to content

Set static IP in virtual machine

Quick instructions for Ubuntu Server 22.04 vm's created in Proxmox.

  1. Remove all files in /etc/netplan/
    > sudo rm /etc/netplan/*
    
  2. Find your mac address and other details
    > ip a
    
    Copy the value of link/ether
  3. Create new netplan configuration file.
    > sudo -e /etc/netplan/00-network.yaml
    
  4. Add configuration, as below replacing addresses as required.
    network:
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          addresses:
            - 192.168.10.10/24
          routes:
            - to: default
              via: 192.168.10.1
          nameservers:
            search: [winters.local]
            addresses: [192.168.1.195,192.168.1.1]
          match:
            macaddress: c6:2a:cb:17:ee:81
          set-name: eth0
    
  5. Apply configuration
    > sudo netplan apply
    

References