0

I had default Debian DNS settings on my laptop, but I couldn't connect to a corporate remote PC with it. Then I decided to edit DNS servers to corporate ones by editing /etc/resolv.conf. I've added corporate DNS servers to the file and everything was perfect (i.e. internet connection and rdp connection worked) until I turned off the laptop.

I found out that changes are not permanent and are reset after reboot. Then, I googled for information on how to make changes to DNS permanent, used resolvconf utility and no internet connection was found.

Then it got really complicated and I decided to revert to defaults, removed resolvconf, it didn't work unless I edited /etc/resolv.conf (which reloaded after reboot). It didn't give any result either. My final attempt was to use systemd-resolved to reset settings back to normal. My DNS settings got set back to 127.0.0.53, I found that question, followed the instructions of the fix here with no result. After reboot, I still have no internet connection and service systemd-resolved restart && sudo systemctl restart networking returns service command not found.

My current /etc/resolv.conf shows the two nameservers I've manually added to it. I have systemctl running and the links fixed, but still no Internet connection. How am I to revert back to DNS defaults completely and make it work in any network, not just the one I'm in.

There probably was something wrong with DNS settings from the beginning.

P.S. There is an interesting detail, I don't know how it works, but when I'm connected from Debian to my home wifi, I have no internet connection, but I do have an internet connection when I connect to other wifi, and I have a connection when I connect my router and Debian laptop by wire.

1

Debian by default uses NetworkManager, so I assume you use this one.

In that case you can simply add/define additional DNS servers in the network configuration files under /etc/NetworkManager/system-connections/. In the config for your work connection, simply add entries under the [ipv4] and [ipv6] blocks:

[ipv4]
dns=<DNS server ip1>;<DNS server ip2>;

[ipv6]
dns=<ipv6 DNS server 1>;

Separate entries with semicolons, then restart NetworkManager via systemctl to update resolv.conf immediately or just wait for the next time you are connecting.

NOTE: You do not need to put default DNS servers there, they are requested from the network, but just the additional ones you are missing.

3
  • I assume you ran the linking command ls -s /run/systemd/resolve/resolv.conf /etc/resolv.conf? Did you delete the link? Do do so and let NetworkManager recreate resolv.conf. – FelixJN Dec 17 '20 at 10:51
  • I reverted to NetworkManager, checked for the symlink, there is no symlink for /etc/resolv.conf right now. And no internet. In my current connection under /etc/NetworkManager/system-connections/ right now it says: [ipv4] dns-search=<DNS server ip1>;<DNS server ip2> ignore-auto-dns=true method=auto and still no internet. – Vladimir Markiev Dec 17 '20 at 11:04
  • dns not dns-search – FelixJN Dec 18 '20 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.