配置Solaris10的DNS,分为2部分,一个为服务器端,另外一部分为客户端(被指向端)。
服务器端:
1、配置/etc/named.conf
2、配置/named.conf中设置的解析配置文件
3、/usr/sbin/named启动DNS服务
客户端:
1、配置/etc/resolv.conf
2、配置/etc/nsswitch.conf 设置解析顺序
其他:
1、nslookup命令测试DNS运行是否正常
2、tail -f /var/adm/messages查看日志文件,排查问题
下面为配置代码的示例:
- DNS服务设置
- //服务器端
- -bash-3.00# more /etc/named.conf
- options{
- Directory "/var/named";
- };
- zone "cuug.com"{ //此为顶级域名
- type master;
- file "named.cuug.com"; //此项的配置文件
- };
- zone "15.168.192.in-addr.arpa"{ //指向地址网段,IP反写!
- type master;
- file "named.rev";
- };
- zone "0.0.127.in-addr.arpa"{ //本地地址
- type master;
- file "named.local";
- };
- -bash-3.00# more /var/named/*
- ::::::::::::::
- /var/named/named.cuug.com
- ::::::::::::::
- @ IN SOA guan.cuug.com. root.cuug.com.( //主机名,邮箱名,最后是有点的,根域!
- 20120723 ;serial
- 3H ;refresh
- 15M ;retry
- 1W ;expire
- 1D ;minimun
- )
- @ IN NS guan.cuug.com.
- www IN A 192.168.15.10 //指向www服务器地址
- FTP IN A 192.168.15.11 //f指向tp服务器地址
- ::::::::::::::
- /var/named/named.local
- ::::::::::::::
- @ IN SOA guan.cuug.com. root.cuug.com.(
- 2012723 ;serial
- 3H ;refresh
- 15M ;retry
- 1W ;expire
- 1D ;minimum
- )
- @ IN NS guan.cuug.com.
- 1 IN PTR localhost //指向本地地址
- ::::::::::::::
- /var/named/named.rev
- ::::::::::::::
- @ IN SOA guan.cuug.com. root.cuug.com.(
- 2012723 ;serial
- 3H ;refresh
- 15M ;retry
- 1W ;expire
- 1D ;minimum
- )
- @ IN NS guan.cuug.com.
- 11 IN PTR FTP.cuug.com. //反向解析是为了做虚拟主机用
- 10 IN PTR WWW.cuug.com.
- //客户端
- -bash-3.00# more /etc/resolv.conf
- nameserver 192.168.15.10 //填写DNS服务器地址
- -bash-3.00# more /etc/nsswitch.conf
- #
- # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- # Use is subject to license terms.
- #
- # ident "@(#)nsswitch.files 1.14 06/05/03 SMI"
- #
- # /etc/nsswitch.files:
- #
- # An example file that could be copied over to /etc/nsswitch.conf; it
- # does not use any naming service.
- #
- # "hosts:" and "services:" in this file are used only if the
- # /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
- passwd: files
- group: files
- hosts: files dns //在此添加dns 解析顺序为先hosts,后dns
- ipnodes: files
- networks: files
- protocols: files
- rpc: files
- ethers: files
- netmasks: files
- bootparams: files
- publickey: files
- # At present there isn't a 'files' backend for netgroup; the system will
- # figure it out pretty quickly, and won't use netgroups at all.
- netgroup: files
- automount: files
- aliases: files
- services: files
- printers: user files
- auth_attr: files
- prof_attr: files
- project: files
- tnrhtp: files
- tnrhdb: files
上文中,有些文件是系统中不存在的,需要自己手动创建!
转载于:https://blog.51cto.com/guanye/940034