2

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.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89

0 Answers0