以太网显示在“ifconfig”中,但未连接到互联网 18.04

以太网显示在“ifconfig”中,但未连接到互联网 18.04

几天前以太网还可以用。但现在我只能使用速度很慢的 wifi。

以下是输出ifconfig(前两个是以太网接口):

enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1c:1b:0d:67:e9:74  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xef300000-ef320000  

enp4s1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether d4:6e:0e:00:8c:e9  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1228  bytes 91800 (91.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1228  bytes 91800 (91.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlx1cbfce2bb446: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.7.126  netmask 255.255.0.0  broadcast 10.0.255.255
        inet6 fe80::d273:a97:e944:dc81  prefixlen 64  scopeid 0x20<link>
        ether 1c:bf:ce:2b:b4:46  txqueuelen 1000  (Ethernet)
        RX packets 157  bytes 36587 (36.5 KB)
        RX errors 0  dropped 9  overruns 0  frame 0
        TX packets 192  bytes 27036 (27.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我试过了ifdown但是它说未知接口

$ sudo ifdown enp4s1
Unknown interface enp4s1

$ sudo ifdown enp0s31f6
Unknown interface enp0s31f6

答案1

重新声明界面怎么样?

首先添加

network
version: 2
renderer: networkd
ethernets:
    [your interface name]:
        dhcp4: true
        dhcp6: true

*.ymal归档于

/etc/netplan/

进而

sudo ifdown [interface name] && sudo ifup [intreface name]

如果这对您没有帮助,请告知!

相关内容