我正在运行 Ubuntu 20.04 LTS,我正在测试使用 eth0 和 wlan0 这两个设备(接口)连接到网络。我从 Wifi 开始:
ubuntu@ubuntu:~$ nmcli dev
DEVICE TYPE STATE CONNECTION
wlan0 wifi connected MY-NET
eth0 ethernet unmanaged --
lo loopback unmanaged --
p2p-dev-wlan0 wifi-p2p unmanaged --
一切都很好!现在我要切换到 eth0 开发:
sudo nmcli con down MY-NET
sudo nmcli dev
DEVICE TYPE STATE CONNECTION
wlan0 wifi disconnected --
eth0 ethernet unmanaged --
lo loopback unmanaged --
p2p-dev-wlan0 wifi-p2p unmanaged --
现在我连接了电缆并完成了 eth0 连接:
ip addr show
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether dc:a6:32:22:b8:a3 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.132/24 brd 192.168.1.255 scope global dynamic eth0
valid_lft 6500sec preferred_lft 6500sec
inet6 fe80::dea6:32ff:fe22:b8a3/64 scope link
valid_lft forever preferred_lft forever
ping nike.com
PING nike.com (99.86.167.33) 56(84) bytes of data.
64 bytes from server-99-86-167-33.mxp64.r.cloudfront.net (99.86.167.33): icmp_seq=1 ttl=242 time=7.39 ms
64 bytes from server-99-86-167-33.mxp64.r.cloudfront.net (99.86.167.33): icmp_seq=2 ttl=242 time=7.24 ms
但每次我在 dev 上运行 nmcli 命令时,我都看不到设备 eth0 处于活动状态:
wlan0 wifi disconnected --
eth0 ethernet unmanaged --
lo loopback unmanaged --
p2p-dev-wlan0 wifi-p2p unmanaged --
因此,设备上和连接上的命令都没有显示活动链接:
sudo nmcli dev set eth0 managed yes
ubuntu@ubuntu:~$ sudo nmcli dev
DEVICE TYPE STATE CONNECTION
wlan0 wifi disconnected --
eth0 ethernet unmanaged --
lo loopback unmanaged --
p2p-dev-wlan0 wifi-p2p unmanaged --
sudo nmcli con show --active
>