yum 安装bind
- yum install bind
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- * base: mirrors.linuxfb.org
- * extras: mirrors.linuxfb.org
- * updates: mirrors.linuxfb.org
- Setting up Install Process
- Resolving Dependencies
- --> Running transaction check
- ---> Package bind.x86_64 30:9.3.6-16.P1.el5_7.1 set to be updated
- --> Processing Dependency: bind-libs = 30:9.3.6-16.P1.el5_7.1 for package: bind
- --> Processing Dependency: libisccfg.so.1()(64bit) for package: bind
- --> Processing Dependency: libisccc.so.0()(64bit) for package: bind
- --> Processing Dependency: libbind9.so.0()(64bit) for package: bind
- --> Processing Dependency: libdns.so.26()(64bit) for package: bind
- --> Processing Dependency: liblwres.so.9()(64bit) for package: bind
- --> Processing Dependency: libisc.so.15()(64bit) for package: bind
- --> Running transaction check
- ---> Package bind-libs.x86_64 30:9.3.6-16.P1.el5_7.1 set to be updated
- --> Finished Dependency Resolution
- Dependencies Resolved
- =============================================================================
- Package Arch Version Repository Size
- =============================================================================
- Installing:
- bind x86_64 30:9.3.6-16.P1.el5_7.1 updates 988 k
- Installing for dependencies:
- bind-libs x86_64 30:9.3.6-16.P1.el5_7.1 updates 895 k
- Transaction Summary
- =============================================================================
- Install 2 Package(s)
- Upgrade 0 Package(s)
- Total download size: 1.8 M
- Is this ok [y/N]: y
- Downloading Packages:
- (1/2): bind-libs-9.3.6-16.P1.el5_7.1.x86_64.rpm | 895 kB 00:00
- (2/2): bind-9.3.6-16.P1.el5_7.1.x86_64.rpm | 988 kB 00:00
- -----------------------------------------------------------------------------
- Total 1.6 MB/s | 1.8 MB 00:01
- Running rpm_check_debug
- Running Transaction Test
- Finished Transaction Test
- Transaction Test Succeeded
- Running Transaction
- Installing : bind-libs 1/2
- Installing : bind 2/2
- Installed:
- bind.x86_64 30:9.3.6-16.P1.el5_7.1
- Dependency Installed:
- bind-libs.x86_64 30:9.3.6-16.P1.el5_7.1
- Complete!
- [root@centos129 opt]# /etc/init.d/named start
- Locating //etc/named.conf failed:
[失败]
配置文件必须按照模板来修改,以前的版本在/etc/下有个named.conf 5.5下没有,换成named.caching-nameserver.conf和named.rfc1912.zones,错误没有找到这个文件
是因为centos没有找到named.conf这个文件,解决问题,需要安装caching-nameserver这个包就可以了
/DNS缓存服务器文件
- [root@centos129 opt]# yum install caching-nameserver /
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- * base: mirrors.linuxfb.org
- * extras: mirrors.linuxfb.org
- * updates: mirrors.linuxfb.org
- Setting up Install Process
- Resolving Dependencies
- --> Running transaction check
- ---> Package caching-nameserver.x86_64 30:9.3.6-16.P1.el5_7.1 set to be updated
- --> Finished Dependency Resolution
- Dependencies Resolved
- =============================================================================
- Package Arch Version Repository Size
- =============================================================================
- Installing:
- caching-nameserver x86_64 30:9.3.6-16.P1.el5_7.1 updates 62 k
- Transaction Summary
- =============================================================================
- Install 1 Package(s)
- Upgrade 0 Package(s)
- Total download size: 62 k
- Is this ok [y/N]: y
- Downloading Packages:
- caching-nameserver-9.3.6-16.P1.el5_7.1.x86_64.rpm | 62 kB 00:00
- Running rpm_check_debug
- Running Transaction Test
- Finished Transaction Test
- Transaction Test Succeeded
- Running Transaction
- Installing : caching-nameserver 1/1
- Installed:
- caching-nameserver.x86_64 30:9.3.6-16.P1.el5_7.1
- Complete!
[root@centos129 opt]# service named start
启动 named: [确定]
启动DNS
可以cp -p named.caching-nameserver.conf named.conf 这个文件,也可以直接用这个文件!
修改name.conf和named ,添加forwarders语句使dns成为一个简单的转发查询服务器
- //
- // named.caching-nameserver.conf
- //
- // Provided by Red Hat caching-nameserver package to configure the
- // ISC BIND named(8) DNS server as a caching only nameserver
- // (as a localhost DNS resolver only).
- //
- // See /usr/share/doc/bind*/sample/ for example named configuration files.
- //
- // DO NOT EDIT THIS FILE - use system-config-bind or an editor
- // to create named.conf - edits to this file will be lost on
- // caching-nameserver package upgrade.
- //
- options {
- listen-on port 53 { 172.16.148.129; };
- 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";
- forwarders {202.96.209.5;};
- // Those options should be used carefully because they disable port
- // randomization
- query-source port 53;
- // query-source-v6 port 53;
- allow-query { any; };
- allow-query-cache { any; };
- };
- logging {
- channel default_debug {
- file "data/named.run";
- severity dynamic;
- };
- };
- view localhost_resolver {
- match-clients { any; };
- match-destinations { any; };
- recursion yes;
- "named.conf" 41L, 1237C 15,2-9 顶端
客户端测试成功
- [zhoutao@WorkSpace ~]$ nslookup baidu.com
- Server: 172.16.148.129
- Address: 172.16.148.129#53
- Non-authoritative answer:
- Name: baidu.com
- Address: 220.181.111.86
- Name: baidu.com
- Address: 123.125.114.144
- Name: baidu.com
- Address: 220.181.111.85
- 一个简单的域名服务器[root@centos129 etc]# tail -20 named.rfc1912.zones
- zone "test.com" IN {
- type master;
- file "test.zone";
- allow-update { none; };
- };
- zone "148.16.172.in-addr.arpa" IN {
- type master;
- file "test.local";
- allow-update { none; };
- };
- 在//etc/named.rfc1912.zones添加test域名
创建test.local.test.zone区域文件
- [root@centos129 named]# cat test.local
- $TTL 86400
- @ IN SOA test.com. root.test.com. (
- 1997022700 ; Serial
- 28800 ; Refresh
- 14400 ; Retry
- 3600000 ; Expire
- 86400 ) ; Minimum
- IN NS test.com.
- 129 IN PTR www.test.com.
- [root@centos129 named]# cat test.zone
- $TTL 86400
- @ IN SOA test.com. root@test.com. (
- 42 ; serial (d. adams)
- 3H ; refresh
- 15M ; retry
- 1W ; expiry
- 1D ) ; minimum
- IN NS test.com.
- test IN A 172.16.148.129
- www IN A 172.16.148.129
- ftp IN CNAME www
- mail IN A 172.16.148.129
- mail IN MX 10 mail.test.com
客户端修改resolv.conf文件后测试通过
- [zhoutao@WorkSpace ~]$ nslookup
- > ftp.test.com
- Server: 172.16.148.129
- Address: 172.16.148.129#53
- ftp.test.com canonical name = www.test.com.
- Name: www.test.com
- Address: 172.16.148.129
- > 172.16.148.129
- Server: 172.16.148.129
- Address: 172.16.148.129#53
- 129.148.16.172.in-addr.arpa name = www.test.com.
- >
- > set type MX
- *** Invalid option: type
- > set type=MX
- > mail.test.com
- Server: 172.16.148.129
- Address: 172.16.148.129#53
- mail.test.com mail exchanger = 10 mail.test.com.test.com.
- >