question about serial numbers

Mark_Andrews at isc.org Mark_Andrews at isc.org
Sat Jun 26 00:27:58 UTC 1999


> Bill Manning wrote:
> > 
> > >
> > > Hi. Maybe someone can help...
> > > Suppose someone accidently set a serial number higher than the date
> > > (lets say they set it for the year two thousand) is there any way you
> > > can make it lower again??
> > > thanks
> > >
> > >
> > 
> > the SOA is a signed integer, not a date
> > RFC 1982 (if memory serves) will be of great help.
> 
> Somebody who thinks about the question, instead of rattling off a 
> "Read the RFC" answer would probably help, too.  
> 
> For our SOA serial number we use the format YYMMDDN ( N being the
> Nth update performed that day ).  Presuming this is case here, and
> the date was set wrong on the primary, then updating it alone will
> not work because the secondary will refuse to accept it.

	Perhaps you should read RFC 1982 rather than rattle off the
	nonsence below.  It is quite possible to go from any serial
	number to any other.  Sometimes it take a intemediate step
	or two but it is always possible.  The only time when you have
	to restart the secondaries is when you are running really old
	version of BIND which cannot go from having the high bit set
	to not having the high bit set.

	The following code works on 32 bit machines and allows you
	to work out a series of serial numbers that will get you from
	where you are to where you want to be.  After each change you
	need to wait for the secondaries to catch up.

	Mark

#include <stdlib.h>
#include <limits.h>
#include <stdio.h>

#define SEQ_GT(a,b)   ((long)((a)-(b)) > 0)
#define STEP 0x7fffffffUL

main(argc,argv)
	int argc;
	char **argv;
{
	unsigned long t2;
	unsigned long start, end;
	char *e;
	
	if (argc < 3)
		exit(1);
	start= strtoul(argv[1], &e, 10);
	if (*e != '\0')
		printf("bad start \"%s\"\n", argv[1]);
	end = strtoul(argv[2], &e, 10);
	if (*e != '\0')
		printf("bad end \"%s\"\n", argv[1]);

	t2 = start + STEP;

	printf("%lu %lu", start, t2);
	t2 += STEP;
	while (SEQ_GT(end, t2)) {
		printf(" %lu", t2);
		t2 += STEP;
	}
	printf(" %lu\n", end);
	exit(0);
}

> 
> So:
> 
> 1) Set the serial number of the primary.
> 2) Go to the secondary, and rename it's copies of the zone files ( the
>    ones it writes when it does an transfer ).
> 3) Restart the primary followed by the secondary.
> 
> When the primary restarts it will re-read it's files, which will now
> have the lower value.  When the secondary restarts it will not find any
> files, and will go back to the primary for a zone transfer.  
> 
> --
>      /^^^\      Craig Dupree                Academic Computing Services
>     /~O~O~\     Network Support Specialist  Univ. Texas at Arlington 
>     \  U  /     cdupree at uta.edu             PO Box 19318
> -oOo-------oOo- Davis Hall, B88I            Arlington, TX 76019
>                 (817)272-7093
> 
> 
	The original anwer provide enough information to allow you
	to learn how to roll over a serial number.  You can do this
	just 
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org


More information about the bind-users mailing list