0

I have tried God knows how many ways to resolve this and get it under control, but, it doesnt seem to take. I only want the single nameserver in there as 10.0.0.8. Can someone please help.

I have tried removing the existing /etc/resolv.conf, creating a new one with a single entry, and symlinking followed by reboot to no success.

/etc/resolv.conf

nameserver 10.0.0.8
nameserver 127.0.0.1
nameserver 45.90.28.221
# Too many DNS servers configured, the following entries may be ignored.
nameserver 45.90.30.221
nameserver 10.0.0.8
search .

/etc/systemd/resolved.conf

[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google:     8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9:      9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
DNS=10.0.0.8
#FallbackDNS=
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=no
#LLMNR=no

/etc/netplan/00...

network:
  version: 2
  renderer: networkd
  ethernets: #this gets commented out if not using opnsense in virtualbox 
    enp25s0f0:
      dhcp4: no
    enp25s0f1: #comment out if not using opnsense in virtualbox
      dhcp4: no #change from false to true after initial opnsense setup 
  bridges:
    lan1:
      interfaces:
        - enp25s0f0
      addresses: [10.0.0.8/24]
      routes: 
      - to: default
        via: 10.0.0.3
        metric: 100
        on-link: true
#      gateway4: 10.0.0.3
      dhcp4: no
      mtu: 1500
      nameservers:
        addresses: [10.0.0.8]
      parameters: 
        stp: true
        forward-delay: 4
    dmz1:
      interfaces:
        - enp25s0f1
      dhcp4: yes

1 Answers1

1

On modern Ubuntu systems (not sure which version you are on, reporting this is best practice in these questions, to clarify) /etc/resolv.conf is not meant to be edited directly. This is because these systems run systemd-resolved and generate this file dynamically. If you want to change the DNS settings you will either need to use a command-line tool such as resolvectl which has a man page that explains how to get or set DNS configuration, or edit certain configuration files, or possibly create them if they do not exist. That command replaced the old systemd-resolve command. There is also a shorter summary of how to use the command, running resolvectl --help if you don't want to read the whole man page.

If you are on 22.04, you might want to see this question which talks about the relevant configuration file.

cazort
  • 160
  • 1
    All of this is true, but doesn't explain how or why he has a resolv.conf with 5 DNS server entries. A config file managed by resolved should have a single entry for 127.0.0.1. Also, if the /etc/resolv.conf symlink isn't pointed to the usual place, that still doesn't explain the 45.x nameservers which don't appear in the posted netplan config. – slangasek Sep 24 '23 at 05:12