The default system for managing networks is netplan rather than the older /etc/network/interfaces method. However, if you’re still using /etc/network/interfaces for some reason, you can reload its configurations as follows:
Bring the interface down:
sudo ifdown
Replace with the name of your network interface, like eth0.
Bring the interface up:
sudo ifup
However, if you’re using the newer netplan system (default for Ubuntu 18.04 and later), you can apply changes using:
sudo netplan apply
It’s crucial to ensure that your configuration files are correct before applying or reloading. A mistake in network configurations can disconnect you from the server, especially if you’re accessing it remotely.
If you’re unsure about changes, you can use:
sudo netplan try
This will apply the configuration for a short period (default is 120 seconds), and if you don’t confirm, it will revert to the previous state. This is particularly useful if you’re worried about getting locked out due to a misconfiguration.