I recently upgraded from 20.04 to 22.04.01 on both my laptop (uses WiFi) and my desktop (uses Ethernet) via Ubuntu's standard update process (they prompted me to upgrade and I clicked OK). Networking on the laptop with 22.04.01 has no issues. Both machines dual boot to Windows 10; the laptop works fine on WiFi while the desktop works fine on Ethernet. However, the desktop running Ubuntu 22.04.01 was not connecting properly to the internet due to some kind of DNS error; pinging google.com failed but pinging 8.8.8.8 worked fine.
Websearching indicated I could edit /etc/resolv.conf to add a DNS address like 9.9.9.9 in place of 127.0.0.53. That worked temporarily but after reboot it appears systemd had changed it back to 127.0.0.53 and the DNS no longer worked. This was not too surprising since resolv.conf itself says it's managed by systemd and also says "Do not edit".
I found elsewhere (see intelfx's response) that I could instead update /etc/systemd/resolved.conf to include a DNS address. That didn't work either. Neither did updating the DNS in the Ubuntu settings GUI (as shown here). However, that same link also included instructions on setting the DNS using netplan. I tried editing /etc/netplan/01-network-manager.yaml according to those instructions, but that didn't work either.
Somehow (probably when messing with netplan) I deactivated my ethernet (ping no longer worked whether pinging 8.8.8.8 or google.com).
sudo lshw -C network
gives:
*-network DISABLED
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: 78:24:af:34:3e:04
width: 64 bits
clock: 33 MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical
configuration: broadcast=yes driver=r8169 driverversion=5.15.0-47-generic latency=0 link=no multicast=yes
resources: irq:17 iport:d000(size=256) memory:fe900000-fe900fff memory:f0300000-f0303fff
Also, in the Settings GUI under Network, there is no longer an entry for 'Wired' like there used to be; it just has 'VPN' and 'Network Proxy'. On the upper right of the screen near the power button there's no longer an icon for my wired connection either.
Somewhere else I found a suggestion to reactivate Ethernet via sudo nmcli networking off
followed by sudo nmcli networking on
; that did no good.
So, I would appreciate any help with this:
- How do I reactivate my ethernet?
- How do I get my desktop to properly use a DNS on Ubuntu 22.04.01? And why was it broken in the first place, right after my upgrade?
I am no command line expert, nor do I know much about how Ubuntu handles networking, but I can follow instructions reasonably well.
Adding info requested in comments:
/etc/network/interfaces does not exist. ls
within /etc/network gives these directories:
if-down.d if-post-down.d if-pre-up.d if-up.d
/etc/netplan/01-network-manager-all.yaml is only 3 lines; I previously extended it based on these instructions and ran sudo netplan try
and sudo netplan apply
but after that didn't fix my DNS issue I reverted it back to its original form by removing the lines I added and running sudo netplan try
and sudo netplan apply
again:
# Let NetworkManager manage all devices on this system.
network:
version: 2
UPDATE AND SOLUTION:
Thanks, @thomas-ward, for solving my ethernet problem - after adding the 4th line to my YAML file, running sudo netplan apply
, and rebooting, that problem was fixed.
My DNS problem is also solved; after further searching I found Ethernet does not work with Ubuntu Server 20.04 which led me to https://netplan.io/examples . I modified my YAML file in /etc/netplan
according to the 'Using DHCP and static addressing' example, ran sudo netplan try
, accepted the changes, and it worked, persisting after reboot (substitute your own interface name for enp3s0, and spacing is important):
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: true
Issue Hostnames cannot be resolved after upgrading to 22.04 was also helpful (per @C0rn3j, "This seems to be caused by Ubuntu 22.04 expecting to be configured via netplan. Netplan configuration is created on a fresh install, but if you've an upgraded system, the necessary configurations are not present.")
/etc/network/interfaces
Thanks. – mchid Sep 25 '22 at 02:04