Our aim is to use a LAN machine to complete the 192.168.1.113 <-->cloudshield.com resolution, specify a record and CNAME;
0. About ubuntu 14.04.2 LTS Download, install, update here to skip directly;
1. Download the installation tool BIND9
sudo apt-get install bind9
The DNS configuration file is in the/etc/bind directory. After installing BIND9, the following three configuration files are generated:
named.conf;
named.conf.options;
named.conf.local; Named.conf is the main configuration file, which contains the named.conf.options and named.conf.local, we set up the local DNS, only need to change the named.conf.local;
2. Modify the/etc/bind/named.conf.local file, mainly add two zones: Forward parsing and reverse parsing ( 这里直接附上我自己的配置,由于编辑器会去除文件中的tab变成空格,所以就不贴配置文件引起误解了,最后会放在附件里,如果有需要的可以下载
)
//Domain->ipZone"home.easyunion.net" inch{type Master; File"/var/cache/bind/db.easyunion.net";};//Ip->domainZone"3.168.192.in-addr.arpa" inch{type Master; File"/var/cache/bind/reverse/db.3.168.192";};
3. Create the db.cloudshield.com file and configure it (depending on the path of the named.conf.local)
sudo touch /var/cache/bind/db.cloudshield.com
And then sudo vi
open the following editor.
Vim/var/cache/bind/db.easyunion.net
$TTL604800@ in SOA easyunion.net. Roo.easyunion.net. (2 ; Serial604800 ; Refresh86400 ; Retry2419200 ; Expire604800) ; Negative Cache ttl@ in NS ns.easyunion.net.@ in A192.168.3.47NS in A192.168.3.47Test in A192.168.3.47home in A192.168.3.47www in A192.168.3.47
It's important to note that in addition to root.cloudshield.com, the middle space is tab.
4. Create the db.1.168.192 file and edit it as follows (this is because DNS parsing is right-to-left so write it backwards, and it's an IP segment, which is similar, no more)
vim/var/cache/bind/db.3.168.192
$TTL604800@ in SOA easyunion.net. Root.easyunion.net. (2 ; Serial Number604800 ; Refresh86400 ; Retry2419200 ; Expire86400 ) ; minimum@ in NS easyunion.net. theIn PTR test.easyunion.net. theIn PTR home.easyunion.net. theIn PTR www.easyunion.ent. theIn PTR ns.easyunion.net.
5. In/etc/bind/named.conf.option, do some file log location pointing
6. Set the machine for the first DNS nameserver, in the/etc/resolv.conf file (note: I am in the modification of this is a link file, so directly to the past to modify the source file on the line)
Add in the first line: nameserver 192.268.1.113
Here the entire DNS configuration is complete;
7. Test it:
记得首先的重启下bind9
Shell Knockservice bind9 restart
This time can be measured with tools such as host/dig/nslookup (usually comes with):
Host:
Dig:
Nslookup:
8. If unable to test pass or restart bind, it is likely because the configuration file format is not correct, you can use the tail name to view the system log, gradually find the problem, I believe that the method is more difficult;
tail -10 /var/log/syslog
Ubuntu 14.04.3 LTS Configuration DNS Server