1. Setup Primary DNS Server

Install bind9

BIND (Berkely Internet Name Domain) is a software for translating domain names into IP addresses.

Install it using command:

# zypper in bind

The DNS configuration files are stored in the /etc/ directory. The primary configuration file is /etc/named.conf.

Configure Bind9

Open up the file /etc/named.conf in any editor.

# nano /etc/named.conf

Add the following lines to define forward and reverse zone files.

[...]
## Uncomment and add your local area network ip series
allow-query { 127.0.0.1; 192.168.1.0/24;};
[...]
zone    "unixmen.local"   {
type master;
file    "for.unixmen.local";
}; zone   "1.168.192.in-addr.arpa"        {
type master;
file    "rev.unixmen.local";
};

Save and close the file.

Create Zone Files

Now create the forward and reverse zone files which we defined in the above step.

1. Forward Zone file

Copy the existing zone file template /var/lib/named/localhost.zone to create a new forward zone file.

# cp /var/lib/named/localhost.zone /var/lib/named/for.unixmen.local

Now edit the file /var/lib/named/for.unixmen.local,

# nano /var/lib/named/for.unixmen.local

Change the contents as shown below and replace the domain name and ip address with your own.

;
; BIND data file for forward.unixmen.local zone
;
$TTL    604800
@       IN      SOA     master.unixmen.local. root.unixmen.local. (
2         ; Serial
604800         ; Refresh
86400         ; Retry
2419200         ; Expire
604800 )       ; Negative Cache TTL
IN      A       192.168.1.101
;
@       IN      NS      master.unixmen.local.
@       IN      NS      slave.unixmen.local.
@       IN      A       192.168.1.101
@       IN      A       192.168.1.102
@       IN      A       192.168.1.100
@       IN      AAAA    ::1
master  IN      A       192.168.1.101
slave   IN      A       192.168.1.102
client  IN      A       192.168.1.100

2. Reverse Zone file

Copy the existing zone file template /var/lib/named/127.0.0.zone to create a new reverse zone file.

# cp /var/lib/named/127.0.0.zone /var/lib/named/rev.unixmen.local

Now edit the file /etc/bind/rev.unixmen.local,

# nano /var/lib/named/rev.unixmen.local

Change the contents as shown below and replace the domain name and ip address with your own.

;
; BIND reverse data file for rev.unixmen.local
;
$TTL    604800
@       IN      SOA     master.unixmen.local. root.unixmen.local. (
3         ; Serial
604800         ; Refresh
86400         ; Retry
2419200         ; Expire
604800 )       ; Negative Cache TTL
;
@       IN      NS      master.
@       IN      NS      slave.
@       IN      A       192.168.1.101
@       IN      A       192.168.1.102
@       IN      A       192.168.1.100
101     IN      PTR     master.unixmen.local.
102     IN      PTR     slave.unixmen.local.
100     IN      PTR     client.unixmen.local.

Save and close the file.

 

As you see in the above configuration, i increased the serial number for reverse zone file. For each change you should increase the reverse zone serial number as well.

Now start bind9 service.

# /etc/init.d/named start
# chkconfig named on

Test DNS Configuration and Zone Files

You can check the DNS configuration and zone files configuration for any syntax errors.

Check DNS configuration file using command:

# named-checkconf /etc/named.conf

If it returns nothing, your configuration file doesn’t have any syntax errors.

Check Forward Zone:

# named-checkzone unixmen.local /var/lib/named/for.unixmen.local

Sample Output:

zone unixmen.local/IN: loaded serial 2
OK

Check Reverse Zone:

# named-checkzone unixmen.local /var/lib/named/rev.unixmen.local

Sample output:

zone unixmen.local/IN: loaded serial 3
OK http://www.unixmen.com/setup-dns-server-opensuse-13-1/

