13.4 Configuring a Name Server

By default, the BIND installation allows you to configure a caching-only name server using the configuration settings that are provided in /etc/named.conf and files that it includes. This procedure assumes that you will either use the default settings or configure new named configuration and zone files.

To configure a name server:

  1. Install the bind package:

    # yum install bind
  2. If NetworkManager is enabled on the system, edit the /etc/sysconfig/network-scripts/ifcfg-interface file, and add the following entry:

    DNS1=127.0.0.1

    This line causes NetworkManager to add the following entry to /etc/resolv.conf when the network service starts:

    nameserver 127.0.0.1

    This entry points the resolver at the local name server.

    If you have disabled NetworkManager, edit /etc/resolv.conf to include the nameserver 127.0.0.1 entry.

  3. If required, modify the named configuration and zone files.

  4. Allow incoming TCP connections to port 53 and incoming UDP datagrams on port 53 from the local network:

    # iptables -I INPUT -s subnet_addr/prefix_length -p tcp \
      -m state --state NEW -m tcp -–dport 53 -j ACCEPT
    # iptables -I INPUT -s subnet_addr/prefix_length -p udp \
      -m udp -–dport 53 -j ACCEPT
    # service iptables save

    where subnet_addr/prefix_length specifies the network address, for example 192.168.1.0/24.

  5. Restart the network service, restart the named service, and configure named to start following system reboots:

    # service network restart
    # service named start
    # chkconfig named on