Author
Christopher Marshall (christopherlmarshall@yahoo.com)
Raw Notes on Bind
#!/bin/bash
#
# this is a bash script that constructs a complete bind configuration, then starts bind.
#
# Run it as root in one xterm, and test it from another xterm by typing commands like:
# host a
# and
# host 10.3.0.2
#
# The "-g" argument to bind (see last line in script) prevents bind from becoming a daemon and
# keeps it in the foreground where you can kill it with cntl-c.
# "-g" also forced bind to print its diagnostic messaged to stdout (instead of to the syslog).
#
# file_summary: full bind and resolver configuration for uml.net domain with three hosts a,b, and c at addresses 10.3.0.1, 10.3.0.2, 10.3.0.3.
#
# you can test this from another shell by running the commands:
# host a localhost
# host 10.3.0.2 localhost
# host b localhost
# host 10.3.0.3 localhost
# host c localhost
(
echo "nameserver localhost"
echo "search uml.net"
) > /etc/resolv.conf
(
echo "options {"
echo " directory \"/var/named\";"
echo "};"
echo ""
echo "zone \"uml.net.\" in {"
echo " type master;"
echo " file \"db.uml.net\";"
echo "};"
echo ""
echo "zone \"0.3.10.in-addr.arpa\" in {"
echo " type master;"
echo " file \"db.10.3.0\";"
echo "};"
) > /etc/named.conf
(
echo "uml.net. IN SOA a.uml.net. root.a.uml.net. ("
echo " 1 "
echo " 10800 "
echo " 3600 "
echo " 604800 "
echo " 86400 "
echo ")"
echo ""
echo "uml.net. IN NS a.uml.net."
echo "a.uml.net. IN A 10.3.0.1"
echo "b.uml.net. IN A 10.3.0.2"
echo "c.uml.net. IN A 10.3.0.3"
) > /var/named/db.uml.net
(
echo "0.3.10.in-addr.arpa. IN SOA a.uml.net. root.a.uml.net. ("
echo " 1 "
echo " 10800 "
echo " 3600 "
echo " 604800 "
echo " 86400 "
echo ")"
echo ""
echo "0.3.10.in-addr.arpa. IN NS a.uml.net."
echo ""
echo "1.0.3.10.in-addr.arpa. IN PTR a.uml.net."
echo "2.0.3.10.in-addr.arpa. IN PTR b.uml.net."
echo "3.0.3.10.in-addr.arpa. IN PTR c.uml.net."
) > /var/named/db.10.3.0
# by running with -g, named prints errors to stderr and stays in the foreground.
named -g
