-1

I have couple of servers and a client and a DNS server running bind9. All are running Ubuntu 18.04 in virtual machines.

I want to make changes to the DNS forward zone file to make a change for the IP addresses of one of the servers. After the change in the DNS server I run:

sudo systemctl restart bind9

Then in the client, I clear the history and files from the browser. Then I also flush the DNS using this command:

sudo /etc/init.d/networking restart

But when I visit the server that I just changed its IP in the DNS, the client still sees the old IP content in the browser. i.e. the DNS seems to resolve to the old IP (which is an active server).

But when I restart both the client and DNS server, the resolution gets updated and the server resolves to the new IP and the client gets the page I assume.

It seems to me there is something not refreshing the DNS zone file changes immediately. Note that I update the serial before saving the zone file.

There are some other values which I do not know if they are causing delay in making changes effective?

These are the values at the beginning of the forward zone file:

;
; BIND data file for local loopback interface
;
$TTL    604800
@   IN  SOA ns222.com. boss.com. (
                  9     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
qbq
  • 15
  • 1
  • 3
  • pls describe more Details about how you sync, or what Kind of server you mean. if a Client is affected and is windows try to stop dns Client because it Caches requests – djdomi Aug 18 '19 at 20:24
  • You do not need to restart the bind9 process after each zonefile changes, there are other solutions. – Patrick Mevzek Aug 19 '19 at 04:46

1 Answers1

1

You set a default time to live in the start of your zone with

$TTL    604800

that is 7 days.

Although when you make a change in the master zone file and reload the zone your name server will immediately start to return the updated record ; unless you set a different Time To Live on specific records (well before you intend to change them ) that is how long records will remain cached by any reasonable resolver and how long it might take for your update to become effective.


Rather than testing for DNS issues with your web browser a much more appropriate tool is dig


I don’t have an Ubuntu 18 available at the moment but as far as I know that also uses the systemd resolver by default and it would not surprise me if clearing the DNS cache requires (only) the appropriate systemd sub command rather than restarting the network

sudo systemd-resolve --flush-cache
HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • `.. and reload the zone your name server will immediately start to return the updated record`. How to reload the zone? – qbq Aug 19 '19 at 09:42
  • Configure the keys for `rndc` (With `rndc-confgen -a` ) and then you can do `rndc reload example.com` – HBruijn Aug 19 '19 at 10:45