Netplan in Ubuntu Server 18.04. How to restart network fully?
Ubuntu 18.04 LTS use netplan
and systemd-networkd
as default network config tool.
In earlier release, we can use service networking restart
, or just ifdown & ifup
to fully restart the network or an interface.
In 18.04, netplan tells just change the yaml file and use netplan apply .
When I change a bonding interface, just like hash policy, mtu, the netplan apply
command doesn't make the new configuration effective.
Oh by the way, netplan shows render is networkd
.
I search the whole internet to find a way to restart the network, but failed.
What I can do is reboot the server. This will make the new mtu and hash policy effective.
But just changing a network parameter, why i must reboot the whole server! Even a unstable windows server is not like this!
So, anyone can tell me what should I do?
List of methods I've already tried and failed:
-
systemctl restart systemd-networkd
: restarted but mtu and policy not change
Solution 1:
netplan apply
does the job.
In some cases you have to reboot.
Solution 2:
For bond interfaces there is a problem. Currently after I modify the Netplan file, I do a Netplan apply for the Netplan to modify the systemd files. Then do a systemd restart for the changes to take effect. This has its own pitfalls.
In case the server has a nfs mounted, systemd never comes up and the network stack hangs. So we need to unmount the nfs, and restart the systemd networkd again.