22.04 说我没有连接到互联网,但我已经

22.04 说我没有连接到互联网,但我已经

我刚刚用 Ubuntu 22.04 Server 设置了一台新机器。我已连接到互联网,可以毫无问题地浏览和下载文件。当我进入设置添加在线帐户时,它告诉我我未连接到互联网。网络设置仅显示 VPN 设置,而不显示以太网(当前已插入)。顶部栏上的网络下拉菜单显示未管理,选项为连接和有线设置。网络设置菜单上均未显示任何内容。

我找不到任何好的帮助来解决此问题。有什么想法吗?

“lshw -c net”输出

  *-network                 
       description: Ethernet interface
       product: 82574L Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:09:00.0
       logical name: enp9s0
       version: 00
       serial: 00:25:00:ef:d7:bf
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.15.0-52-generic firmware=1.9-0 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:18 memory:8b400000-8b41ffff memory:8b420000-8b42ffff ioport:2000(size=32) memory:8b430000-8b433fff memory:8b440000-8b47ffff
  *-network
       description: Ethernet interface
       product: 82574L Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:0a:00.0
       logical name: enp10s0
       version: 00
       serial: 00:25:00:ef:ff:c8
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.15.0-52-generic duplex=full firmware=1.9-0 ip=192.168.86.24 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:19 memory:8b300000-8b31ffff memory:8b320000-8b32ffff ioport:1000(size=32) memory:8b330000-8b333fff memory:8b340000-8b37ffff
  *-network
       description: Network controller
       product: BCM4321 802.11a/b/g/n
       vendor: Broadcom Inc. and subsidiaries
       physical id: 0
       bus info: pci@0000:0d:00.0
       version: 05
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list
       configuration: driver=b43-pci-bridge latency=0
       resources: irq:17 memory:8b100000-8b103fff

“netplan yaml”输出(我知道两个端口是相同的IP。它们永远不会一起使用。

network:
  version: 2
  renderer: networkd
  ethernets:
    enp9s0:
      addresses:
        - 192.168.86.24/24
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      routes:
        - to: default
          via: 192.168.86.1
    enp10s0:  
      addresses:
        - 192.168.86.24/24
      nameservers: 
        addresses: [8.8.8.8, 8.8.4.4]
      routes:
        - to: default
          via: 192.168.86.1

“NetworkManager.conf”输出

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true

[device]
wifi.scan-rand-mac-address=no

任何帮助都将受到赞赏。

编辑以添加...我安装了 GUI,以便于管理。

答案1

如果您希望通过图形界面(即网络管理器)控制网络,请修改 netplan yaml 文件。首先,备份当前文件:

sudo mv /etc/netplan/*.yaml  /etc/netplan/*.bak

写入新文件:

sudo nano /etc/netplan/01-network-manager-all.yaml

写下以下内容:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

Netplan 对间距、缩进等要求非常严格,因此请仔细校对两遍。保存(Ctrl+o 然后按 Enter)并退出(Ctrl+x)文本编辑器。

接下来是:

sudo netplan generate
sudo netplan apply
sudo service NetworkManager restart

一切已准备就绪。

相关内容