455 # local-data: "mycomputer.local. IN A 192.0.2.51"
//正向解析可参考语法
456 # local-data: ‘mytext.local TXT "content of text record"‘
457 #
458 # You can override certain queries with
459 # local-data: "adserver.example.com A 127.0.0.1"
460 #
461 # You can redirect a domain to a fixed address with
462 # (this makes example.com, www.example.com, etc, all go to 192.0.2.3)
463 # local-zone: "example.com" redirect
464 # local-data: "example.com A 192.0.2.3"
465 #
# Shorthand to make PTR records, "IPv4 name" or "IPv6 name".
467 # You can also add PTR records using local-data directly, but then
468 # you need to do the reverse notation yourself.
469 # local-data-ptr: "192.0.2.3 www.example.com"
//反向解析参考语法
470
471 include: /etc/unbound/local.d/*.conf
472
473 # service clients over SSL (on the TCP sockets), with plain DNS inside
……
---------------------------------查看本机FQDN---------------------------
复制代码
[root@linuxprobe ~]# hostname
linuxprobe.example.com
//由此可知,域名为example.com
--------------------------------创建解析文件-----------------------------
复制代码
[root@linuxprobe ~]# vim /etc/unbound/local.d/example.conf
local-zone: "example.com." static
local-data: "example.com. 86400 IN SOA ns.example.com. root 1 1D 1H 1W 1H"
local-data: "ns.example.com. IN A 192.168.10.10"
local-data: "linuxprobe.example.com. IN A 192.168.10.10"
local-data-ptr: "192.168.10.10 ns.example.com."
local-data-ptr: "192.168.10.10 linuxprobe.example.com."
------------------------查看RHEL6上解析文件以作对比--------------------
复制代码
[root@linuxprobe ~]# vim /var/named/named.localhost
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
2.3.禁用服务用户
每个服务都是有其专用的服务用户,DNS 的服务用户为 unbound,实际情况下服务用户的启用有可能有安全隐患,这里要禁用服务用户。
复制代码
[root@linuxprobe ~]# vim /etc/unbound/unbound.conf
······
211 # if given, user privileges are dropped (after binding port),
212 # and the given username is assumed. Default is user "unbound".
213 # If you give "" no privileges are dropped.
214 #username: "unbound"
215 username: " "
216
217 # the working directory. The relative files in this config
······
如上,找到配置文件的第214行,删除unbound即可,删除后为:username ” “。










