1.安装bind9python
sudo apt-get install bind9
2.编辑文件服务器
sudo vi /etc/bind/named.conf.local
加入字段:网络
其中example是要配置的域名,第二个节为反响映射ide
zone "example.com" { type master; file "/etc/bind/zones/example.com.db"; }; # This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation - e.g my network address is 192.168.0 zone "0.168.192.in-addr.arpa" { type master; file "/etc/bind/zones/rev.0.168.192.in-addr.arpa"; };
3.编辑文件rest
配置网络提供商的dns服务器
日志
sudo vi /etc/bind/named.conf.options
forwarders { # Replace the address below with the address of your provider's DNS server 123.123.123.123; };
4.编辑example域名配置的文件code
sudo vi /etc/bind/zones/example.com.db
内容:
server
example.com. IN SOA ns1.example.com. admin.example.com. ( 2006081401 28800 3600 604800 38400 ) example.com. IN NS ns1.example.com. example.com. IN MX 10 mta.example.com. IN A 192.168.37.160 www IN A 192.168.37.160 mta IN A 192.168.37.3 ns1 IN A 192.168.37.1
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa
@ IN SOA ns1.example.com. admin.example.com. ( 2006081401; 28800; 604800; 604800; 86400 ) IN NS ns1.example.com. 1 IN PTR example.com
5.编辑文件dns
sudo vi /etc/resolv.conf
search example.com nameserver 192.168.0.1
6. 重启bind9服务get
/etc/init.d/bind9 restart 生效
7.重启后能够查看系统日志/var/log/syslog 是否出错。