在 CentOS 中重启网络服务或网卡的方法取决于系统版本(CentOS 7+ 使用 systemd
,而 CentOS 6 使用 init
)。以下是详细步骤:
sudo systemctl restart network
或(某些版本可能使用 NetworkManager
):
sudo systemctl restart NetworkManager
eth0
或 ens33
)sudo ifdown eth0 && sudo ifup eth0
或使用 nmcli
(需安装 NetworkManager
):
sudo nmcli connection down eth0 && sudo nmcli connection up eth0
ip
命令(临时生效)sudo ip link set eth0 down && sudo ip link set eth0 up
sudo service network restart
sudo ifdown eth0 && sudo ifup eth0
bash
ip a
或
bash
ifconfig
bash
systemctl status network
eth0
(如 ens192
、enp0s3
等,可通过 ip a
查看)。NetworkManager
,优先使用 nmcli
或 nmtui
工具。/etc/sysconfig/network-scripts/ifcfg-eth0
)后需重启服务。Device eth0 does not exist
,确认网卡名称是否正确。sudo systemctl restart firewalld
)。如有其他问题,请提供具体错误信息以便进一步排查!