前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >DNS主从服务器中域(zone)文件类型不一致问题的解决方法

DNS主从服务器中域(zone)文件类型不一致问题的解决方法

作者头像
耕耘实录
发布2018-12-20 16:06:51
8990
发布2018-12-20 16:06:51
举报
文章被收录于专栏:耕耘实录耕耘实录

版权声明:本文为耕耘实录原创文章,各大自媒体平台同步更新。欢迎转载,转载请注明出处,谢谢

一、背景

公司的DNS服务器做了主从配置,最近在使用从服务器解析的时候,发现莫名其妙的解析不了,经过反复的检查,配置没有发现任何问题,在看域文件的时候,发现有乱码,问题应该就是出在这里了。通过file命令查看了一番,主服务器的域文件类型是text,从服务器的文件类型是data。

二、解决方法
(一)查阅资料

经过查阅官方资料,BIND9的域文件支持以其他格式读取或备份,raw格式是当前可用的一个附加格式,使用file命令查看文件类型显示是data,使用raw格式主要是为了提高加载速度。raw格式的域文件可以通过named-compilezone命令来进行转换,从而达到编辑的目的,这样操作显然比较麻烦了。

In addition to the standard textual format, BIND 9 supports the ability to read or dump to zone files in other formats. The raw format is currently available as an additional format. It is a binary format representing BIND 9’s internal data structure directly, thereby remarkably improving the loading time. For a primary server, a zone file in the raw format is expected to be generated from a textual zone file by the named-compilezone command. For a secondary server or for a dynamic zone, it is automatically generated (if this format is specified by the masterfile-format option) when named dumps the zone contents after zone transfer or when applying prior updates. If a zone file in a binary format needs manual modification, it first must be converted to a textual form by the named-compilezone command. All necessary modification should go to the text file, which should then be converted to the binary form by the named-compilezone command again. Although the raw format uses the network byte order and avoids architecture-dependent data alignment so that it is as much portable as possible, it is primarily expected to be used inside the same single system. In order to export a zone file in the raw format or make a portable backup of the file, it is recommended to convert the file to the standard textual representation.

(二)解决方法

1 . 在上面的资料中,仔细阅读masterfile-format这一行,似乎有了新的思路。 2 . 修改从服务器相关的配置文件(/etc/named.conf ),添加如下一行:

代码语言:javascript
复制
masterfile-format text ;

3 . 重启从服务器:

代码语言:javascript
复制
systemctl restart named

4 . 过几秒查看slave目录下的域文件内容,是否跟主服务器一致。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年03月12日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、背景
  • 二、解决方法
    • (一)查阅资料
      • (二)解决方法
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档