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. IDEA初学者实用小技巧

    创建Web项目:1.(File-->new project)JavaEnterprise-->Web Application-->Next.2.配置Tomcat服务器:右上角的Edi ...

  2. Mysql 临时表+视图

    原文地址:http://www.cnblogs.com/mrdz/p/6195878.html 学习内容: 临时表和视图的基本操作... 临时表与视图的使用范围... 1.临时表   临时表:临时表, ...

  3. spring 中 hibernate 的 2种 配置方式(新旧 2种方式)

    Spring对hibernate配置文件hibernate.cfg.xml的集成,来取代hibernate.cfg.xml的配置 Spring对hibernate配置文件hibernate.cfg.x ...

  4. 理解JSON:3分钟课程

    理解JSON:3分钟课程 博客分类: Java综合 jsonAjaxJavaScriptXMLLISP 本文是从 Understanding JSON: the 3 minute lesson 这篇文 ...

  5. IDEA默认KeyMap映射快捷键

    编辑 快捷键 描述 Ctrl + 空格 基础代码补全(任意类.方法.变量的名字) Ctrl + Shift + 空格 智能代码补全(过滤期望类型的方法和变量列表) Ctrl + Shift + 回车 ...

  6. 【python实现卷积神经网络】定义训练和测试过程

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  7. 10个步骤教你如何安装Anaconda安装,Python数据分析入门必看

    前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:小白 PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行 ...

  8. E - Dungeon Master BFS

    [NWUACM] 你被困在一个三维的空间中,现在要寻找最短路径逃生!空间由立方体单位构成你每次向上下前后左右移动一个单位需要一分钟你不能对角线移动并且四周封闭是否存在逃出生天的可能性?如果存在,则需要 ...

  9. SpringCloud(五)学习笔记之Hystrix

    在微服务架构中多层服务之间会相互调用,如果其中有一层服务故障了,可能会导致一层服务或者多层服务故障,从而导致整个系统故障.这种现象被称为服务雪崩效应. Hystrix组件就可以解决此类问题,Hystr ...

  10. Java中常量的概念

    常量:在程序执行过程中,其值不发生改变的量.分类:A:字面值常量B:自定义常量字面值常量A:字符串常量(用“”括起来的内容).举例:"hello"B:整数常量 (所有的整数)举例: ...