Ubuntu – Can’t connect to wired network with NetworkManager or DHCPCD

ethernetnetwork-manager

The question is pretty self-explanatory. I can't seem to connect to a wired network, only wifi. Under the network manager menu, Ethernet is grayed out, and says disconnected underneath (also grayed out). And when network manager didn't work, I tried dhcpcd, which didn't work either.

running 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

Where the network interface is the first one.
then running 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)

We can see that enp2s0 is the Ethernet device

Next running 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

Note the Link detected: no. I have an Ethernet cable plugged in, it seems to be it should say yes.

For completeness, 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)

I played around with '/etc/network/interfaces', but ultimately left it as
auto lo
iface lo inet loopback

Which shouldn't really matter, because my /etc/NetworkManager/NetworkManager.conf file looks like:

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

[ifupdown]
managed=false

I've tried setting managed to true and adding enp2s0 to the /etc/Network/interfaces file, and restarted NetworkManager (sudo service network-manager start/stop/reset)

And I tried just using dhcpcd, from which I got:

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

I can ping localhost fine, I can use wireless fine, and DNS is fine, but a wired connection just won't works. And the network card itself works with other installed operating systems like windows, so I doubt that it's a hardware problem.

Now I leave it to the StackExchange gods. Please help 🙁

Best Answer

If you can use WiFi temporarily or download the package manually, you could attempt to install the DKMS package:

  1. sudo apt-get update
  2. sudo apt-get install r8168-dkms
  3. sudo modprobe r8168
  4. Reboot your machine

To download it manually:

  1. Go to http://packages.ubuntu.com/xenial/all/r8168-dkms/download
  2. Pick your mirror and download the r8168-dkms_8.041.00-1_all.deb package
  3. Copy the r8168-dkms_8.041.00-1_all.deb package to the destination machine
  4. sudo dpkg -i r8168-dkms_8.041.00-1_all.deb
  5. sudo modprobe r8168
  6. Reboot your machine
Related Question