Resetting the Network Interface
Resetting the Network Interface (NIC)
Turning the network adapter off and on again clears its current IP addresses, routes, and reloads the connection.
The Old Way
You would use ifconfig to disable and enable the interface:
ifconfig eth0 down
ifconfig eth0 up
Alternatively, the ifdown and ifup scripts could be used for the same purpose.
The Modern Way
Because ifconfig is now deprecated, the modern equivalent uses the ip command:
ip link set eth0 down
ip link set eth0 up
The Systemd Way
Rather than targeting a specific NIC, you can restart the background service that manages all network interfaces. Depending on your Linux distribution, use one of the following:
sudo systemctl restart NetworkManager
Or, if your system uses systemd-networkd instead:
sudo systemctl restart systemd-networkd