I have a webserver (running Ubuntu 12.04 server & Nginx) And I am setting up a number of websites on it.
I'm quite new to managing my own webserver, and I'm getting on pretty well except for when it comes to configuring the DNS.
I'd like to have the one server act as both the webserver and the DNS server (unless somebody can convince me otherwise..)
I've read through a couple BIND9 guides, but just don't understand why it has to be so complicated!
I would like one script, which I can run, something like: configure-dns.sh mydomain.com
which would create the zones and entries for 'mydomain' and set the current server as the host, and authorative server.
Ideally I would like my workflow for a new domain simply to be:
- Register the domain at a registrar
- At the registrar, set my DNS to be my server
- On my server, run 1 script which sets up the relevant DNS entries
- On my server, run 1 script which sets up the relevant webserver configs (I already have this)
So, Can you add a DNS entry with a simple bash script?
Thanks, Dean.
add to /etc/bind/named.conf:
make dir:
scripts:
run:
Yes, I've automated DNS management with shell scripts several times, for different infrastructures at different places of employment.
As to your other pseudo-question, "why it has to be so complicated", that's because DNS isn't a trivial thing in the general case, and BIND attempts to handle all the complicated corner cases. This means that the simple things aren't (quite) as simple as they might otherwise be, however it's nice to know that no matter how hairy things get, you'll be able to handle it.
Check out h2n. It's referenced in the BIND books by O'Reilly.
http://my.safaribooksonline.com/book/networking/dns/0789722739/the-dns-tool-chest/ch07lev1sec2