|
第一步:
1.注册NS
你要准备一个或者多个域名,并注册ns(王某这里使用的是 wangmou.com,注册的是子域名 ns),注册IP为ns服务器IP;
2.解析ns
然后通过第三方DNS系统(或者自建DNS系统)设置ns的A记录到你ns服务器IP。
第二步:安装bind(以CentOS为例)
- yum install -y bind bind-chroot bind-utils
复制代码 bind 配置
修改主配置文件 /etc/named.conf
- options {
- listen-on port 53 { any; }; //监听端口
- listen-on-v6 port 53 { ::1; };
- directory "/var/named";
- dump-file "/var/named/data/cache_dump.db";
- statistics-file "/var/named/data/named_stats.txt";
- memstatistics-file "/var/named/data/named_mem_stats.txt";
- recursing-file "/var/named/data/named.recursing";
- secroots-file "/var/named/data/named.secroots";
- allow-query { any; }; //允许访问的IP地址段,这里设置为所有
- recursion yes;
- dnssec-enable yes;
- dnssec-validation yes;
- /* Path to ISC DLV key */
- bindkeys-file "/etc/named.root.key";
- managed-keys-directory "/var/named/dynamic";
- pid-file "/run/named/named.pid";
- session-keyfile "/run/named/session.key";
- };
- logging {
- channel default_debug {
- file "data/named.run";
- severity dynamic;
- };
- };
- zone "." IN {
- type master;
- file "wangmou.zone";
- };
- include "/etc/named.rfc1912.zones";
- include "/etc/named.root.key";
复制代码 编辑数据配置文件 /var/named/wangmou.zone(注:wangmou.zone 可以为其他名称,请根据需求修改,必须与 file "wangmou.zone";对应)
- $TTL 1D
- @ IN SOA @ kefu.wangmou.com. (0 3600 120 600 10 )
- IN NS @
- IN A 1.2.3.4
- * IN A 1.2.3.4
复制代码 启动(重启)服务
启动named服务
将服务添加到开机启动
重启服务
注:防火墙需要放行 53 端口(tcp/udp)
|
|