Results 1 to 4 of 4

Thread: DNS problem

  1. #1

    DNS problem


    I have a computer with Ubuntu 20.04 that is not resolving names. It is configured for Network Address Translation for a Local Area Network. The computers on the LAN can access the internet through it and DNS works for those computers. On the NAT computer, I put in DNS IPs that should work using the GUI configuration. In fact, supplying a DNS IP to the dig command in a terminal window does work. For example:

    # dig @

    works. However, without providing the DNS IP to query, like so

    # dig

    it responds with "SERVFAIL"

    ; <<>> DiG 9.16.1-Ubuntu <<>>
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 32672

    ;; Query time: 0 msec
    ;; SERVER:

    I tried switching on and off the "Automatic" option in the GUI for DNS with no luck. I can query systemd for the current DNS server and replies with the IP addresses I supplied (which all work):

    Link 3 (enp0s31f6)
    Current Scopes: DNS
    DefaultRoute setting: yes
    LLMNR setting: yes
    MulticastDNS setting: no
    DNSOverTLS setting: no
    DNSSEC setting: no
    DNSSEC supported: no
    Current DNS Server:
    DNS Servers:
    DNS Domain: ~.

    When I don't supply an IP, it (dig) uses, which fails (in 0 msec).

    The internet access for this computer is Hughesnet satellite. To configure it for NAT I enabled port forwarding and installed the package iptables-persistent and added an iptables rule based on instructions I found on the internet. DNS for this computer was working until I configured it for NAT. Also, in the Ubuntu network configuration GUI, all of the IPv6 stuff is in the default "Automatic" setting.

    Does anyone know what needs to be changed to fix this?


  2. #2
    Join Date
    Nov 2008
    Boston MetroWest

    Re: DNS problem

    I can query systemd for the current DNS server and replies with the IP addresses I supplied (which all work):
    Are those addresses entered in /etc/systemd/resolved.conf? If you enter them there, then run "sudo systemctl restart systemd-resolved", you might have better luck.

    If this is a virtual machine, I see no reason to use iptables at all, especially if you're using NAT. The VM is not exposed directly to any system outside of the host computer.

    If you need other computers on the local network to be able to see this virtual machine, you need to use "bridged networking" not NAT. In a bridged setup, the VM will get an address directly on the public network and be a peer to all the other machines.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3

    Re: DNS problem

    Thanks, I tried putting the line


    in the file "/etc/systemd/resolved.conf" and rebooted, but by default it still uses The computer is not a VM.

    The file "/etc/resolv.conf" is a link pointing to "/run/systemd/resolve/stub-resolv.conf which contains the lines:

    options edns0 trust-ad

    That is where it's getting the address. The file says not to edit it directly, but to use the man page instructions for systemd-resolved.service, so that's what I'll try next.

  4. #4

    Re: DNS problem

    To answer my own question, I replaced the symlink /etc/resolv.conf with a file containing the DHCP supplied DNS address instead of, and that seems to work. I now interpret the instructions differently, after reading the systemd-resolved.service man page. The "Do not edit this file" comment refers to the /run/systemd/resolve/stub-resolv.conf file, not the symlink, which I think it is safe to replace with a regular file.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts