canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization

Home Page:https://cloud-init.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cloud-init not rendering `GatewayOnLink` for networkd

bin456789 opened this issue · comments

Bug report

cloud-init not rendering GatewayOnLink for networkd

(https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#GatewayOnLink=)

Steps to reproduce the problem

root@ubuntu:~# cat a.cfg
#cloud-config
network:
  version: 1
  config:
    - type: physical
      name: eth0
      mac_address: 11:22:33:44:55:66
      subnets:
        - type: static
          address: 192.168.1.1/24
          gateway: 1.2.3.4
          dns_nameservers:
            - 1.1.1.1
            - 8.8.8.8
        - type: static6
          address: 2602:0:0:10::100/128
          gateway: 2602:0:0:10::1
          dns_nameservers:
            - 2606:4700:4700::1111
            - 2001:4860:4860::8888
    - type: nameserver
      address:
        - 1.1.1.1
        - 8.8.8.8
        - 2606:4700:4700::1111
        - 2001:4860:4860::8888

root@ubuntu:~# cloud-init devel net-convert -p a.cfg -k yaml -d out -O networkd -D debian
root@ubuntu:~# cat out/etc/systemd/network/10-cloud-init-eth0.network
[Address]
Address=192.168.1.1/24

[Address]
Address=2602:0:0:10::100/128

[Match]
MACAddress=11:22:33:44:55:66
Name=eth0

[Network]
DHCP=no
DNS=1.1.1.1 8.8.8.8
DNS=1.1.1.1 8.8.8.8 2606:4700:4700::1111 2001:4860:4860::8888
DNS=2606:4700:4700::1111 2001:4860:4860::8888

[Route]
Gateway=1.2.3.4

[Route]
Gateway=2602:0:0:10::1

expect:

...
[Route]
Gateway=1.2.3.4
GatewayOnLink=yes

[Route]
Gateway=2602:0:0:10::1
GatewayOnLink=yes

Environment details

  • Cloud-init version: 23.4.daily-202403020432-4a0534f89~ubuntu22.04.1
  • Operating System Distribution:
  • Cloud provider, platform or installer type:

cloud-init logs

Solved by #4996