问题:
1、安装bind服务,使用自建dns服务器
2、dns服务器 10.0.0.200
www.oldboyedu.com 192.168.36.202
解答:
1、关掉防火墙,然后查看是否关闭成功
[root@oldboy ~]# systemctl stop firewalld
[root@oldboy ~]# systemctl disable firewalld
[root@oldboy ~]# sestatus
[root@oldboy ~]# setenforce 0
[root@oldboy ~]# sestatus
2、进入/etc/selinux/config 配置文件
[root@oldboy ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
centos 7 安装bind(DNS服务)
1、安装 bind
yum install bind bind-utils
2、修改bind的配置文件
vim /etc/named.conf
options {
listen-on port 53 { any; }; #监听任何ip对53端口的请求
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; }; #接收任何来源查询dns记录
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
- If you are building a RECURSIVE (caching) DNS server, you need to enable
recursion.
- If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so will
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
#增加一个a.com域名的解析,具体解析规则在/var/named/oldboyedu.zone里
zone "oldboyedu.com.com" IN {
type master;
file "oldboyedu.com.zone";
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
3、配置解析文件
先用vim创建,在解析配置文件
vim /var/named/oldboyedu.com.zone
cat/var/named/oldboyedu.com.zone
@ IN SOA @ root.a.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 192.168.36.202
www A 192.168.36.202
@ MX 10 192.168.36.202
AAAA ::1
4、启动bind
systemctl start named
5、最后使用ping命令,看是否能ping通,ip地址是否一致
ping oldboyqiangedu.com