0

Had my Ubuntu 20.04 system running without any issues for months, but lately I had to start running sudo dhclient after every reboot, otherwise I am not able to connect to the internet.

I am fairly sure this issue has to do with my recent attempt at trying out Wireguard which I may have misconfigured resulting in a broken setting somewhere (Wireguard is now uninstalled).

Right after login, my network manager connection looks like this, which was identical when everything was running fine:

enter image description here enter image description here

After running sudo dhclient, I have network but the network-manager settings haven't changed.

I could add the dhclient command to a startup script, but what I would really like is to understand what got messed up!

Here is my /etc/netplan/01-network-manager-all.yaml config

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

Thank you in advance for your help!

Edit: more details

I am connected to my router both through ethernet and wifi, and on startup only ethernet seems to have issues. My DHCP client is a pihole docker container running on a NAS on the LAN. My setup didn't change recently tho.

running ifconfig, these are the outputs for my enp4s0 and wlp5s0 interfaces:

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.108  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::e8fc:b999:680:6d7d  prefixlen 64  scopeid 0x20<link>
        ether 0c:9d:92:8a:c9:7a  txqueuelen 1000  (Ethernet)
        RX packets 631  bytes 563240 (563.2 KB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 578  bytes 65883 (65.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfc400000-fc41ffff

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.108 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::e8fc:b999:680:6d7d prefixlen 64 scopeid 0x20<link> ether 0c:9d:92:8a:c9:7a txqueuelen 1000 (Ethernet) RX packets 631 bytes 563240 (563.2 KB) RX errors 0 dropped 1 overruns 0 frame 0 TX packets 578 bytes 65883 (65.8 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xfc400000-fc41ffff

the output doesn't seem to change after running sudo dhclient, but I noticed one RX dropped error, and only on the ethernet interface.

Edit 2:

Looks like my /etc/resolv.conf file doesn't exist at startup (may be an obvious thing but better to add this info

before:

cat /etc/resolv.conf

after:

cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 192.168.1.112

Edit 3:

my /etc/systemd/network folder is empty

running sudo iptables -L before and after running dhclient shows the following differences (only differences shown since I use PIA VPN and it adds a ton of entries, but it has been installed on my system for months too):

before:

Chain piavpn.r.300.allowLAN (1 references)
ACCEPT     all  --  anywhere             224.0.0.0/4

[...]

This stuff below isn't present after running the command Chain ufw-skip-to-policy-output (0 references) target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain ufw-track-forward (1 references) target prot opt source destination
Chain ufw-track-input (1 references) target prot opt source destination
Chain ufw-track-output (1 references) target prot opt source destination
ACCEPT tcp -- anywhere anywhere ctstate NEW ACCEPT udp -- anywhere anywhere ctstate NEW Chain ufw-user-forward (1 references) target prot opt source destination
Chain ufw-user-input (1 references) target prot opt source destination
Chain ufw-user-limit (0 references) target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] " REJECT all -- anywhere anywhere reject-with icmp-port-unreachable Chain ufw-user-limit-accept (0 references) target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain ufw-user-logging-forward (0 references) target prot opt source destination
Chain ufw-user-logging-input (0 references) target prot opt source destination
Chain ufw-user-logging-output (0 references) target prot opt source destination
Chain ufw-user-output (1 references) target prot opt source destination

after:

ACCEPT     all  --  anywhere             base-address.mcast.net/4

[...]

entries missing

Let me know if you need other info

HitLuca
  • 111

1 Answers1

0

After troubleshooting all day long, I just gave up: instead of understanding what was causing this issue I just fixed the problem even though I am 100% sure the issue comes from somewhere else:

Based on this askubuntu answer I removed the symlink from /etc/resolv.conf and added my own DNS entry. After a restart I noticed the file got replaced with one created by Network Manager, so I just updated that one.

Everything is back to normal, even though I am still unsure what caused all this mess.

HitLuca
  • 111
  • 1
    So basically, you were correctly connected to the Internet all the time, only your DNS resolution wasn't working? That's always the first thing to try if you suppose you don't have Internet connection, ping some server by its IP address. Then you can right away narrow down the problem to DNS. – raj Mar 25 '22 at 14:49
  • Remove the big banner at the end of the answer it does not add anything. – David Mar 26 '22 at 12:13
  • @raj the thing is that my dns server was set correctly if you check the images (192.168.1.112 has always been the proper dns ip), but for some reason I couldn't actually send dns requests to it. At the end by checking the contents of resolv.conf I noticed that contrarily to what the gui was showing me I had no dns server set up. Since I never had this kind of issues I didn't expect the entire networking interface to basically report false information, hence expected dns to be reacheable – HitLuca Mar 28 '22 at 08:27
  • @David done, thank you for the feedback – HitLuca Mar 28 '22 at 08:28