netplan ignores routes

Bug #2013532 reported by Olaf Seibert
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Netplan
Fix Released
Medium
Unassigned
netplan.io (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Confirmed
Undecided
Unassigned
Kinetic
Confirmed
Undecided
Unassigned

Bug Description

I have 2 files in /etc/netplan. One is generated by cloud-init (50-cloud-init.yaml), but it is not complete. Therefore I added a second file (60-static.yaml) to supply IPv6 address and default route. Cloud-init doesn't have this information, or ignores it (that is not the issue here).

When "netplan generate" or "netplan get" runs, it ignores the route from the second file.

Example:

# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        net0:
            addresses:
            - 1.1.1.1/24 # not the real address of course
            match:
                macaddress: 11:11:11:11:11:11
            nameservers:
                addresses:
                - 8.8.8.8
                - 8.8.4.4
                search: []
            routes:
            - to: default
                via: 1.2.3.4
            set-name: net0

The other file 60-static.yaml:

network:
    version: 2
    ethernets:
        net0:
            addresses:
            - "2a02:eeee:eeee:eeee::2/64"
            routes:
            - to: "::/0"
              via: 2a02:eeee:eeee:eeee::1
              on-link: true

When getting the configuration:

$ netplan get
network:
  version: 2
  ethernets:
    net0:
      match:
        macaddress: "11:11:11:11:11:11"
      addresses:
      - "1.1.1.1/24"
      - "2a02:eeee:eeee:eeee::2/64"
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
      set-name: "net0"
      routes:
      - to: "default"
        via: "1.2.3.4"

The route from the second file is completely ignored.

Strangely enough, if you list multiple routes in the second file, the result does contain all of them.

Revision history for this message
Olaf Seibert (rhialto) wrote :

This behaviour seems new in version 0.105-0ubuntu2~22.04.3. For earlier versions there were already (other) weirdnesses in the merging of the data from multiple files, which cause me to pull out my hair.

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote (last edit ):

Hi there, thank you for your bug report.

This bug was fixed recently [1] and we will consider back-porting to Kinetic and Jammy.

On Ubuntu Lunar (netplan.io 0.106-0ubuntu2) I get this result from "netplan get" (using two separate files like you are doing):

network:
  version: 2
  ethernets:
    net0:
      match:
        macaddress: "11:11:11:11:11:11"
      addresses:
      - "1.1.1.1/24"
      - "2a02:eeee:eeee:eeee::2/64"
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
      set-name: "net0"
      routes:
      - to: "default"
        via: "1.2.3.4"
      - on-link: true
        to: "::/0"
        via: "2a02:eeee:eeee:eeee::1"

[1] - https://github.com/canonical/netplan/pull/320

Changed in netplan:
status: New → Fix Released
importance: Undecided → Medium
Lukas Märdian (slyon)
Changed in netplan.io (Ubuntu):
status: New → Fix Released
Revision history for this message
Lukas Märdian (slyon) wrote :

This is fixed in 0.106, which should be backported to Jammy/Kinetic in the next couple of weeks.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in netplan.io (Ubuntu Jammy):
status: New → Confirmed
Changed in netplan.io (Ubuntu Kinetic):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.