无法使用 NetworkManager 或 DHCPCD 连接到有线网络

无法使用 NetworkManager 或 DHCPCD 连接到有线网络

这个问题很容易理解。我似乎无法连接到有线网络,只能连接 wifi。在网络管理器菜单下,以太网显示为灰色,下面显示已断开连接(也是灰色)。当网络管理器不起作用时,我尝试了 dhcpcd,但也没用。

跑步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:02:00.0
   logical name: enp2s0
   version: 15
   serial: 58:20:b1:68:ff:f4
   size: 10Mbit/s
   capacity: 1Gbit/s
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
   configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.043.02-NAPI duplex=half latency=0 link=no multicast=yes port=twisted pair speed=10Mbit/s
   resources: irq:43 ioport:4000(size=256) memory:c4204000-c4204fff
   memory:c4200000-c4203fff

 *-network
   description: Wireless interface
   product: Wireless 7265
   vendor: Intel Corporation
   physical id: 0
   bus info: pci@0000:05:00.0
   logical name: wlp5s0
   version: 61
   serial: 5c:e0:c5:32:7f:85
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
   configuration: broadcast=yes driver=iwlwifi driverversion=4.4.0-51-generic firmware=17.352738.0 ip=10.219.184.99 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn
   resources: irq:50 memory:c4000000-c4001fff

其中网络接口是第一个。然后运行sudo ifconfig -a

enp2s0    Link encap:Ethernet  HWaddr 58:20:b1:68:ff:f4  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:43 Base address:0xe000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:483 errors:0 dropped:0 overruns:0 frame:0
          TX packets:483 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:61916 (61.9 KB)  TX bytes:61916 (61.9 KB)

wlp5s0    Link encap:Ethernet  HWaddr 5c:e0:c5:32:7f:85  
          inet addr:10.219.184.99  Bcast:10.219.255.255  Mask:255.255.0.0
          inet6 addr: fe80::4d41:3774:5f38:aa9e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12807 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6470 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15817301 (15.8 MB)  TX bytes:949784 (949.7 KB)

我们可以看到enp2s0是以太网设备

下一步运行sudo ethtool enp2s0

Settings for enp2s0:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full 
                        100baseT/Half 100baseT/Full 
                        1000baseT/Full 
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full 
                        100baseT/Half 100baseT/Full 
                        1000baseT/Full 
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
               drv probe ifdown ifup
Link detected: no

注意Link detected: no。我已插入以太网电缆,它似乎应该说是。

为了完整起见,lspci

00:00.0 Host bridge: Intel Corporation Broadwell-U Host Bridge -OPI (rev 09)
00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09)
00:03.0 Audio device: Intel Corporation Broadwell-U Audio Controller (rev 09)
00:04.0 Signal processing controller: Intel Corporation Broadwell-U Camarillo Device (rev 09)
00:14.0 USB controller: Intel Corporation Wildcat Point-LP USB xHCI Controller (rev 03)
00:16.0 Communication controller: Intel Corporation Wildcat Point-LP MEI Controller #1 (rev 03)
00:1b.0 Audio device: Intel Corporation Wildcat Point-LP High Definition Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #1 (rev e3)
00:1c.2 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #3 (rev e3)
00:1c.3 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #4 (rev e3)
00:1c.4 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #5 (rev e3)
00:1c.5 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #6 (rev e3)
00:1f.0 ISA bridge: Intel Corporation Wildcat Point-LP LPC Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation Wildcat Point-LP SATA Controller [AHCI Mode] (rev 03)
00:1f.3 SMBus: Intel Corporation Wildcat Point-LP SMBus Controller (rev 03)
00:1f.6 Signal processing controller: Intel Corporation Wildcat Point-LP Thermal Management Controller (rev 03)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
04:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 950M] (rev a2)
05:00.0 Network controller: Intel Corporation Wireless 7265 (rev 61)

我尝试了“/etc/network/interfaces”,但最终还是将其保留为 auto lo iface lo inet loopback

这其实并不重要,因为我的/etc/NetworkManager/NetworkManager.conf文件看起来像这样:

[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=false

我尝试将 managed 设置为 true 并添加enp2s0/etc/Network/interfaces文件中,然后重新启动 NetworkManager (sudo service network-manager start/stop/reset )

我尝试使用 dhcpcd,得到以下结果:

no interfaces have a carrier
forked to background, child pid 4994

我可以 ping 通 localhost,可以使用无线,DNS 也很好,但有线连接就是不行。而且网卡本身可以与 Windows 等其他已安装的操作系统配合使用,所以我怀疑这不是硬件问题。

现在我把它交给 StackExchange 大神们。请帮忙 :(

答案1

如果您可以暂时使用 WiFi 或手动下载包,您可以尝试安装 DKMS 包:

  1. sudo apt-get update
  2. sudo apt-get install r8168-dkms
  3. sudo modprobe r8168
  4. 重新启动计算机

要手动下载:

  1. http://packages.ubuntu.com/xenial/all/r8168-dkms/download
  2. 选择镜像并下载r8168-dkms_8.041.00-1_all.deb软件包
  3. 将包复制r8168-dkms_8.041.00-1_all.deb到目标机器
  4. sudo dpkg -i r8168-dkms_8.041.00-1_all.deb
  5. sudo modprobe r8168
  6. 重新启动计算机

相关内容