Skip to content

天楚锐齿

人工智能 云计算 大数据 物联网 IT 通信 嵌入式

天楚锐齿

  • 下载
  • 物联网
  • 云计算
  • 大数据
  • 人工智能
  • Linux&Android
  • 网络
  • 通信
  • 嵌入式
  • 杂七杂八

linux下的unbound DNS服务器设置详解

2018-09-20

在CentOS7.x下安装unbound 1.7.x:

# yum install -y epel-release
# rpm -Uvh http://rnd.rajven.net/centos/rajven-release-7-1.cnt7.noarch.rpm    #这里才有比较新的unbound版本。
# wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/7.3/x86_64/updates/security/openssl-1.0.2k-8.el7.x86_64.rpm
# wget ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/7.0/x86_64/updates/security/openssl-libs-1.0.2k-8.el7.x86_64.rpm
# yum localinstall openssl-1.0.2k-8.el7.x86_64.rpm openssl-libs-1.0.2k-8.el7.x86_64.rpm
# yum install unbound

配置:

# vi /etc/unbound/unbound.conf
server:
        verbosity: 1                       #输出详细程度,1为缺省
        num-threads: 2                     #线程数,可设置为CPU数
        interface: 0.0.0.0                 #监听地址(一般写本机内网ip,或者0.0.0.0表示全部接口)
        interface: ::0
        port: 53                           #端口
        so-reuseport: yes                  #为每个线程的传入查询打开专用侦听套接字。可以更均匀地将传入查询分布到线程
        cache-min-ttl: 93600               #最小缓存时间(不管权威dns服务器上配置的ttl是多少,这里返回给客户端及自身保存的缓存时间都不会比这个设置值小),26小时,因为bind(named)没有这个设置,所以named不那么好用,建议用unbound。
        cache-max-ttl: 604800              #最大缓存时间,7天
        cache-max-negative-ttl: 3600       #否定应答缓存时间,1小时
        outgoing-range: 20000              #端口数量
        access-control: 0.0.0.0/0 allow    #访问ipv4网段访问
        access-control: ::0/0 allow        #允许ipv6网段访问
        prefetch: yes                      #消息缓存元素在它们到期之前被预取以保持缓存是最新的
        module-config: “iterator”          #禁用DNSSEC检查,否则作为转发时可能会校验不过,报错类似:info: validation failure beacons.gvt2.com. A IN。
        do-ip4: yes                        #启用IP4
        do-ip6: yes
        do-udp: yes
        do-tcp: yes
        tcp-upstream: no                   #上行不用tcp方式
        so-rcvbuf: 8m                      #SO_RCVBUF套接口接收缓存大小
        so-sndbuf: 8m                      #SO_SNDBUF套接口发送缓存大小
        msg-cache-size: 1G                 #消息缓存的字节数。 默认值为4 MB。
        rrset-cache-size: 1G               #RRset缓存的字节数。
        outgoing-num-tcp: 256              #为每个线程分配的传出TCP缓冲区数
        incoming-num-tcp: 1024             #为每个线程分配的传入TCP缓冲区数
        hide-identity: yes                 #不返回对 id.server 和 hostname.bind 的查询。
        hide-version: yes                  #不返回对 version.server 和 version.bind 的查询。
        unwanted-reply-threshold: 10000000 #针对各种网络不服,数值为建议值。
#        include: “zone.conf”              #zone.conf文件内容为解析内容,如local-data: “m.baidu.com A 192.168.10.1″,也可以使用下面注释的方式配置解析
#        local-data: “m.baidu.com 600 A 192.168.10.1”  #其中600为解析缓存时间
# python:                                  #可以执行python脚本
remote-control:                            #这个区间为unbound控制设置。配置如下内容可以控制unbound服务,利用unbound-control命令对该服务执行开启、关闭、重启等操作。
        control-enable: yes
        control-use-cert: no
        control-interface: 127.0.0.1
        control-port: 8953
forward-zone:                              #这个区间为转发设置
        name: “.”                          #名称
        forward-first: yes                 #设为no是无法向根域名服务器TCP解析的才会用这些来解析,设为yes就不向根域名服务器请求,直接用这些列表里的。
        forward-addr: 202.96.128.86@53     #外部DNS服务器,格式: IP@PORT
        forward-addr: 202.96.134.133
        forward-addr: 202.96.134.33
        forward-addr: 202.96.128.166
        forward-addr: 114.114.114.114
        forward-addr: 114.114.115.115
        forward-addr: 182.254.116.116
        forward-addr: 119.29.29.29
        forward-addr: 180.76.76.76
        forward-addr: 223.5.5.5
        forward-addr: 223.6.6.6

启停:

# systemctl enable unbound
# systemctl restart unbound
记得重启或重配置时先保存cache,启动后或重配置后再导入cache:
# unbound-control dump_cache > ./unbound_dump_cache-20180919.tmp
# unbound-control reload
# unbound-control load_cache < ./unbound_dump_cache-20180919.tmp

管理:

# unbound-control status
# unbound-control stats_noreset
# unbound-control dump_cache
# unbound-control dump_infra
# unbound-control flush “aaa.com”
# unbound-control -h
Usage:  unbound-control [options] command
        Remote control utility for unbound server.
Options:
  -c file       config file, default is /etc/unbound/unbound.conf
  -s ip[@port]  server address, if omitted config is used.
  -q            quiet (don’t print anything if it works ok).
  -h            show this usage help.
