Score:0

How to overwrite an interface config with match option in netplan?

zm flag

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??

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.