Skip to content

Commit fc161f8

Browse files
authored
openbsd/net: flush the route table on net restart (canonical#908)
Ensure we've got a clean environment before we restart the network. In some cases, the `sh /etc/netstart` is not enough to restart the network. A previous default route remains in the route table and as a result the network is broken. Also `sh /netstart` does not kill `dhclient`. The problen happens for instance with OVH OpenStack SBG3.
1 parent 7c1d27b commit fc161f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cloudinit/net/openbsd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def start_services(self, run=False):
3636
if not self._postcmds:
3737
LOG.debug("openbsd generate postcmd disabled")
3838
return
39+
subp.subp(['pkill', 'dhclient'], capture=True, rcs=[0, 1])
40+
subp.subp(['route', 'del', 'default'], capture=True, rcs=[0, 1])
41+
subp.subp(['route', 'flush', 'default'], capture=True, rcs=[0, 1])
3942
subp.subp(['sh', '/etc/netstart'], capture=True)
4043

4144
def set_route(self, network, netmask, gateway):

0 commit comments

Comments
 (0)