summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Holman <brett.holman@canonical.com>2023-04-21 08:11:35 -0600
committerGitHub <noreply@github.com>2023-04-21 09:11:35 -0500
commit34637a49df13a054c4355de675b7cf286450b2f5 (patch)
treea87eeac4709473c836cd5a2c5dca14a9a62ccc48
parent0a534a6d449c014469a8b5fd331c8fbde29627dc (diff)
downloadcloud-init-git-34637a49df13a054c4355de675b7cf286450b2f5.tar.gz
net: Document use of `ip route append` to add routes (#2130)
-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