Score:0

Ubuntu DNS not working after installing a Bind Container

cn flag

I have an Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-109-generic x86_64) server with Docker installed. I created a Bind9 container however it would fail to start. Turned out this was because the resolver service on Ubuntu was running and taking control of port 53.

So I killed the resolver service and then the Bind9 container would start.

Problem I have now is that Ubuntu host O\S won't resolve any DNS names. I edited /etc/netplan/00-installer-config.yaml to use external DNS servers but still nothing.

YAML file contents:

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s4:
      dhcp4: no
      addresses:
      - 192.168.0.98/24
      - 192.168.0.99/24
      gateway4: 192.168.0.1
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
  version: 2
Score:0
cn flag

The systemd-resolved listens on port 53 of 127.0.0.53. It is this process that gets configured to use external resolvers, or not.

As your container refused to start until you killed the system resolver, I can only guess it was trying to listen on port 53 on the wildcard 0.0.0.0 address, which would be the default behavior.

The straightforward fix for this would be to change the way you start your Bind9 container so that it listens on only a specific IP address. E.g.:

docker run --publish=127.0.0.1::53

Or

docker run -p=127.0.0.1::53

If you need this to be reachable over the network, then change this to the correct public IP address.

And of course, revert all the changes you did to the system resolver.

in flag
running bind on the loopback interface is pretty useless, usually you want to have it available for other hosts. It would be better to bind it to the external interface instead.
in flag
And you need to add `/udp` to the publish address.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.