目的:不用 networking 管理网卡,而用 networkmanager 管理网卡
linux:alpine 3.11
源:
cat /etc/apk/repositories
https://mirrors.huaweicloud.com/alpine/edge/main/https://mirrors.huaweicloud.com/alpine/edge/community/https://mirrors.nju.edu.cn/alpine/edge/main/https://mirrors.nju.edu.cn/alpine/edge/community/命令:
apk update
/bin/mv '/etc/network/interfaces' '/opt'
apk add networkmanager ifupdown
addgroup root plugdev
#rc-update add wpa_supplicant default
rc-update add networkmanager boot
rc-update del networking boot
rc-service networking stop #这条命令之后,则网断了,不能从终端管理了,但可以在 linux 本机管理。
rc-service networkmanager start
cat /etc/NetworkManager/NetworkManager.conf
[main]
dhcp=dhcpcd
-------故障现象:-----------------
nmcli d
DEVICE TYPE STATE CONNECTION
eth0 ethernet unmanaged --
lo loopback unmanaged --
nmcli connection add type ethernet con-name lan1 ifname eth0 ip4 $ip gw4 $gw
#正常
nmcli device conn eth0
#返回:
Error: Failed to add/activate new connection: Connection 'eth0' is not available on device eth0 because device is strictly unmanaged
nmcli connection up lan1
#返回
Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).