Score:2

netplan is not concatenating addresses on separate YAML files

ba flag

I am trying to set up an additional address in an ethernet interface using netplan. The man page for netplan-generate mentions that the sequences for the same key configuration should be concatenated, but the value gets always overriden.

base yaml file in 01-network-all.yaml:

network:
  ethernets:
    ---other interfaces---
    eth0:
      addresses: [1.1.1.1/24]
  renderer: networkd
  version: 2

my new configuration file 02-example.yaml

network:
  ethernets:
    eth0:
      addresses: [2.2.2.2/24]
  renderer: networkd
  version: 2

Whenever I do a netplan generate/apply and then check back the value, the address is only reported as 2.2.2.2/24.

The --debug output implies that networkd is finding both entries but is not joining them as supposed:

DEBUG:netplan generated networkd configuration changed, restarting networkd
DEBUG:eth0 exists in {'eth0': {'addresses': ['1.1.1.1/24']}}
DEBUG:Merged config:
network:
  ethernets:
    eth0:
      addresses:
      - 2.2.2.2/24
  renderer: networkd
netplan get ethernets.eth0.addresses
- 2.2.2.2/24

What is going on here? I checked that the changes are taking effect so it is not netplay failing to apply them. I am using the wrong format? I supposed that a sequence is represented by [].

As a follow up question, is there an easy way of doing this change apart from this way? I thought of retrieving the entry with netplan get, processing it with a shell command ant then appending the new one with netplan set but I'll end with a very dirty shell script.

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.