diff options
-rw-r--r-- | cloudinit/net/__init__.py | 2 | ||||
-rw-r--r-- | tests/unittests/net/test_init.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 7558745f..f81f3a7b 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -1157,7 +1157,7 @@ class EphemeralIPv4Network(object): if gateway != "0.0.0.0": via_arg = ['via', gateway] subp.subp( - ['ip', '-4', 'route', 'add', net_address] + via_arg + + ['ip', '-4', 'route', 'append', net_address] + via_arg + ['dev', self.interface], capture=True) self.cleanup_cmds.insert( 0, ['ip', '-4', 'route', 'del', net_address] + via_arg + diff --git a/tests/unittests/net/test_init.py b/tests/unittests/net/test_init.py index 666e8425..82854ab3 100644 --- a/tests/unittests/net/test_init.py +++ b/tests/unittests/net/test_init.py @@ -723,13 +723,13 @@ class TestEphemeralIPV4Network(CiTestCase): ['ip', '-family', 'inet', 'link', 'set', 'dev', 'eth0', 'up'], capture=True), mock.call( - ['ip', '-4', 'route', 'add', '192.168.2.1/32', + ['ip', '-4', 'route', 'append', '192.168.2.1/32', 'dev', 'eth0'], capture=True), mock.call( - ['ip', '-4', 'route', 'add', '169.254.169.254/32', + ['ip', '-4', 'route', 'append', '169.254.169.254/32', 'via', '192.168.2.1', 'dev', 'eth0'], capture=True), mock.call( - ['ip', '-4', 'route', 'add', '0.0.0.0/0', + ['ip', '-4', 'route', 'append', '0.0.0.0/0', 'via', '192.168.2.1', 'dev', 'eth0'], capture=True)] expected_teardown_calls = [ mock.call( |