Linux Ubuntu22.04 restart network card command ip link set enp8s0 down/up

333  sudo ip link set enp8s0 down
335  sudo ip link set enp8s0 up
337  ifconfig

In Ubuntu 22.04, you can use the following command to restart the network interface:

sudo ip link set <interface_name> down && sudo ip link set <interface_name> up

Replace <interface_name>with the name of the network interface to restart, for example eth0or wlan0. This command will first disable the specified network interface and then re-enable it so that its configuration and status are updated.

If your network interfaces have separate properties like IPv4 or IPv6 address, configuration, etc., you can restart them individually with the following command:

sudo ip -4 addr flush dev <interface_name>
sudo ip -6 addr flush dev <interface_name>
sudo ifdown <interface_name> && sudo ifup <interface_name>

This command will first clear the IPv4 and IPv6 addresses of the specified network interface, and then restart the specified network interface.

Note that this command requires administrator privileges, so it needs to be sudoexecuted with the command.

Guess you like

Origin blog.csdn.net/a772304419/article/details/132103689