Author Topic: Error with DNS and Clusters.  (Read 3579 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Error with DNS and Clusters.
« on: April 25, 2020, 04:06:56 PM »
Hello!

A few days ago I discovered an error and opened a support ticket, since I don't get the right answer, I indicate it here in case someone knows how to fix it.

We continue to advance the module to give IPv6 support to CWP domains. We already have everything working, but recently ("We don't know if it was a CWP update") the changes made in the DNS files of the domains are not synchronized with the DNS cluster servers.

If we make any manual change from the "zone_editor" module, it will be correctly updated to the DNS clusters.

If we make the changes directly on the domain DNS file the changes in the DNS clusters are not synchronized. When I talk about the file, I mean any in this path: /var/named/domain.com.db

Does anybody know how we can get that when we make the changes directly on the file, the update to the DNS clusters is forced?

Our module uses the following function to edit the DNS file:

Code: [Select]
//***Escribir DNS****////
function escribirdns($dominio, $ipv6){
$cadena_a_agregar = '@ 14400 IN AAAA '.$ipv6;
$filenamedns = ('/var/named/'.$dominio.'.db');
$lineas = file($filenamedns);
$f = fopen($filenamedns, 'a');
fwrite($f, $cadena_a_agregar."\n");
fclose($f);
}
//***Fin Escribir DNS****////

Let's see if someone helps us.

Greetings!
Partner de CWP

Hosting de calidad en Espaņa con soporte en Espaņol para CWP - https://www.coriaweb.hosting

Offline
****
Re: Error with DNS and Clusters.
« Reply #1 on: April 25, 2020, 04:34:28 PM »
Quite simply.  You're not updating the serial number for the zone.  So bind doesn't know to send the update to the slave servers.  Use SED to update the serial +1
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: Error with DNS and Clusters.
« Reply #2 on: April 25, 2020, 06:34:04 PM »
Quite simply.  You're not updating the serial number for the zone.  So bind doesn't know to send the update to the slave servers.  Use SED to update the serial +1

I'm almost certainly doing it wrong, but he doesn't listen.

The file updates but doesn't go to the cluster.. What am I missing?

Code: [Select]
sed -i 's/2020042575/2020042576/g' /var/named/domain.com.db
The serial is changed correctly, but it is not updated in the dns clusters.
Partner de CWP

Hosting de calidad en Espaņa con soporte en Espaņol para CWP - https://www.coriaweb.hosting

Offline
****
Re: Error with DNS and Clusters.
« Reply #3 on: April 25, 2020, 06:46:00 PM »
Code: [Select]
ser=$(grep -o "20[0-9][0-9]\{7\}" /var/named/$dominio.db)
fir="${ser::-3}"
las="${ser:7:3}"
las=$(( $((10#$las)) + 1 ))
if [ ${#las} -lt 3 ]
then
las="00$las"
fi
las=${las: -3}
ser2="$fir$las"
sed -i "s/20[0-9][0-9]\{7\}/$ser2/g" /var/named/$dominio.db
« Last Edit: April 25, 2020, 06:48:26 PM by rcschaff »
Google Hangouts:  rcschaff82@gmail.com

Offline
****
Re: Error with DNS and Clusters.
« Reply #4 on: April 25, 2020, 06:50:01 PM »
After you update the serial, you need to rndc reload {zone}
Google Hangouts:  rcschaff82@gmail.com