歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> linux下智能DNS配置過程(三)

linux下智能DNS配置過程(三)

日期:2017/2/25 10:37:58   编辑:Linux教程
 生成rndc-key:

  # cd /usr/local/named/etc/

  # ../sbin/rndc-confgen > rndc.conf

  把rndc.conf中:

  # Use with the following in named.conf, adjusting the allow list as needed:

  後面以的部分加到/usr/local/named/etc/named.conf中並去掉注釋

  運行測試:

  # /usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf &

  狀態檢查:

  # /usr/local/named/sbin/rndc status

  四、建立啟動腳本:

  # vi /etc/init.d/named

  ============================== named.sh============================

  #!/bin/bash

  #

  # named a network name service.

  #

  #

  # chkconfig: 545 35 75

  # description: a name server

  #

  if [ `id -u` -ne 0 ]

  then

  echo "ERROR:For bind to port 53,must run as root."

  exit 1

  fi

  case "" in

  start)

  if [ -x /usr/local/named/sbin/named ]; then

  /usr/local/named/sbin/named -u bind -c /usr/local/named/etc/named.conf && echo . && echo 'BIND9 server started.'

  fi

  ;;

  stop)

  kill `cat /var/run/named/pid` && echo . && echo 'BIND9 server stopped.'

  ;;

  restart)

  echo .

  echo "Restart BIND9 server"

  stop

  sleep 10

  start

  ;;

  *)

  echo " start | stop | restart"

  ;;

  esac

  ===============================named.sh============================

  # chmod 755 /etc/init.d/named

  # chown root:root /etc/init.d/named

  # chkconfig --add named

  # chkconfig named on

  五、添加一個NS

  在域名的管理網站上,設定NS服務器為你安裝的DNS

  六、添加一個域名

  # cd /usr/local/named/etc/master

  # mkdir cnc

  # mkdir telecom

  # vi cnc.def

  添加

  zone "724cn.com" {

  type master;

  file "master/cnc/724cn.com";

  };

  # vi telecom.def

  添加

  zone "724cn.com" {

  type master;

  file "master/telecom/724cn.com";

  };

  添加網通的解析,解析到的IP為61.45.55.78

  #vi cnc/724cn.com

  添加

  $TTL 3600

  $ORIGIN 724cn.com.

  @ IN SOA ns.724cn.com. root.ns.724cn.com.(

  2005121013 ;Serial

  3600 ; Refresh ( seconds )

  900 ; Retry ( seconds )

  68400 ; Expire ( seconds )

  15 );Minimum TTL for Zone ( seconds )

  ;

  @ IN NS ns.724cn.com.

  @ IN A 211.162.106.9

  www IN A 211.162.106.9

  ;

  ;end

  添加電信的解析,解析到的IP為210.75.1.178

  #vi telecom/724cn.com

  添加

Copyright © Linux教程網 All Rights Reserved