Home >Operation and Maintenance >Linux Operation and Maintenance >What are the commands to restart the network card in Linux?

What are the commands to restart the network card in Linux?

DDD
DDDOriginal
2023-08-23 10:29:5724303browse

Linux commands to restart the network card are: 1. ifdown/ifup command, ifdown is used to stop the network connection of the specified network card, ifup is used to start the network connection of the specified network card; 2. systemctl command, systemctl restart network is used Restart the network service; 3. service command, service network restart is used to restart the network service; 4. ip command, ip link setdown, etc.

What are the commands to restart the network card in Linux?

In Linux systems, there are a variety of commands that can be used to restart the network card. Some of the commonly used commands and their usage are listed below:

ifdown/ifup command:

ifdown: Used to stop the network connection of the specified network card.

Usage: sudo ifdown

ifup: used to start the network connection of the specified network card.

Usage: sudo ifup

For example, to restart the eth0 network card, you can use the following command:

sudo ifdown eth0

sudo ifup eth0

systemctl command:

systemctl restart network: used to restart network services, including all network cards.

Usage: sudo systemctl restart network

Please note that root privileges are required to use this command.

service command:

service network restart: used to restart network services, including all network cards.

Usage: sudo service network restart

Please note that using this command requires root privileges.

ip command:

ip link set down: used to stop the network connection of the specified network card.

Usage: sudo ip link set eth0 down

ip link set up: used to start the network connection of the specified network card.

Usage: sudo ip link set eth0 up

For example, to restart the eth0 network card, you can use the following command:

sudo ip link set eth0 down

sudo ip link set eth0 up

The above are some commonly used commands to restart the network card. Depending on the specific Linux distribution and network configuration, there may be other commands available. You can get more detailed information about the command through the man command or typing the command name ±-help in the terminal.

The above is the detailed content of What are the commands to restart the network card in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn