Installing and configuring Bind on Amazon Linux

Here is how I set up a Bind forwarding server on amazon Linux

  • To start, let’s install Bind:
# yum install bind
  • Now let’s make it automatically start:
# chkconfig --level 2 named on
# chkconfig --level 3 named on
# chkconfig --level 4 named on
# chkconfig --level 5 named on
  • Now start the service:
    # service named start
    Generating /etc/rndc.key: [ OK ]
    Starting named:           [ OK ]
  • Test that it works:
# nslookup - 127.0.0.1
> www.google.com.au
Server: 127.0.0.1
Address: 127.0.0.1#53

Non-authoritative answer:
Name: www.google.com.au
Address: 216.58.199.35
  • It works on this server, but we need to allow other IP addresses to query this Bind server by editing named.conf:
# vim /etc/named.conf
  • Edit the named.conf to include the IP networks/hosts that you want Bind to listen to. In my case it’s 10.1.1.0/24. Don’t forget the semi-colon.
options {
        listen-on port 53 { 127.0.0.1; 10.1.1.0/24; };
...
...
        allow-query { localhost; 10.1.1.0/24; };

  • After saving the file and returning to the prompt, we need to reload Bind.
# service named reload
Reloading named:            [ OK ]

 

  • Congrats, by this point you should be able to use this as your DNS server.