Setup a simple DNS server

Referenced from: https://www.garron.me/en/go2linux/how-setup-dns-server-master-slave-bind.html

Steps:

1. Install bind

yum install -y bind

2. Create a Master Zone

To create a master zone, edit the file named.conf and add the following, in this example, I will create a zone for the domain linux10.com

zone "linux10.com" IN {

    type master;

    file "/etc/named/linux10.com.zone";

    allow-update { none; };

    allow-transfer { none; };

};

3. Then create the file /etc/named/linux10.com.zone

The file should look at least like this:

$ORIGIN .

$TTL 86400      ; 1 day

linux10.com            IN SOA  primary.server.com. your.email.address. (

                            2010122801 ; serial

                            7200      ; refresh (2 hous)

                            7200      ; retry (2 hours)

                            2419200    ; expire (5 weeks 6 days 16 hours)

                            86400      ; minimum (1 day)

                            )

$TTL 14400      ; 4 hours

                    NS      scz.alketech.com.

                    NS      ns1.alketech.com.

                    A      10.1.1.1 ; If you want to assign a server to your domain

                  MX      10      mx1 ; Your email server if you have any

                  MX      20      mx2 ; Your secondary email server if you have one

$ORIGIN linux10.com.

www                    A      1.2.3.4 ; The IP of your web server if you want to have one.

mx1        A  1.2.3.5 ; The IP of your mx1 server

mx2        A  1.2.3.6 ; The IP of your mx2 server

Of course yours may have more or less lines and servers according to your needs.

4. Restart bind service

/etc/init.d/named restart

你可能感兴趣的:(Setup a simple DNS server)