1.基本配置

systemctl stop firewalld.service

systemctl disable firewalld.service

setenforce 0

nmcli connection add con-name in ifname ens33 ipv4.addresses 192.168.1.10/24 type ethernet ipv4.method manual(内网网卡)

nmcli connection add con-name out ifname ens38 ipv4.addresses 192.168.2.10/24 type ethernet ipv4.method manual(外网网卡)

2.配置简单dns服务器

yum install -y bind bind-utils

2.1修改主配置文件

vim /etc/named.conf(修改该文件)

listen-on port 53 { any; };

allow-query     { any; };

zone "fengxiaoli41.com" IN {

type master;

file "fengxiaoli41.com.lan";

allow-update {none;};

};

zone "1.168.192.in-addr.arpa" IN {

type master;

file "1.168.192.lan";

allow-update {none;};

};

2.2编辑正解区域

cd /var/named/

cp named.localhost fengxiaoli41.com.lan

vim fengxiaoli41.com.lan

$TTL 665

@IN SOAfengxiaoli41.com. 123@qq.com (

2017062900; serial

3600; refresh

1800; retry

604800; expire

665 ); minimum

@IN NSfengxiaoli41.com.

fengxiaoli41.com. IN A 192.168.1.10

www.fengxiaoli41.com. IN CNAME fengxiaoli41.com.

client.fengxiaoli41.com. IN A 192.168.1.200

@       IN NS   slave.fengxiaoli41.com.

slave.fengxiaoli41.com. IN A 192.168.1.100

2.3编辑反解区域

cp fengxiaoli41.com.lan 1.168.192.lan

vim 1.168.192.lan

$TTL 665

@IN SOAfengxiaoli41.com. 123@qq.com (

2017062900; serial

3600; refresh

1800; retry

604800; expire

665 ); minimum

@IN NSfengxiaoli41.com.

10      IN PTR fengxiaoli41.com.

200     IN PTR client.fengxiaoli.com.

100     IN PTR slave.fengxiaoli.com.

chown named:named fengxiaoli41.com.lan

chown named:named 1.168.192.lan

2.4重启服务并测试

systemctl restart named

systemctl status named

dig fengxiaoli41.com

3.配置chroot环境

yum install -y bind-chroot

/usr/libexec/setup-named-chroot.sh /var/named/chroot/ on

systemctl stop named.service

systemctl disabled named

systemctl enable named-chroot.service

systemctl start named-chroot

dig fengxiaoli41.com

如果dns只为内网提供解析到此可以结束。


4.配置分离解析的dns(与2,3步独立)

4.1修改主配置文件

vim /etc/named.conf

listen-on port 53 { any; };

allow-query     { any; };

acl in {192.168.1.0/24;};

acl out { ! 192.168.1.0/24; any;};

view "internal"{

match-clients { in; localhost;};

zone "." IN {

type hint;

file "named.ca";

};

zone "fengxiaoli41.com" IN {

type master;

file "fengxiaoli41.com.lan";

allow-update {none;};

};

zone "1.168.192.in-addr.arpa" IN {

type master;

file "1.168.192.lan";

allow-update {none;};

};

include "/etc/named.rfc1912.zones";

include "/etc/named.root.key";

};

注意所有区域都要包含在view里

view "external"{

match-clients {out;};

zone "." IN {

type hint;

file "named.ca";

};

zone "fengxiaoli41.com" IN {

type master;

file "fengxiaoli41.com.wan";

allow-update {none;};

};

zone "2.168.192.in-addr.arpa" IN {

type master;

file "2.168.192.wan";

allow-update {none;};

};

};

cd /var/named/chroot/var/named/

4.2编辑内网正解反解区域

vim fengxiaoli41.com.lan

$TTL 665

@IN SOAfengxiaoli41.com. 123@qq.com (

2017062900; serial

3600; refresh

1800; retry

604800; expire

665 ); minimum

@IN NSfengxiaoli41.com.

fengxiaoli41.com. IN A 192.168.1.10

www.fengxiaoli41.com. IN CNAME fengxiaoli41.com.

client.fengxiaoli41.com. IN A 192.168.1.200

@       IN NS   slave.fengxiaoli41.com.

slave.fengxiaoli41.com. IN A 192.168.1.100

vim 1.168.192.lan 

$TTL 665

@IN SOAfengxiaoli41.com. 123@qq.com (

2017062900; serial

3600; refresh

1800; retry

604800; expire

665 ); minimum

@IN NSfengxiaoli41.com.

10      IN PTR fengxiaoli41.com.

200     IN PTR client.fengxiaoli.com.

100     IN PTR slave.fengxiaoli.com.

4.3编辑外围正解反解区域

vim fengxiaoli41.com.wan

$TTL 665

@IN SOAfengxiaoli41.com. 123@qq.com (

2017062900; serial

3600; refresh

1800; retry

604800; expire

665 ); minimum

@IN NSfengxiaoli41.com.

fengxiaoli41.com. IN A 192.168.2.10

vim 2.168.192.wan

$TTL 665

@IN SOAfengxiaoli41.com. 123@qq.com (

2017062900; serial

3600; refresh

1800; retry

604800; expire

665 ); minimum

@IN NSfengxiaoli41.com.

10IN PTR fengxiaoli41.com.

4.4设置权限重启服务

