summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/net/ephemeral.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cloudinit/net/ephemeral.py b/cloudinit/net/ephemeral.py
index 130afa17..8339f169 100644
--- a/cloudinit/net/ephemeral.py
+++ b/cloudinit/net/ephemeral.py
@@ -197,6 +197,14 @@ class EphemeralIPv4Network:
via_arg = []
if gateway != "0.0.0.0":
via_arg = ["via", gateway]
+
+ # Use "append" rather than "add" since the DHCP server may provide
+ # rfc3442 classless static routes with multiple routes to the same
+ # subnet via different routers or local interface addresses.
+ #
+ # In this scenario, `ip r add` fails.
+ #
+ # RHBZ: #2003231
subp.subp(
["ip", "-4", "route", "append", net_address]
+ via_arg