当前位置:网站首页>「玩转Lighthouse」轻量应用服务器自建DNS解析服务器
「玩转Lighthouse」轻量应用服务器自建DNS解析服务器
2022-04-23 13:01:00 【我和你】
摘要
最近买的几台轻量应用服务器,都不知道干啥用,干脆搭建属于自己的DNS解析服务器吧。
搭建DNS解析服务器,不是属于DNS服务器:比如114.114.114.114啥的,而是能够帮你解析域名的服务器。
正文
一、购买轻量应用服务器和安装centos7操作系统
配置
1.首先我们需要安装bind
yum -y install bind*
2.修改主配置文件
cp /etc/named.conf /etc/named.conf.bak #备份,一般不需要备份
nano /etc/named.conf
修改为以下:
options {
listen-on port 53 { any; }; // 监听在主机的53端口上。any代表监听所有的主机
directory "/var/named"; // 如果此档案底下有规范到正反解的zone file 档名时,该档名预设应该放置在哪个目录底下
// 下面三项是服务的相关统计信息
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";
allow-query { any; }; // 谁可以对我的DNS服务器提出查询请求。any代表任何人
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
forwarders { // 指定上层DNS服务器
192.168.1.1;
};
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
3.自定义域名解析配置
nano /etc/named.rfc1912.zones
#在最后面添加如下,比如我要解析 miku.cool 以及所有子域名
zone "miku.cool" IN { // 定义要解析主域名
type master;
file "miku.cool.zone"; // 具体相关解析的配置文件保存在 /var/named/miku.cool.zone 文件中
};
4.自定义miku.cool.zone文件
nano /var/named/miku.cool.zone
#添加如下
$TTL 86400
@ IN SOA ns1.miku.cool. root (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
0 ) ; minimum
@ IN NS ns1.miku.cool.
ns IN A 192.168.1.1
www IN A 192.168.1.113
其中ns1.miku.cool是当前DNS服务器的名称。所以ns1.miku.cool一定要解析到本身。
www IN A 192.138.1.113 //代表把www.miku.cool解析到192.168.1.113服务器上。把www换成@就是解析到miku.cool,其他的类似。
5.修改权限
chown root:named /var/named/miku.cool.zone #这一步一定要做
6.重启服务
service named restart
#或者
systemctl restart named.service
新增域名解析
如果我们需要在追加一个域名的解析,比如miku.city,则:
nano /etc/named.rfc1912.zones
// 添加下面这段
zone "miku.city" IN {
type master;
file "miku.city.zone";
};
cp -a miku.cool.zone miku.city.zone
nano miku.city.zone
//换成如下,由于我们ns1.miku.cool已经是我们的解析服务器,所以不需要修改
$TTL 86400
@ IN SOA ns1.miku.cool. root (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
0 ) ; minimum
@ IN NS ns1.miku.cool.
ns IN A 192.168.1.1
www IN A 192.168.1.114
@ IN A 192.168.1.114
配置之后还要重启服务
service named restart
#或者
systemctl restart named.service
注意:如果有问题的话就关闭一下selinux,然后防火墙规则什么的
完结
以上就是所有自建DNS解析服务器的内容,欢迎小伙伴们交流讨论。
版权声明
本文为[我和你]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1986098
边栏推荐
- Free and open source intelligent charging pile SaaS cloud platform of Internet of things
- 安装nngraph
- Golang realizes regular matching: the password contains at least one digit, letter and special character, and the length is 8-16
- Homomorphic encryption technology learning
- Synchronously update the newly added and edited data to the list
- JMeter operation redis
- ZigBee CC2530 minimum system and register configuration (1)
- 梳理网络IP代理的几大用途
- Important knowledge of transport layer (interview, retest, final)
- PC starts multiple wechat at one time
猜你喜欢

31. Next arrangement

V-model binding value in El select, data echo only displays value, not label

数据库中的日期时间类型

5 free audio material websites, recommended collection

Redis deployment of cloud native kubesphere

Embrace the new blue ocean of machine vision and hope to open a new "Ji" encounter for the development of digital economy

22. 括号生成

Free and open source intelligent charging pile SaaS cloud platform of Internet of things

SSM框架系列——注解开发day2-2

在线计算过往日期天数,计算活了多少天
随机推荐
pyqt5 将opencv图片存入内置SQLlite数据库,并查询
Calculate the past date and days online, and calculate the number of live days
Servlet监听器&过滤器介绍
Introduction to kubernetes
Record Alibaba cloud server mining program processing
STD:: shared of smart pointer_ ptr、std::unique_ ptr
世界读书日:我想推荐这几本书
MySQL —— 16、索引的数据结构
Image attribute of input: type attribute of fashion cloud learning -h5
jmeter操作redis
Remote access to raspberry pie at home (Part 1)
Embrace the new blue ocean of machine vision and hope to open a new "Ji" encounter for the development of digital economy
Record some NPM related problems (messy records)
Kubernetes 入门教程
Community version Alibaba MQ ordinary message sending subscription demo
CVPR 2022&NTIRE 2022|首个用于高光谱图像重建的 Transformer
leetcode-791. Custom string sorting
Date time type in database
Golang implements MD5, sha256 and bcrypt encryption
Byte jump 2020 autumn recruitment programming question: quickly find your own ranking according to the job number