Skip to content

Instantly share code, notes, and snippets.

@prerabale
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save prerabale/7ac7d82eb40c035abdca to your computer and use it in GitHub Desktop.

Select an option

Save prerabale/7ac7d82eb40c035abdca to your computer and use it in GitHub Desktop.

###DNS服务器 #####1. 安装相应的服务器软件:
apt-get install bind9 安装bind9
#####2. 设置主服务器域和域解析文件
vim /etc/bind/named.conf.local
然后设置域zone和域解析文件file:

  zone "linux31.com"{
    type master;
  file "db.linux31.com";
  };

#####3. 根据bind9自带的模板db.local 修改域解析文件内容 一般来说域解析文件的默认存放地方是: /etc/var/cache/bind 我们将/ect/bind/db.local 复制到 /etc/var/cache/bind 下并改名为db.linux31.com cp /etc/bind/db.local /var/cache/bind/db.linux31.com 然后修改模板db.local内容 一般来说 上面的东西都不用改 只需把你的dns服务器地址(也就是本地地址)填到下面就ok了

; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
@       IN      AAAA    ::1
@       IN     A       192.168.1.116                                                                             
~                 

然后保存 退出 就ok
重启bind服务
/etc/init.d/bind9 restart

#####4. 检测DNS是否能工作
在另一台机子上修改/etc/resolv.conf里面DNS的选项,将DNS服务器的地址设置为 192.168.1.106(我配置DNS的IP地址),该过程很容易忘记。

然后在另外一台主机上:
ping linux31.com
看是否能ping通。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment