无法通过以太网访问路由器

无法通过以太网访问路由器

在使用 Live 启动尝试 Ubuntu 20.04.3 后,我决定完全从 Windows 切换。然而,安装 Ubuntu 后,我意识到到路由器的以太网连接不再工作,请注意,虽然 Windows 10 仍安装,并且使用 Live 启动时一切都运行正常。如果不设置静态 IP 地址,我会收到错误Activation of network connection failed.当我设置静态 IP 并 ping 我的路由器时,我会得到以下输出:

$ ping 192.168.178.1

PING 192.168.178.1 (192.168.178.1) 56(84) bytes of data.
From 192.168.178.61 icmp_seq=1 Destination Host Unreachable

在我的路由器和我的电脑之间有一个 D-Link DGS-105 LAN 交换机,我认为这是导致这个问题的原因。

运行以下命令我得到以下输出:

$ sudo lshw -C network

  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: enp4s0
       version: 0c
       serial: b4:2e:99:19:41:be
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.11.0-43-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:34 ioport:f000(size=256) memory:fe600000-fe600fff memory:f0300000-f0303fff
  *-network
       description: Wireless interface
       physical id: 1
       bus info: usb@1:4
       logical name: wlx503eaa82fc4f
       serial: 50:3e:aa:82:fc:4f
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=mt76x0u driverversion=5.11.0-43-generic firmware=N/A ip=192.168.178.61 link=yes multicast=yes wireless=IEEE 802.11
$ sudo resolvectl status

Global
       LLMNR setting: no                  
MulticastDNS setting: no                  
  DNSOverTLS setting: no                  
      DNSSEC setting: no                  
    DNSSEC supported: no                  
          DNSSEC NTA: 10.in-addr.arpa     
                      16.172.in-addr.arpa 
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa 
                      18.172.in-addr.arpa 
                      19.172.in-addr.arpa 
                      20.172.in-addr.arpa 
                      21.172.in-addr.arpa 
                      22.172.in-addr.arpa 
                      23.172.in-addr.arpa 
                      24.172.in-addr.arpa 
                      25.172.in-addr.arpa 
                      26.172.in-addr.arpa 
                      27.172.in-addr.arpa 
                      28.172.in-addr.arpa 
                      29.172.in-addr.arpa 
                      30.172.in-addr.arpa 
                      31.172.in-addr.arpa 
                      corp                
                      d.f.ip6.arpa        
                      home                
                      internal            
                      intranet            
                      lan                 
                      local               
                      private             
                      test                

Link 3 (wlx503eaa82fc4f)
      Current Scopes: DNS          
DefaultRoute setting: yes          
       LLMNR setting: yes          
MulticastDNS setting: no           
  DNSOverTLS setting: no           
      DNSSEC setting: no           
    DNSSEC supported: no           
  Current DNS Server: 192.168.178.1
         DNS Servers: 192.168.178.1
          DNS Domain: ~.           
                      fritz.box    

Link 2 (enp4s0)
      Current Scopes: none
DefaultRoute setting: no  
       LLMNR setting: yes 
MulticastDNS setting: no  
  DNSOverTLS setting: no  
      DNSSEC setting: no  
    DNSSEC supported: no  

$ cat /etc/netplan/01-network-manager-all.yaml

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

$ cat /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf

[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma
$ ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b4:2e:99:19:41:be brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.61/24 brd 192.168.178.255 scope global noprefixroute enp4s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5254:585a:126:51dc/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlx503eaa82fc4f: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 50:3e:aa:82:fc:4f brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.61/24 brd 192.168.178.255 scope global dynamic noprefixroute wlx503eaa82fc4f
       valid_lft 863972sec preferred_lft 863972sec
    inet6 fe80::75d1:bc59:1b3c:c6e2/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
$ ip r

default via 192.168.178.1 dev enp4s0 proto static metric 100 
default via 192.168.178.1 dev wlx503eaa82fc4f proto dhcp metric 20600 
169.254.0.0/16 dev enp4s0 scope link metric 1000 
192.168.178.0/24 dev enp4s0 proto kernel scope link src 192.168.178.61 metric 100 
192.168.178.0/24 dev wlx503eaa82fc4f proto kernel scope link src 192.168.178.61 metric 600 

无论出于什么原因,它现在似乎都可以起作用了,感谢您的帮助。

相关内容