I am trying to follow tutorial on how to setup DNS server hosted as docker image.
But of course I am facing problems.
I have setup named.conf
file as below. But i am completely uncertain what IP addresses I should put, I have put my local machine (that i use to run docker), default gateway ip:
acl internal {
192.168.1.0/24;
192.168.0.0/24;
127.0.0.1;
localhost;
192.168.0.144;
};
options {
forwarders {
8.8.8.8;
8.8.4.4;
};
allow-query { internal; };
};
zone "test.home." IN {
type master;
file "/etc/bind/test-home.zone";
};
Below i attach test-home.zone
file
$TTL 2d
$ORIGIN test.home.
@ IN SOA test.home. root.test.home. (
202306151534 ; serial
12h
15m
3w
2h
)
IN NS ns.test.home.
@ IN NS ns.test.home.
ns IN A 172.19.0.1
test-name IN A 192.168.0.144
Having such setup, I could resolve known names with commands:
nslookup google.com 172.19.0.1
The output of above command:
Server: UnKnown
Address: 172.19.0.1
Non-authoritative answer:
Name: google.com
Addresses: 2a00:1450:401b:814::200e
142.250.203.142
But when I tried to resolve my name, it could not find a domain:
nslookup test-name.test.home 172.19.0.1
and the output:
Server: UnKnown
Address: 172.19.0.1
*** UnKnown can't find test-name.test.home: Non-existent domain
Other details:
I run my docker image on Ubuntu
I use Bind9 for DNS server.
Here is output of docker inspect command for container hosting DNS server:
"NetworkSettings": {
"Bridge": "",
"SandboxID": "4b80c61e0f521afd51926708b1bfcc0fdb71a755566114af9cbe93cd0a44a462",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"53/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "53"
}
],
"53/udp": [
{
"HostIp": "0.0.0.0",
"HostPort": "53"
}
],
"953/tcp": null
},
"SandboxKey": "/var/run/docker/netns/4b80c61e0f52",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"dns-experiments_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"bind9",
"ab0859f8c64b"
],
"NetworkID": "9d5d03264503be5fee52e99bc04407da0d41f87eff3b07393805bc7aa019c734",
"EndpointID": "e8612947adc69d959dbac41abf78f8f14b7394efb5bb11a4d453e8bea745c298",
"Gateway": "172.19.0.1",
"IPAddress": "172.19.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:13:00:02",
"DriverOpts": null
}
}
}
So the question is: it does not seem to resolve my name test-name.test.home
correctly. Why and how could I fix it?
Update
Per recommendation from comments, I tried using IP address from my docker inspect output, but it did not work either. When executing nslookup
I get only:
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out