bind 简单配置dns
2024-10-19 04:30:22
一、 安装
apt-get install bind9
apt-get install bind9-host dnsutils
apt-get install bind9-doc 二、修改本机配置
我们要事先把Debian机器的DNS指向它自己。修改/etc/resolv.conf,修改成:
#DNS of test111.com
nameserver 127.0.0.1 三、配置
cd /etc/bind
vim named.conf.local
增加正向解析和反向解析区域(zone):
zone "test111.com" {
type master;
file "/etc/bind/db.test111.com";
};
zone "168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192.168";
}; 1.1 正向解析:db.test111.com内容如下:
$TTL 604800
@ IN SOA test111.com. admin.test111.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.test111.com.
@ IN A 192.168.10.2
ns IN A 192.168.10.2
www IN CNAME @
ftp IN CNAME @
proxy IN CNAME @
blog IN CNAME @
test IN CNAME @
mysql IN CNAME @
* IN A 192.168.10.2
这里指定了域test111.com的dns服务器为ns.test111.com. 即为本机。因为下面的正向解析记录的A记录将它解析到了本机了。
并且添加了好几个CNAME(别名)记录,都指向192.168.10.2 。
最后添加泛解析支持,所有对*.test111.com的请求都会被解析到192.168.10.2 。 1.2 反向解析:db.192.168内容如下:
$TTL 604800
@ IN SOA test111.com. admin.test111.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.test111.com.
2.1 IN PTR test111.com.
这里的反向解析很简单,就是将192.168.10.2指向test111.com
2.配置cache(缓存)dns服务器
vim named.conf.options
去掉其中几个注释符号(//) ,添加你所在网络的ISP (internet 信息服务提供商)的DNS 。最后内容如下:
options {
directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder. forwarders {
218.2.135.1;
202.102.24.35;
61.147.37.1;
}; auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
参考:http://blog.csdn.net/bluecy/article/details/44907215
最新文章
- python基础-面向对象编程
- 初识Scala反射
- SQL查询到的数据放到DataSet中
- python基础之迭代与解析
- [Linux] yum和apt-get用法及区别
- MySQL主存复制与读写分离的感悟
- 基于jquery的inputlimiter 实现字数限制功能
- Centos 6.5中使用yum安装jdk
- JavaScript设置右下角悬浮窗
- NFC的安全性
- C#操作Xml:使用XmlWriter写Xml
- Python处理图片缩略图
- pdf文件下载水印添加的中文与空格问题解决
- Vue(小案例_vue+axios仿手机app)_购物车(二模拟淘宝购物车页面,点击加减做出相应变化)
- mongodb实现自增的方法
- [转]Python shutil 模块
- browsersync即时刷新页面
- 常用的API接口
- 【SQLSERVER】从数据库文件mdf中拆分ndf的方法和利弊
- Thunder团队第五周 - Scrum会议6