When troubleshooting network connectivity issues on a headless Linux server, you often need to restart a specific network adapter. Historically, Linux administrators used the ifconfig command (with ifup and ifdown) to manage network interfaces. However, ifconfig has been deprecated on most modern Linux distributions in favor of the much more powerful ip utility.
Using the ip link command, you can view, enable, and disable any physical or virtual network interface on your system.
Step 1: Identify the Network Interface Name
Before you can restart a network adapter, you must know its system designation (such as eth0, enp3s0, or wlan0).
Open your terminal and run the following command:ip link show
This command will output a numbered list of all network interfaces on the machine. Look for the name of the interface you want to manage. The output will also indicate the current state of the adapter (e.g., state UP or state DOWN).
Step 2: Bring the Interface Down
To disable the network interface (effectively disconnecting it from the network), use the ip link set command followed by the interface name and the word down. Because modifying network hardware requires administrative privileges, you must run this command using sudo.
For example, to disable an interface named eth0, type:sudo ip link set eth0 down
If you run ip link show again, the state of the adapter should now read state DOWN.
Step 3: Bring the Interface Up
To re-enable the network interface and allow it to request a new IP address or re-establish a connection, use the exact same command but replace down with up.
sudo ip link set eth0 up
By executing the down command followed immediately by the up command, you successfully restart the network adapter at the hardware abstraction level, often resolving stuck IP assignments or frozen network drivers without needing to reboot the entire Linux server.