Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to change DNS on a Hetzner's VPS?

There's only this in /etc/resolv.conf

nameserver 127.0.0.53
options edns0

Added

nameserver 1.1.1.1
nameserver 1.0.0.1

Restarted netwroking
Nothing happened
Whatever you do, after restarting there's only

nameserver 127.0.0.53
options edns0

Okay. I opened /etc/network/interfaces, added there nameserver 1.1.1.1, restarted networking but nothing interested happened, the same hetzner's dns. There were lines in the interfaces:

# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*.cfg

Okay, opened /etc/network/interfaces.d/50-cloud-init.cfg

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
    dns-nameservers 1.1.1.1 1.0.0.1

# control-alias eth0
iface eth0 inet6 static
    address 2a01:4f4:c0s:ef59::1/64
    gateway fe88::1

Changed those 3 hetzner's dns started from 213..* to CF DNS
Restarted networking
But nothing changed again...

root@vps:~# nslookup lowendtalk.com
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   lowendtalk.com
Address: 172.67.68.9
Name:   lowendtalk.com
Address: 104.26.8.4
Name:   lowendtalk.com
Address: 104.26.9.4
Name:   lowendtalk.com
Address: 2606:4700:20::ac43:4409
Name:   lowendtalk.com
Address: 2606:4700:20::681a:904
Name:   lowendtalk.com
Address: 2606:4700:20::681a:804

root@vps:~# systemd-resolve --status
Global
         DNS Servers: 213.*.100.100
                      213.*.99.99
                      213.*.98.98
          DNSSEC NTA: 10.in-addr.arpa
                      16.*.in-addr.arpa

Any idea?
Ubuntu 18.04

Comments

  • SpeedBusSpeedBus Member, Host Rep

    Could try making the resolv.conf file immutable with chattr once the changes are made to it?

    chattr +i /etc/resolv.conf
    
    Thanked by 1RedSox
  • RedSoxRedSox Member

    @SpeedBus said:

    Could try making the resolv.conf file immutable with chattr once the changes are made to it?

    Tried and it showed me
    Operation not supported while reading flags on /etc/resolv.conf
    Tried with -f
    chattr -f +i /etc/resolv.conf
    It was ok but nothing changed

    Then I installed resolvconf and seems like it helped. At least nslook up shows me 1.1.1.1, but systemd-resolve --status still says I use Hetzner's DNS 213...*

  • DPDP Administrator, The Domain Guy
  • jlayjlay Member

    Take a look at /etc/systemd/resolved.conf, update that and restart systemd-resolved

    Thanked by 1RedSox
  • SpeedBusSpeedBus Member, Host Rep

    @RedSox said:
    @SpeedBus said:

    Could try making the resolv.conf file immutable with chattr once the changes are made to it?

    Tried and it showed me
    Operation not supported while reading flags on /etc/resolv.conf
    Tried with -f
    chattr -f +i /etc/resolv.conf
    It was ok but nothing changed

    Then I installed resolvconf and seems like it helped. At least nslook up shows me 1.1.1.1, but systemd-resolve --status still says I use Hetzner's DNS 213...*

    Seems like my information is a bit out of date, I checked a bit further now, seems like on 18.04 and beyond /etc/resolv.conf is a link from /run which prevents it from getting chattr'd

    root@test:~# ls -al /etc/resolv.conf
    lrwxrwxrwx 1 root root 39 Feb 17  2019 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
    
    Thanked by 1RedSox
  • alpha110alpha110 Member
    edited June 2020

    This ist normal in Ubuntu and the adress
    of the local resolver.

    https://askubuntu.com/questions/1012641/dns-set-to-systemds-127-0-0-53-how-to-change-permanently

    Thanked by 1RedSox
  • unlink or remove the /etc/resolv.conf file.
    then create new one

    Thanked by 1RedSox
  • FalzoFalzo Veteran

    @alpha110 said:
    This ist normal in Ubuntu and the adress
    of the local resolver.

    https://askubuntu.com/questions/1012641/dns-set-to-systemds-127-0-0-53-how-to-change-permanently

    this. I'd go with the second answer of simply changing /etc/systemd/resolved.conf ... you want to have and use static global nameservers anyway.

    Thanked by 1RedSox
  • RedSoxRedSox Member

    Thank you guys. The problem has been solved. I've never had such a problem when working with other providers and just editing resolv.conf was enough.

Sign In or Register to comment.