Commands:
  start                         start server; runs unbound(8)
  stop                          stops the server
  reload                        reloads the server
                                (this flushes data, stats, requestlist)
  stats                         print statistics
  stats_noreset                 peek at statistics
  stats_shm                     print statistics using shm
  status                        display status of server
  verbosity <number>            change logging detail
  log_reopen                    close and open the logfile
  local_zone <name> <type>      add new local zone
  local_zone_remove <name>      remove local zone and its contents
  local_data <RR data…>       add local data, for example
                                local_data www.example.com A 192.0.2.1
  local_data_remove <name>      remove local RR data from name
  local_zones, local_zones_remove, local_datas, local_datas_remove
                                same, but read list from stdin
                                (one entry per line).
  dump_cache                    print cache to stdout
  load_cache                    load cache from stdin
  lookup <name>                 print nameservers for name
  flush <name>                  flushes common types for name from cache
                                types:  A, AAAA, MX, PTR, NS,
                                        SOA, CNAME, DNAME, SRV, NAPTR
  flush_type <name> <type>      flush name, type from cache
  flush_zone <name>             flush everything at or under name
                                from rr and dnssec caches
  flush_bogus                   flush all bogus data
  flush_negative                flush all negative data
  flush_stats                   flush statistics, make zero
  flush_requestlist             drop queries that are worked on
  dump_requestlist              show what is worked on by first thread
  flush_infra [all | ip]        remove ping, edns for one IP or all
  dump_infra                    show ping and edns entries
  set_option opt: val           set option to value, no reload
  get_option opt                get option value
  list_stubs                    list stub-zones and root hints in use
  list_forwards                 list forward-zones in use
  list_insecure                 list domain-insecure zones
  list_local_zones              list local-zones in use
  list_local_data               list local-data RRs in use
  insecure_add zone             add domain-insecure zone
  insecure_remove zone          remove domain-insecure zone
  forward_add [+i] zone addr..  add forward-zone with servers
  forward_remove [+i] zone      remove forward zone
  stub_add [+ip] zone addr..    add stub-zone with servers
  stub_remove [+i] zone         remove stub zone
                +i              also do dnssec insecure point
                +p              set stub to use priming
  forward [off | addr …]      without arg show forward setup
                                or off to turn off root forwarding
                                or give list of ip addresses
  ratelimit_list [+a]           list ratelimited domains
  ip_ratelimit_list [+a]        list ratelimited ip addresses
                +a              list all, also not ratelimited
  list_auth_zones               list auth zones
  view_list_local_zones view    list local-zones in view
  view_list_local_data  view    list local-data RRs in view
  view_local_zone view name type        add local-zone in view
  view_local_zone_remove view name      remove local-zone in view
  view_local_data view RR…            add local-data in view
  view_local_data_remove view name      remove local-data in view
5,601次阅读

Post navigation

前一篇:

中国金融数据月度报表-2018年8月

后一篇:

中国金融数据月度报表-2018年9月

发表评论 取消回复

邮箱地址不会被公开。 必填项已用*标注

个人介绍

需要么,有事情这里找联系方式:关于天楚锐齿

=== 美女同欣赏,好酒共品尝 ===

微信扫描二维码赞赏该文章:

扫描二维码分享该文章:

分类目录

  • Linux&Android (79)
  • Uncategorized (1)
  • 下载 (28)
  • 云计算 (37)
  • 人工智能 (8)
  • 大数据 (24)
  • 嵌入式 (34)
  • 杂七杂八 (34)
  • 物联网 (59)
  • 网络 (23)
  • 通信 (21)

文章归档

近期文章

  • 使用Python渲染OpenGL的.obj和.mtl文件
  • 用LVGL图形库绘制二维码
  • Android使用Messenger和SharedMemory实现跨app的海量数据传输
  • CAN信号的c语言解析代码
  • QT qml下DBus的使用例子

近期评论

  • 硕发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • maxshu发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • Ambition发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • Ambition发表在《使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序》
  • maxshu发表在《Android9下用ethernet 的Tether模式来做路由器功能》

阅读量

  • 使用Android的HIDL+AIDL方式编写从HAL层到APP层的程序 - 16,804次阅读
  • 卸载深信服Ingress、SecurityDesktop客户端 - 12,078次阅读
  • 车机技术之Android Automotive - 6,661次阅读
  • 车机技术之车规级Linux-Automotive Grade Linux(AGL) - 5,860次阅读
  • Linux策略路由及iptables mangle、ip rule、ip route关系及一种Network is unreachable错误 - 5,709次阅读
  • 在Android9下用ndk编译vSomeIP和CommonAPI以及使用例子 - 5,658次阅读
  • linux下的unbound DNS服务器设置详解 - 5,601次阅读
  • linux的tee命令导致ssh客户端下的shell卡住不动 - 4,998次阅读
  • 车机技术之360°全景影像(环视)系统 - 4,897次阅读
  • libwebp(处理webp图像)的安装和使用 - 4,749次阅读

功能

  • 文章RSS
  • 评论RSS

联系方式

地址
深圳市科技园

时间
周一至周五:  9:00~12:00,14:00~18:00
周六和周日:10:00~12:00

标签

android AT命令 centos Hadoop hdfs ip ipv6 kickstart linux mapreduce mini6410 modem OAuth openstack os python socket ssh uboot 内核 协议 安装 嵌入式 性能 报表 授权 操作系统 数据 数据库 月报 模型 汽车 测试 深信服 深度学习 源代码 神经网络 统计 编译 网络 脚本 虚拟机 调制解调器 车机 金融
© 2023 天楚锐齿