netplan apply does not remove ips
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
This is inside an LXC Ubuntu 18.04 container (running under an Ubuntu 18.04 host), if that makes a difference. I can add new IP aliases just fine by adding them in the /etc/netplan/
network:
version: 2
ethernets:
...and then run "netplan apply" to activate these static IPs. (Note: My real yaml file is using public IPs, I switched them to private for this example, but everything else is the same.) The problem comes when I try to deactivate an IP. So, let's say I drop the second IP (.4):
network:
version: 2
ethernets:
Even after running "netplan apply" again, the IP is still pingable and I can even ssh to the box using the dropped IP. "ip addr show" also reveals that the IP is still there.
I've even tried "ifdown -a;ifup -a" and "service networking restart", neither of which produce any errors, but the IP does not deactivate. Restarting the entire LXC container works, but that's obviously less desirable.
Update- I've found that this works:
ip addr del 192.168.0.4/24 dev eth0
The script that is generating the yaml file does not know which IPs have been dropped because it's just grabbing the current IP list from a database, so the above method of dropping IPs isn't possible.
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
I can confirm this behavior. Netplan apply does the following:
Generate a new config for the backend and restart the backend.
The systemd-networkd backend does not clear existing configuration from the devices which results in previous configurations being present.
One currently needs to manually clear the interfaces, something like:
ip addr flush dev eth0
Will clear the config and then a netplan apply will bring that up.
Need some comments from netplan on expected behavior and whether the 'apply' verb should also include a clear and what the scope of the clear should be (ie, only for interfaces which will be configured with the current configuration that was generated).