DNS是什么呢,是全世界所有的域名对应的ip解析的服务器,输入一个域名可以解析到ip,输入ip可以解析到域名,比较常用的dns地址114.114.114.114,假如一个人的电脑配置的dns地址不对,通过域名来访问服务器web应用的时候就解析不到主机,资源就获取不到了,既然dns是一台服务器,那么自己的电脑就可以搭建DNS服务器了,linux下搭建dns服务器的有bing9,下面是主要配置的参数:
文件名:/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
forwarders {
114.114.114.114;
};
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
上面的那个forwarders意思是本地DNS没解析到的去中国区通用的DNS服务器解析(这地方可以想象);
文件名:/etc/bind/named.conf.default-zones
// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zon