chown named:named -R  /var/named/chroot/var/named/*

systemctl restart named-chroot

5.主从服务器配置(在2或者4的基础上配置)

5.1主服务器配置

 vim /etc/named.conf

allow-transfer { 192.168.1.0/24;};

cd /var/named/chroot/var/named/

vim fengxiaoli41.com.lan

@       IN NS   slave.fengxiaoli41.com.

slave.fengxiaoli41.com. IN A 192.168.1.100

vim 1.168.192.lan

100     IN PTR slave.fengxiaoli.com.

5.2从服务器配置(注意firewalld和selinux)

nmcli connection add con-name in ifname ens33 ipv4.addresses 192.168.1.100/24 type ethernet ipv4.method manual

yum install -y bind-utils bind

vim /etc/named.conf

listen-on port 53 { any; };

allow-query     { any; };

zone "fengxiaoli41.com" IN {

type slave;

masters { 192.168.1.10; };

file "slaves/fengxiaoli.com.lan";

};

zone "1.168.192.in-addr.arpa" IN {

type slave;

masters { 192.168.1.10; };

file "slaves/1.168.192.lan";

};

systemctl restart named

ll /var/named/slaves/

转载于:https://blog.51cto.com/fengxiaoli/1944870

redhat7.3 dns服务器配置的更多相关文章

  1. DNS服务器配置实践

    实验背景:在Linux系统上配置主要DNS服务器和辅助DNS服务器,所在域名为example.com,子网为192.168.X.0. 启动已安装LINUX系统,进行DNS服务器配置. 一.配置主要DN ...

  2. Linux DNS 服务器配置与管理

    一.环境介绍: 运行软件:VMware Workstation Pro 14 系统环境:CentOS-7-x86_64-1810 二.操作配置: 1.基础知识简介 (1)域名空间 域和域名: DNS树 ...

  3. rndc控制远程dns服务器配置方法

    1- 如果不存在/etc/rndc.conf touch /etc/rndc.conf chown named:named /etc/rndc.conf 2- rndc-confgen > /e ...

  4. DNS服务器配置

    导读 DNS(Domain Name Server,域名服务器)是进行域名(domain name)和与之相对应的IP地址 (IP address)转换的服务器.DNS中保存了一张域名(domain ...

  5. [Ubuntu] Ubuntu DNS服务器配置

    服务器IP:10.68.19.61 操作系统:Ubuntu 13.04 DNS程序:Bind9 测试域名:mycloud.com 目标IP:10.68.19.134 配置步骤 1.安装BIND9程序包 ...

  6. dns 服务器配置

    1.安装 named 2.配置如下文件: /etc/named.conf // 2 // named.conf 3 // 4 // Provided by Red Hat bind package t ...

  7. Linux下DNS服务器配置

    一步:yum install -y bind bind-utils bind-chroot yum install bind* //安装DNS服务 第二步:systemctl stop firewal ...

  8. linux——DNS服务器配置

    讲课,请不要在课堂上查找文件,浏览器搜索,会感觉你很不上心,玩听众,一定提前做很多遍,模拟很多遍: 演讲,请务必准备好材料,考虑听众的感受,一定不要让外行人云里雾里,听不懂你在讲什么,那就尴尬了, D ...

  9. redhat7.6 DNS配置正向解析

    1.安装DNS服务 yum install bind yum install bind-chroot 安装完的配置文件/etc/named.conf 启动systemctl start named.s ...

随机推荐

  1. MTK Android 源码目录分析

    Android 源码目录分析 Android 4.0 |-- abi (application binary interface:应用二进制接口)|-- art (average retrieval ...

  2. webpack中引用jquery

    1.首先需要添加项目中jquery的依赖 npm install jquery --save-dev 2.参考配置代码: var webpack = require("webpack&quo ...

  3. C语言学生管理系统(C语言课程设计/精简版)

    #include<stdio.h>#include<stdlib.h>#include<windows.h>#include<conio.h>typed ...

  4. CentOS Linux安装后扩充SWAP分区

    1. 首先先查看目前swap分区大小:     free -hm    total used free shared buffers cached    Mem: 11G 801M 10G 236K ...

  5. Java的运行时数据存储机制

    原文地址:http://yanwushu.sinaapp.com/java_data_storage/ Java程序在运行时需要为一系列的值或者对象分配内存,这些值都存在什么地方?用什么样的数据结构存 ...

  6. 08-less预处理器

    一.less预处理器 Less(LeanerStyle Sheets 的缩写)是一门 CSS扩展语言,也成为CSS预处理器. 1.插件安装 安装Easy LESS插件就能使写入的.less文件保存时自 ...

  7. G - Number Transformation BFS

    In this problem, you are given an integer number s. You can transform any integer number A to anothe ...

  8. python3_learn 实现文件夹内批量对图片重命名

    初衷 练习Python,提高动手能力. 珍藏的壁纸文件夹名命有点乱. 可以学习下一些基础的库 开始(.jpg,无筛选) First 首先找到OS库,寻找可以遍历文件名的.找到了OS.walk() os ...

  9. [RCTF2015]EasySQL

    [RCTF2015]EasySQL EasySQL github 打开靶机,是如下界面 到注册页面,试了一下,username 和 email 处有过滤,直接 fuzz 一下哪些字符被禁了 注册成功之 ...

  10. # Unity 游戏框架搭建 2019 (三十四、三十五) 9 ~ 10 示例整理

    第九个示例 目前代码如下: using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif namespace QFramework { p ...