首页 > 编程知识 正文

服务器做dns(ubuntu1804设置dns)

时间:2023-05-05 14:50:58 阅读:71745 作者:1178

域名服务器(DNS )是进行域名(domainname )及其对应IP地址(IP地址)转换的服务器。

环境说明

服务器IP 10.68.19.61

Ubuntu 13.04

DNS程序Bind9

测试域名mycloud.com

目标IP 10.68.19.134

安装BIND9

apt-get安装绑定9

总共需要编辑两个文件,添加两个文件。 如下所示。 修改/etc/bind/named.conf.options以删除forwarders评论。 其中的IP是网络运营商提供的DNS服务器,这里使用谷歌的DNS。

前锋{8.8.8. 8; 8.8.4.4; (;

修改/etc/bind/named.conf.local,最后添加双向分析代码。

zone 'mycloud.com' { type master; file '/etc/bind/db.mycloud.com '; (; 区域' 19.68.10.in-addr.arpa ' { type master; file '/etc/bind/db.10.68.19 '; (;

注:其中19.68.10是目标IP10.68.19.134的前三个段,表示IP地址段。

新域名(mycloud.com)解析文件/etc/bind/db.mycloud.com,内容如下:

; 绑定数据文件for dev sites; $ TTL 604800 @ insoamycloud.com.root.my cloud.com.(serial 604800; Refresh 86400; 回复2419200; Experia 604800; Negative Cache TTL; @ innsmycloud.com.@ ina 10.68.19.134 *.my cloud.com.14400 ina 10.68.19.134

添加IP地址反解析文件/etc/bind/db.10.68.19。 内容如下。

; bindreversedatafilefordevdomains; $TTL604800@inSOAdev.root.dev.() 1; 系列604800; Refresh 86400; 回复2419200; Experia 604800; Negative Cache TTL; @ innsmycloud.com.134 inptrmycloud.com。

重新启动BIND9服务

服务绑定9 restart

本地配置更改

修改需要使用此DNS服务器的每个DNS配置文件

sudo vi /etc/resolv.conf

更改nameserver为上边配置的DNS服务器IP

name服务器10.68.19.61

每次重新启动服务器时都会复盖此更改,并且可以更改配置文件

sudo VI/etc/resolv conf/resolv.conf.d/base

其中增加一条

name服务器10.68.19.61

即使以这种方式重新启动服务器,DNS配置仍然有效。 然后,重新启动networking服务并刷新DNS缓存。

服务网络重启

测试效果

root @ controller 3360/etc/bind # nslookup Baidu.comserver :10.68.19.61地址336010.68.19.61 # 3 non-authoritative answer : name : Baidu.com地址3360220.181.111.86 name : Baidu.com地址3360123.125 com address rver :10.68.19.61地址336010.68.19.61 #3name : my cloud.com地址:10.68.19.134 uaa.my cloud.

在域名: baidu.com、本地DNS中找不到匹配项,在DNS: 8.8.8.8中进行了分析,mycloud.com在本地DNS中存在匹配项,分析到10.68.19.134。

译文: 3358 cloud nil.com/2014/07/14/Ubuntu-DNS /

本文地址: https://www.Linux probe.com/Ubuntu-DNS.html

Linux命令大全: https://www.linuxcool.com/

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。