服务器 频道

一个 在Solaris下DNS配置的例子

  【IT168 服务器学院】A. 我们的机器环境:

  Solaris 8 sparc + Bind 8 (Solaris 8 附带)

  B. IP规划:

  domain: abc.com
  DNS Server: solaris8.abc.com 132.254.254.76
  网段: 132.254.254.xxx umask 255.255.255.0
  客户机器: RedHat 6.2 u2.abc.com 132.254.254.120
  SCO unxi5.0.5 sco.abc.com 132.254.254.92
  HP-UX 11.0 punk.abc.com 132.254.254.7
  win98 kun.abc.com 132.254.254.70
  C.配置文件

  1.在Solaris8 上建立文件: (这个文件一般需要自己手工输入)

  /etc/named.conf

  //
  // BIND Version 8 configuration file.
  //

  options {
  directory "/etc/named.data"; //用户自己随便定义一个目录
  dump-file "/etc/named.data/tmp/named_dump.db";
  };

  zone "abc.com" in {
  type master;
  file "db.abc.com";
  };

  zone "254.254.132.in-addr.arpa" in {
  type master;
  file "db.132.254.254";
  };

  zone "0.0.127.in-addr.arpa" in {
  type master;
  file "db.127.0.0";
  };

  zone "." in {
  type hint;
  file "db.cache";
  };

  //
  //
  // The following file contains real examples of how special BIND 8
  // configurations can be created. These configurations will get
  // appended to the /etc/named.conf file after all of the standard
  // DNS entries are created. In most cases it will not be necessary
  // to add anything here, but if it is necessary, here are a couple
  // of examples.
  //
  // server 204.33.116.7 {
  // transfers 2;
  // };
  //
  // topology {
  // 15/8;
  // 172.88/16;
  // };
  //
  //

  2.Solaris8 上注意修改这个文件/etc/nsswitch.conf

  # You must also set up the /etc/resolv.conf file for DNS name
  # server lookup. See resolv.conf(4).
  hosts: files dns #注意那个dns,必须有哦

  3./etc/resolc.conf

  nameserver 132.254.254.76 #你的DNS server ip
  domain abc.com #默认的domain

  4.编辑 /etc/named.data/127.0.0

  @ IN SOA ns.abc.com. ben.abc.com. ( 2000091311 10800 3600 604800 864
  00 )
  IN NS ns.abc.com.
  IN NS u2.abc.com.
  1 IN PTR localhost.

  5.编辑 /etc/named.data/db.132.254.254

  254.254.132.in-addr.arpa. IN SOA ns.abc.com. ben.abc.com. (
  2000091322
  10800
  3600
  604800
  86400 )
  254.254.132.in-addr.arpa. IN NS ns.abc.com.
  254.254.132.in-addr.arpa. IN NS u2.abc.com.
  76.254.254.132.in-addr.arpa. IN PTR solaris8.abc.com.
  70.254.254.132.in-addr.arpa. IN PTR kun.abc.com.
  77.254.254.132.in-addr.arpa. IN PTR punk.abc.com.

  6.编辑 /etc/named.data/db.abc.com

  //From here....
  abc.com.INSOA ns.abc.com. ben.abc.com. (
  2000091328
  10800
  3600
  604800
  86400 )
  madebyunxiaid IN TXT "This map made by unixaid.net" //一个optional,可以不要
  abc.com. IN NS ns.abc.com.
  abc.com. IN MX 20 solaris8.abc.com.
  localhost IN A 127.0.0.1
  solaris8.abc.com. IN A 132.254.254.76 www.abc.com. IN CNAME solaris8.abc.com. //CNAME代表这个是一个机器solaris8.abc.com的别名
  kun.abc.com. IN A 132.254.254.70
  linux.abc.com. IN CNAME U2.abc.com.
  ftp.abc.com. IN CNAME solaris8.abc.com.
  mail.abc.com. IN CNAME solaris8.abc.com.
  punk.abc.com. IN A 132.254.254.77
  u2.abc.com. IN A 132.254.254.120

  7.编辑 /etc/named.data/db.cache

  //From here....

  ; This file holds the information on root name servers needed to
  ; initialize cache of Internet domain name servers
  ; (e.g. reference this file in the "cache . <file>"
  ; configuration file of BIND domain name servers).
  ;
  ; This file is made available by InterNIC registration services
  ; under anonymous FTP as
  ; file /domain/named.root
  ; on server FTP.RS.INTERNIC.NET
  ; -OR- under Gopher at RS.INTERNIC.NET
  ; under menu InterNIC Registration Services (NSI)
  ; submenu InterNIC Registration Archives
  ; file named.root
  ;
  ; last update: Aug 22, 1997
  ; related version of root zone: 1997082200
  ;
  ;
  ; formerly NS.INTERNIC.NET
  ;
  . 3600000 IN NS A.ROOT-SERVERS.NET.
  A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
  ;
  ; formerly NS1.ISI.EDU
  ;
  . 3600000 NS B.ROOT-SERVERS.NET.
  B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
  ;
  ; formerly C.PSI.NET
  ;
  . 3600000 NS C.ROOT-SERVERS.NET.
  C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
  ;
  ; formerly TERP.UMD.EDU
  ;
  . 3600000 NS D.ROOT-SERVERS.NET.
  D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
  ;
  ; formerly NS.NASA.GOV
  ;
  . 3600000 NS E.ROOT-SERVERS.NET.
  E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
  ;
  ; formerly NS.ISC.ORG
  ;
  . 3600000 NS F.ROOT-SERVERS.NET.
  F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
  ;
  ; formerly NS.NIC.DDN.MIL
  ;
  . 3600000 NS G.ROOT-SERVERS.NET.
  G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
  ;
  ; formerly AOS.ARL.ARMY.MIL
  ;
  . 3600000 NS H.ROOT-SERVERS.NET.
  H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
  ;
  ; formerly NIC.NORDU.NET
  ;
  . 3600000 NS I.ROOT-SERVERS.NET.
  I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
  ;
  ; temporarily housed at NSI (InterNIC)
  ;
  . 3600000 NS J.ROOT-SERVERS.NET.
  J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
  ;
  ; housed in LINX, operated by RIPE NCC
  ;
  . 3600000 NS K.ROOT-SERVERS.NET.
  K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
  ;
  ; temporarily housed at ISI (IANA)
  ;
  . 3600000 NS L.ROOT-SERVERS.NET.
  L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
  ;
  ; housed in Japan, operated by WIDE
  ;
  . 3600000 NS M.ROOT-SERVERS.NET.
  M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
  ; End of File

  D.ok,现在reboot你的机器

  #init 6

  E.测试你的配置
  $/usr/sbin/nslookup
  Default Server: solaris8.abc.com
  Address: 132.254.254.76

  > u2
  Server: solaris8.abc.com
  Address: 132.254.254.76

  Name: u2.abc.com
  Address: 132.254.254.120

  > u2.abc.com
  Server: solaris8.abc.com
  Address: 132.254.254.76

  Name: u2.abc.com
  Address: 132.254.254.120

  >^D // Ctrl+D 退出nslookup
  $

  F.客户机器上的设置:

  1.RedHat 6.2 hostname: u2.abc.com
  IP: 132.254.254.120

  编辑/etc/resolv.conf
  nameserver 132.254.254.76
  domain abc.com

  然后测试一下:
  bash$ nslookup
  Default Server: solaris8.abc.com
  Address: 132.254.254.76

  > sco
  Server: solaris8.abc.com
  Address: 132.254.254.76

  Name: dns.hp9000.com
  Address: 132.254.254.92
  Aliases: sco.hp9000.com

  > punk
  Server: solaris8.abc.com
  Address: 132.254.254.76

  Name: punk.abc.com
  Address: 132.254.254.77

  >^D
  bash$
  2.win98 hostname: kun.abc.com
  IP: 132.254.254.70

  tcp ip属性:

  add DNS: 132.254.254.76
  后缀: abc.com

  reboot win9x

  然后测试一下:

  C:>ping solaris8.abc.com

  G.几个补充说明
  1.doamin: abc.com是我们自己Lan内虚拟的,你其实可以任意命名他

  2.我们针对的是目前大家用的比较多的Bind 8.X版本,如果你的机器是:
  SCO 505 and below
  Solaris 2.6 and below
  HP-UX 11.x and below
  那么你的随机器带来的Bind 是4.X的,这个版本的named启动文件是/etc/named.boot,
  关于他的设置与/etc/named.conf大同小异。

  3.不论你使用哪个发行版本的unix,DNS的设置与unix的关系并没有太大的关系

  4.目前在网络上有许多基于GUi/WEB的DNS设置软件,如果你感觉自己实在太差,可以使用
  这些软件.

  5.如果系统启动后,你可以在syslog文件中查看named的日志
  Solaris下在/var/adm/messages:

  ......
  Nov 1 17:35:44 solaris8 named[168]: [ID 295310 daemon.notice] starting. in.named BIND 8.1.2 Wed Dec 22 00:01:15 PST 1999
  Nov 1 17:35:44 solaris8 named[200]: [ID 295310 daemon.notice] Ready to answer queries.
  ......

  每次你修改了/etc/named.conf文件,必须reboot named!!!
  #ps -ef |grep named
  root 200 1 0 17:35:44 ? 0:00 /usr/sbin/in.named
  #kill -HUP 200
  

0
相关文章