0

I am using an Ubuntu 18 on a virtualbox machine and I am trying to overwrite a netplan config related to an interface. There are two config files located in /etc/netplan/.

50-cloud-init.yaml:

network:
    ethernets:
        enp0s3:
            dhcp4: true
            match:
                macaddress: 02:d4:40:b8:a4:a0
            set-name: enp0s3
    version: 2

50-vagrant.yaml:

---
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s8:
      dhcp4: true
    enp0s9:
      dhcp4: true
    enp0s10:
      addresses:
      - 192.168.56.200/24

I want to overwrite some configurations in 60-myconfig.yaml, such that enp0s8 gets a static IP address and does not use DHCP. However, I prefer to not to use interface name as the key and use match instead. But it doesn't work:

---
network:
  version: 2
  renderer: networkd
  ethernets:
    myinterface:
      match:
        name: enp0s8
      dhcp4: false
      addresses:
        - 192.168.1.160/24

when I change key myinterface to enp0s8 it works properly. I guess netplan does not support overwriting an interface config using match. Is it true or I am doing something wrong??

0 Answers0