If your system is using NetworkManager, then sudo systemctl restart networking
is likely to do nothing useful and might even work against NetworkManager, depending of exactly how your system is configured.
As a background, the networking.service
uses the legacy ifup
/ifdown
commands and their /etc/network/interfaces
configuration file. When NetworkManager is in use, you don't need that: NetworkManager can read its configuration directly from /etc/network/interfaces
, from the /etc/NetworkManager/system-connections/
directory, from per-user network settings stored by your desktop environment, and/or from the netplan
subsystem in modern Ubuntu/Mint.
If your VPN connection is also integrated with NetworkManager, it should be automatically restarting the VPN connection if needed. So I'm guessing you're using a VPN client that is either a separate product that does not have full NetworkManager integration, or you've configured it in a way that bypasses NetworkManager.
You should determine which service(s) are related to your VPN connection, and attempt to restart those after changing from a wireless connection to a wired one, or vice versa.
There are so many different VPN implementations on the market that it is frankly impossible to give universal instructions without knowing more details. Is your VPN based on IPsec, L2TP, OpenVPN, Wireguard or is it some proprietary product? How did you configure it, and how do you operate it normally?