BIND9 Dynamic Zone Management Cheat Sheet
Here’s a concise BIND9 Dynamic Zone Management Cheat Sheet
to handle common tasks and troubleshoot dynamic zones:
dynProxy
client
- mkdir -p /root/scripts/dynProxy/token
- vim /root/scripts/dynProxy/update_zone_client.sh
edit TOKEN_FILE - chmod +x /root/scripts/dynProxy/update_zone_client.sh
- openssl rand -hex 16 > /root/scripts/dynProxy/token/SUBDOM.DOM.TLD
- crontab -e
/etc/bind/named.conf.options ns1
acl "trusted" {
127.0.0.0/8;
10.0.3.0/24;
192.168.0.0/24;
};
options {
directory "/var/cache/bind";
dnssec-validation no;
querylog yes;
auth-nxdomain no;
notify yes;
version none;
listen-on { 127.0.0.1; SRVIP; };
listen-on-v6 { ::1; SRVIP; };
allow-query { any; };
allow-query-cache { trusted; };
recursion yes;
allow-recursion { trusted; };
max-cache-size 512M;
};
logging {
channel default_file {
file "/var/log/named/defaupdate_zone_client.sh
#!/bin/zsh
# Script Version: 10
# Description: Dyn DNS update script, checks token, compares IPs, and updates DNS zone if needed.
# Set variables
# ========
TOKEN_FILE="/root/scripts/dynProxy/token.txt"
IP_FILE="/root/scripts/dynProxy/ip.txt"
UPDATE_URL="http://ip.dynproxy.net/update_zone"
LOG_FILE="/var/log/update_zone.log"
# Functions
# ========
log() {
print "$(date '+%Y-%m-%dT%H:%M:%S.%6N'): $1" >> "$LOG_FILE"
}
update_zone_server.sh
#!/bin/zsh
# Script Version: 12.4
# Description: Dyn DNS update script, checks token and updates DNS zone.
# Set variables
DIRECTORY="/var/www/ip/token"
LOG_FILE="/var/log/dynProxy.log"
TOKEN_DNS_ZONE_FILE="/etc/bind/tokendnszone.conf"
NSUPDATE_SERVER="127.0.0.1"
DEBUG=true
log() {
local message="$1"
echo "$(date '+%Y-%m-%dT%H:%M:%S.%6N'): $message" >> "$LOG_FILE"
if $DEBUG; then echo "$message"; fi
}
log_debug() {
if $DEBUG; then log "$1"; fi
}
ipgetpost.sh
#!/usr/bin/zsh
# Script Version: 01
# Description: Script to obtain the public IP and post it to a server securely.
# Define the path to store the token
TOKEN_FILE="/root/scripts/token.txt"
LOG_FILE="/var/log/ipgetpost.log"
IP_URL="http://ip.dynproxy.net"
# Function to log messages
log_message() {
print "$(date): $1" >> "$LOG_FILE"
}
# Set umask to ensure files are created with the correct permissions
umask 077
# Check if the token file already exists, if not, generate a new token
if [ !