openSUSE 13.1 搭建 DNS服务器的更多相关文章

  1. centos DNS服务搭建 DNS原理 使用bind搭建DNS服务器 配置DNS转发 配置主从 安装dig工具 DHCP dhclient 各种域名解析记录 mydns DNS动态更新 第三十节课

    centos  DNS服务搭建  DNS原理  使用bind搭建DNS服务器 配置DNS转发 配置主从  安装dig工具  DHCP  dhclient  各种域名解析记录  mydns DNS动态更 ...

  2. 第一次搭建dns服务器

    CentOS 7 搭建DNS服务器 主要参考的是小左先森的一篇博客:https://blog.51cto.com/13525470/2054121. 1.搭建过程中遇到的几个问题说一下: a.在重启服 ...

  3. [转]DNS服务器原理详解与Centos6.x下搭建DNS服务器

    转自:http://blog.it985.com/8958.html DNS 数据库的记录:正解,反解, Zone 的意义 通过DNS解析过程详解这篇文章,我们知道了要想访问www.zmit.cn,最 ...

  4. Centos7 搭建DNS服务器与原理配置详解

    在搭建我们自己DNS服务器之前,先必须了解下DNS服务器的作用和原理. DNS是在互联网上进行域名解析到对应IP地址的服务器,保存互联网上所有的IP与域名的对应信息,然后将我们对网址的访问,解析成IP ...

  5. Windows Server 2008 R2 搭建DNS服务器(转)

    Windows Server 2008 R2 搭建DNS服务器将本机IP设为首选DNS服务器的地址在dos 下分别输入 nslookup www.mydns.com 和 nslookup 192.16 ...

  6. centos搭建dns服务器

    前言:搭建dns服务器,dns服务器我就不多说什么了,大家都懂,就是域名解析,就将ip装换为域名,域名就可以理解为类似这样的www.baidu.com网址,接下来我就直接上图了.这里面最重要的是修改u ...

  7. 搭建DNS服务器

    导读 Linux下架设DNS服务器通常是使用Bind程序来实现的.Bind是一款实现DNS服务器的开放源码的软件.DNS即域名系统,主要功能是将人们易于记忆的Domain Name(域名)与不易记忆的 ...

  8. Linux下快速搭建DNS服务器

    一.术语解释:TTL Time To Live 缓冲保留时间ORIGIN 属于哪个域@ 代指域IN 开头需要空格SOA 一行记录类型的开始参数:forwarders {} 指向自己无法解析的域名跳转到 ...

  9. Linux系统下搭建DNS服务器——DNS原理总结

    2017-01-07 整理 DNS原理 域名到IP地址的解析过程 IP地址到域名的反向域名解析过程 抓包分析DNS报文和具体解析过程 DNS服务器搭建和配置 这个东东也是今年博主参见校招的时候被很多公 ...

随机推荐

  1. 在Visual Studio 2013 中使用C++单元测试

    本文主要介绍在Visual Studio 2013中对代码进行单元测试的方法,包含了两方面的内容:对已有的Dll文件进行单元测试,以及对已有的源文件进行单元测试. 1. VS2013对DLL文件的单元 ...

  2. win10 3dmax 激活后反复激活和激活码无效问题

    我也是遇到这个问题在网上找答案,像什么断网,清理注册表,删除某个.dat文件 各种试了好多都没管用 弄这个弄了五六个小时才总算成功 心累 现在我总结一下这些方法  我是第一条成功的 其他的我试着都没用 ...

  3. win10 UWP 申请微软开发者

    申请微软开发者可以到https://dev.windows.com/zh-cn/programs/join 如果是学生,先去http://www.dreamspark.com/ 如果是英文,点stud ...

  4. win10 uwp 获得焦点改变

    本文讲的是当我们应用失去焦点时,我们获得事件,当我们应用获得焦点,同样获得事件.同时,在应用不可以见时,我们也可以获得. 上面一张图,开始是应用启动,获得焦点,应用显示.然后我们打开另一个应用,切换, ...

  5. win10 uwp 绘图 Line 控件使用

    本文主要讲一个在绘图中,我们会有一个基础的控件,Line.控件的基本使用和他能做出的我们很多时候需要的界面. 虽然是一个简单控件,但是可以做出很诡异的很好看的UI. 首先,我们要知道,Line就是画直 ...

  6. git 合并两个仓库

    我有两个仓库,一个是gitbook在写一本 一个是放在github的垃圾,这个是我想要开个人网站,但是做的还是不行https://github.com/lindexi/lindexi.github.i ...

  7. cf290-2015-2-3总结与反思(dfs判断无向图是否有环)

    bool dfs(int i,int pre) { visit[i]=true; ;j<=v;j++) if(g[i][j]) { if(!visit[j]) return dfs(j,i); ...

  8. redis基本教程

    http://www.runoob.com/redis/redis-tutorial.html

  9. EF 数据重复和缺失问题(select 错误 )

    字段有 id,name,password,sex 1.错误举例: var data = db.User.Select(d => d):   2修正 var data = db.User.Sele ...

  10. .xlsx文件总是默认用2007 Microsoft Office component 打开,且无法更改用EXCEL打开的解决方法

    之前装了OFFICE2003,后来改装了 OFFICE2007,之后XLSX文件双击总是用2007 Microsoft Office component 打开,导致无法打开. 解决方法: 打开注册表R ...