I am having problem with DNS configuration in Linux. I am using isc-dhcp-server as DHCP server and bind9 as DNS server, but I it returning me errors.
This is my Setup
Internet <--enp0s3 interface-->router<--enp0s8 interface-->Ubuntu server
The router serves both as DHCP and DNS server and the Ubuntu server is for internal uses. The enp0s3 interface has access to the internet and the enp0s8 is for internal network.
The enp0s8 interface on the router has the address of 192.168.1.1 and the Ubuntu Server has an address of 192.168.1.2. The DHCP server works, the machines can ping each other.
The problem comes from the DNS server, I gave the Ubuntu server the name server and when I run this command ping server it returns me this error:
$ ping server
ping: server: Temporary failure in name resolution
When I check the bind9.service status it gives me this:
$ sudo systemctl status bind9.service
● named.service - BIND Domain Name Server
Loaded: loaded (/lib/systemd/system/named.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2024-02-20 11:10:08 UTC; 6min ago
Docs: man:named(8)
Process: 2759 ExecStart=/usr/sbin/named $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 2760 (named)
Tasks: 5 (limit: 2221)
Memory: 5.6M
CPU: 141ms
CGroup: /system.slice/named.service
└─2760 /usr/sbin/named -u bind
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:500:a8::e#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:500:12::d0d#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:500:9f::42#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2801:1b8:10::b#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:500:2f::f#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:500:2::c#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:7fe::53#53
Feb 20 11:10:08 fox-router named[2760]: network unreachable resolving './NS/IN': 2001:503:ba3e::2:30#53
Feb 20 11:10:08 fox-router named[2760]: managed-keys-zone: Key 20326 for zone . is now trusted (acceptance timer complete)
Feb 20 11:10:08 fox-router named[2760]: resolver priming query complete: success
These are the commands that I had run when configuring the DHCP server:
Router
Ubuntu Server as Router
Assign IP address to interface
sudo vim /etc/netplan/00-installey-config.yaml
__________________________________
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcpd4: true
addresses: [192.168.1.1/24]
version: 2
__________________________________
sudo netplan apply
DHCP server
sudo apt install isc-dhcp-server
sudo vim /etc/dhcp/dhcpd.conf
__________________________________
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0{
range 192.168.1.2 192.168.1.10;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
host Server{
hardware ethernet: <MAC address>
fixed-address: <IP Address>
}
Assign interface for DHCP service
sudo vim /etc/default/isc-dhcp-server
__________________________________
INTERFACESv4="enp0s8"
Restart/start DHCP server
sudo systemctl start isc-dhcp-server //START SERVICE
sudo systemctl status isc-dhcp-server //CHECK STATUS
sudo systemctl restart isc-dhcp-server //RESTART SERVICE
And these are the commands I had run for the DNS server:
$ sudo apt-get install bind9
Edited the /etc/bind/named.conf.options file.
forwarders {
8.8.8.8;
8.8.4.4;
};
Configure the zones in the /etc/bind/named.conf.local
zone "foxnetwork.net" {
type master;
file "/etc/bind/db.foxnetwork.net";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.168";
};
And created the zones: /etc/bind/db.foxnetwork.net
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.foxnetwork.net. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.foxnetwork.net.
foxnetwork.net. IN MX 10 mail.foxnetwork.net.
ns IN A 192.168.1.1
web IN A 192.168.1.2
; The reverse zone
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.foxnetwork.net root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.
1 IN PTR ns.foxnetwork.net.
2 IN PTR web.foxnetwork.net.
I had then restarted the bind9 and DHCP servers. But I still can't ping the router with ping ns and the server with ping server
option domain-name-servers 8.8.8.8, 8.8.4.4
Here already and second, why use forward in bind9 instead using the bind instance to resolve it? that's a home and end-user setup that you show usnslookup server 192.168.1.1
. This bypasses /etc/resolv.conf and takes the address that you have provided as the address of the DNS server to be queried.