diff --git a/cloudinit/sources/DataSourceScaleway.py b/cloudinit/sources/DataSourceScaleway.py index 6473a6c9fe9..b44b3c8f85a 100644 --- a/cloudinit/sources/DataSourceScaleway.py +++ b/cloudinit/sources/DataSourceScaleway.py @@ -367,7 +367,11 @@ def network_config(self): if ip["address"] == self.ephemeral_fixed_address: ip_cfg["dhcp4"] = True # Force addition of a route to the metadata API - route = {"to": "169.254.42.42/32", "via": "62.210.0.1"} + route = { + "on-link": True, + "to": "169.254.42.42/32", + "via": "62.210.0.1" + } if "routes" in ip_cfg.keys(): ip_cfg["routes"] += [route] else: diff --git a/tests/unittests/sources/test_scaleway.py b/tests/unittests/sources/test_scaleway.py index a2cfd8a7b85..a1ca483a9fe 100644 --- a/tests/unittests/sources/test_scaleway.py +++ b/tests/unittests/sources/test_scaleway.py @@ -860,7 +860,11 @@ def test_ipmob_primary_ipv4_config_ok(self, m_get_cmdline, fallback_nic): "ethernets": { fallback_nic.return_value: { "routes": [ - {"to": "169.254.42.42/32", "via": "62.210.0.1"} + { + "on-link": True, + "to": "169.254.42.42/32", + "via": "62.210.0.1", + } ], "dhcp4": True, }, @@ -903,7 +907,11 @@ def test_ipmob_additional_ipv4_config_ok( fallback_nic.return_value: { "dhcp4": True, "routes": [ - {"to": "169.254.42.42/32", "via": "62.210.0.1"} + { + "on-link": True, + "to": "169.254.42.42/32", + "via": "62.210.0.1", + } ], "addresses": ("20.20.20.20/32",), }, @@ -983,7 +991,11 @@ def test_ipmob_primary_ipv4_v6_config_ok( fallback_nic.return_value: { "dhcp4": True, "routes": [ - {"to": "169.254.42.42/32", "via": "62.210.0.1"}, + { + "on-link": True, + "to": "169.254.42.42/32", + "via": "62.210.0.1", + }, { "via": "fe80::ffff:ffff:ffff:fff1", "to": "::/0",