This sounds like it needs a backported feature for systemd-networkd in
Focal, i.e. something that got fixed in networkd.

Did you try adding the "on-link: true" setting to your static routes in
the Netplan configuration? That might be able to work around the issue.

** Changed in: netplan.io (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2073869

Title:
  systemd-networkd refuses to apply route with gateway out of the NIC's
  subnet

Status in cloud-init package in Ubuntu:
  Invalid
Status in netplan.io package in Ubuntu:
  Invalid
Status in systemd package in Ubuntu:
  New
Status in cloud-init source package in Focal:
  New
Status in netplan.io source package in Focal:
  New
Status in systemd source package in Focal:
  New

Bug description:
  The version of systemd-networkd on Ubuntu Focal refuses to configure a
  route due to the fact that the address of the gateway is outside of
  the subnet of the NIC. The onlink option is required. This does not
  happen on Jammy and Noble.

  Steps to reproduce:

  ```
  # ip a
  2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP 
group default qlen 1000
      link/ether de:00:00:62:c5:e9 brd ff:ff:ff:ff:ff:ff
      inet 212.47.xxx.xxx/32 scope global dynamic ens2
         valid_lft 800sec preferred_lft 800sec
      inet6 2001:xxx:xxx:xxxx:xxxx:xx:xxxx:c5e9/64 scope global
         valid_lft forever preferred_lft forever
      inet6 fe80::dc00:ff:fe62:c5e9/64 scope link
         valid_lft forever preferred_lft forever

  # cat /etc/netplan/50-cloud-init.yaml
  version: 2
  ethernets:
      ens2:
          addresses:
          - 2001:xxx:xxx:xxxx:xxxx:xx:xxxx:c5e9/64
          dhcp4: true
          routes:
          -   to: 169.254.42.42/32
              via: 62.210.0.1
          -   to: ::/0
              via: fe80::dc00:ff:fe62:c5ea

  # netplan apply

  # journalctl -b -u systemd-networkd
  ...
  Jul 18 10:05:59 focal systemd-networkd[668]: ens2: Could not set route: 
Nexthop has invalid gateway. Network is unreachable
  ...
  ```

  Is this something that netplan fixes and presents it in a better way
  to networkd in newer versions? Or is this something that networkd
  improves in newer versions?

  cloud-init's upstream bug: https://github.com/canonical/cloud-
  init/issues/5523

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2073869/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to