您的位置:首页 > 运维架构 > Linux

Linux(RHEL 4)系列 之 DNS配置

2009-10-21 00:02 405 查看
[root@localhost ~]# ifconfig eth0 //查看网卡信息eth0 Link encap:Ethernet HWaddr 00:0C:29:07:48:16 inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe07:4816/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:100 errors:0 dropped:0 overruns:0 frame:0 TX packets:51 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:19566 (19.1 KiB) TX bytes:6000 (5.8 KiB) Interrupt:185 Base address:0x2000[root@localhost ~]# rpm -qa|grep bind //查看是否安装bind所要的包,没有就用rpm安装bind-libs-9.2.4-16.EL4bind-9.2.4-16.EL4ypbind-1.17.2-8bind-chroot-9.2.4-16.EL4bind-utils-9.2.4-16.EL4[root@localhost ~]# vi /etc/hosts //编辑主机hosts文件# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1 localhost.localdomain localhost192.168.0.1 www.company.com[root@localhost ~]# vi /etc/resolv.conf //编辑域名解析resolve文件; generated by /sbin/dhclient-script#search localdomain#nameserver 192.168.59.1search company.comnameserver 192.168.0.1nameserver 192.168.0.1[root@localhost ~]# cat /etc/named.conf //编辑主配置named文件//// named.conf for Red Hat caching-nameserver//options { directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53;};//// a caching only nameserver config//controls { inet 127.0.0.1 allow { localhost; } keys { rndckey; };};zone "." IN { type hint; file "named.ca";};zone "localdomain" IN { type master; file "localdomain.zone"; allow-update { none; };};zone "localhost" IN { type master; file "localhost.zone"; allow-update { none; };};zone "0.0.127.in-addr.arpa" IN { type master; file "named.local"; allow-update { none; };};zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN { type master; file "named.ip6.local"; allow-update { none; };};zone "255.in-addr.arpa" IN { type master; file "named.broadcast"; allow-update { none; };};zone "0.in-addr.arpa" IN { type master; file "named.zero"; allow-update { none; };};zone "company.com" IN { type master; file "company.com"; allow-update { none; };};zone "0.168.192.in-addr.arpa" IN { type master; file "192.168.0"; allow-update { none; };};include "/etc/rndc.key";[root@localhost ~]# cd /var/named/chroot/var/named/[root@localhost named]# ls -l[root@localhost named]# cp -p localhost.zone company.com[root@localhost named]# cp -p named.local 192.168.0[root@localhost named]# vi company.com //编辑正向解析文件$TTL 86400@ IN SOA @www.company.com. root.www.company.com. ( 2009102001 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS @www.company.com. IN A 127.0.0.1 IN AAAA ::1www.company.com. IN A 192.168.0.1dns.company.com. IN CNAME www.company.com.[root@localhost named]# vi 192.168.0 //编辑逆向解析文件$TTL 86400@ IN SOA www.company.com. root.www.company.com. ( 2009102003 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS www.company.com.1 IN PTR www.company.com.1 IN PTR dns.company.com.[root@localhost named]# /etc/init.d/named start //启动服务启动 named: [ 确定 ][root@localhost named]# nslookup //测试> www.company.comServer: 192.168.0.1Address: 192.168.0.1#53Name: www.company.comAddress: 192.168.0.1> dns.company.comServer: 192.168.0.1Address: 192.168.0.1#53dns.company.com canonical name = www.company.com.Name: www.company.comAddress: 192.168.0.1> 192.168.0.1Server: 192.168.0.1Address: 192.168.0.1#531.0.168.192.in-addr.arpa name = dns.company.com.1.0.168.192.in-addr.arpa name = www.company.com.> exit[root@localhost named]#
本文出自 “Kenny'Lab” 博客,请务必保留此出处http://kennywong.blog.51cto.com/715953/214521
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