[SOLVED]Change DNS resolver - Ubuntu 22.04

Discussion in 'Installation/Configuration' started by Taxick, Oct 12, 2022.

Tags:
  1. Taxick

    Taxick Member

    Hi :)

    Yes, I'm a noob! But please help me out here :)

    I want to change my DNS resolver to googles

    My /etc/network/interfaces look like this:

    Code:
    #This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5)
    
    # Include files from /etc/network/interfaces.d:
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    My: /etc/resolv.conf look like this:

    Code:
    # 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 127.0.0.53

    And my: resolvectl status | grep Current

    Code:
    root@skytower ~ # resolvectl status | grep Current
    Current Scopes: DNS
    Current DNS Server: 185.12.64.2
    Im running Ubuntu 22.04, and my server is hosted at hetzner.com

    Hope someone can help me :)
    // Thomas
     
  2. Taxick

    Taxick Member

    In /etc/network/interfaces - I have try to change

    Code:
    #This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5)
    
    # Include files from /etc/network/interfaces.d:
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    to this
    Code:
    ## /etc/network/interfaces example Hetzner root server
    # Loopback-Adapter
    auto lo
    iface lo inet loopback
    #
    # LAN interface
    auto eth0
    iface eth0 inet static
      # Main IP address of the server
      address 138.201.226.*
      # Netmask 255.255.255.255 (/32) independent from the
      # real subnet size (e.g. /27)
      netmask 255.255.255.255
      # explicit host route to the gateway
      gateway 138.201.226.193
      pointopoint 138.201.226.193
      dns-nameservers 8.8.8.8 8.8.4.4
    
    # IPv6
    
    iface eth0 inet6 static
      # one IPv6 address from assigned subnet
      address 2a01:4f8:173:****::2
      netmask 64
      gateway fe80::1
      dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
    But after a reboot it dont seams to work!

    Code:
    root@skytower ~ # resolvectl status | grep Current
        Current Scopes: DNS
    Current DNS Server: 185.12.64.2
    root@skytower ~ #
    
     
    Last edited: Oct 12, 2022
  3. Taxick

    Taxick Member

    Okay..
    I have come a stop further
    Code:
    sudo mkdir /etc/systemd/resolved.conf.d/
    sudo nano /etc/systemd/resolved.conf.d/dns_servers.conf
    Put this in the dns_servers.conf
    Code:
    [Resolve]
    DNS=8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
    Domains=~.
    Code:
    sudo systemctl restart systemd-resolved
    If i run: "resolvectl" - I get this output
    dns.jpg

    What is Link 2??? Are these settings looking right??
     
  4. Taxick

    Taxick Member

    Here we go :) Here is the file I have been looking for!
    There was a file called: /etc/netplan/01-netcfg.yaml
    I cut changed the setting for my network there, and all seems to work now.
     
  5. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

Share This Page