Skip to content

Instantly share code, notes, and snippets.

@aojea
Created February 2, 2023 22:28
Show Gist options
  • Select an option

  • Save aojea/3b4dc39195f52cd85b3529e9b78a67c4 to your computer and use it in GitHub Desktop.

Select an option

Save aojea/3b4dc39195f52cd85b3529e9b78a67c4 to your computer and use it in GitHub Desktop.
Max number of IPs in an A record
  1. Use the stable bind server
docker run -d --rm --name=bind9 internetsystemsconsortium/bind9:9.18
  1. Exec into the container
docker exec -it bind9 bash
  1. Install dnsutils
apt-get update && apt-get install dnsutils
  1. Generate a large zone (use the existing db.local for localhost)
cd /etc/bind

for i in $( seq 1 255); do
  for j in $( seq 1 255); do
    for k in $( seq 1 255); do
      echo "test    IN      A     10.$i.$j.$k" >> db.local
    done
  done
done

cp db.local /
  1. Test with different number of records

root@fc239df9d6e8:/etc/bind# head -n 2000 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
   2006   10012   79144
root@fc239df9d6e8:/etc/bind# head -n 3000 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
   3006   15012  119402
root@fc239df9d6e8:/etc/bind# head -n 4000 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
   4006   20012  159970
root@fc239df9d6e8:/etc/bind# head -n 5000 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
     19      85     585
# 5000 fails
root@fc239df9d6e8:/etc/bind# head -n 4100 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
   4106   20512  164060
# 4300 fails
root@fc239df9d6e8:/etc/bind# head -n 4300 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
     19      85     585
...
root@fc239df9d6e8:/etc/bind# head -n 4107 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
     19      85     585
root@fc239df9d6e8:/etc/bind# head -n 4106 /db.local > db.local
root@fc239df9d6e8:/etc/bind# kill -HUP 1
root@fc239df9d6e8:/etc/bind# dig test.localhost @localhost | wc
   4112   20542  164296
   
grep test db.local | wc
   4091   16364  135051

Max number of IPs for the same A record seems to be 4091

@aojea
Copy link
Author

aojea commented Feb 2, 2023

The bind daemon fails with the following error

02-Feb-2023 22:11:55.656 dns_master_load: /etc/bind/db.local:65554: test.localhost: ran out of space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment