linux网口激活命令
linux网口激活命令详细介绍
在 Linux 系统中,可依据不同的网络管理工具来激活网络接口,以下为几种常见方法:
使用
ifconfig命令(适用于较旧的 Linux 系统)
ifconfig是一个较为传统的网络配置工具,使用它激活网络接口的命令如下:
bash
interface up
这里的<interface>需要替换成你要激活的网络接口名称,像eth0、enp0s3等。例如,激活eth0接口:
bash
eth0 up
使用
ip命令(适用于大多数现代 Linux 系统)
ip命令是一个功能更强大、更现代的网络配置工具,使用它激活网络接口的命令如下:
bash
interface up
同样,<interface>要替换成你要激活的网络接口名称。例如,激活enp0s3接口:
bash
enp0s3 up
使用
nmcli命令(适用于使用 NetworkManager 管理网络的系统)
若你的系统使用 NetworkManager 来管理网络,那么可以用nmcli命令激活网络接口,命令如下:
bash
nmcli device connect interface
<interface>同样要替换成你要激活的网络接口名称。例如,激活wlan0接口:
bash
nmcli device connect wlan0
912 nmcli device connect wlan0