码迷,mamicode.com
首页 > 其他好文 > 详细

测试DNS服务的命令

时间:2018-02-21 23:01:13      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:markdown   save   line   查看   attr   new   named   发送   short   

测试DNS服务的命令

dig

    dig用于测试dns系统,因此不会查询hosts文件进行解析。
    dig - DNS lookup utility
    dig     [@global-server] [domain] [q-type] [q-class] {q-opt}{global-d-opt} host [@local-server] {local-d-opt}[ host [@local-server] {local-d-opt} [...]]
        Where:  domain is in the Domain Name System
                q-class  is one of (in,hs,ch,...) [default: in]
                q-type   is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a] (Use ixfr=version for type ixfr)
                q-opt    is one of:
                @<服务器地址>:   指定进行域名解析的域名服务器;
                -b<ip地址>:   当主机具有多个IP地址,指定使用本机的哪个IP地址向域名服务器发送域名查询请求;
                -f<文件名称>:   指定dig以批处理的方式运行,指定的文件中保存着需要批处理查询的DNS任务信息;
                -P: 指定域名服务器所使用端口号;
                -t<类型>: 指定要查询的DNS数据类型;
                -x<IP地址>:   执行逆向域名查询;
                -4: 使用IPv4;
                -6: 使用IPv6;
                -h: 显示指令帮助信息。
                d-opt    is of the form +keyword[=value], where keyword is:
                         +[no]vc             (TCP mode)
                         +[no]tcp            (TCP mode, alternate syntax)
                         +time=###           (Set query timeout) [5]
                         +tries=###          (Set number of UDP attempts) [3]
                         +retry=###          (Set number of UDP retries) [2]
                         +domain=###         (Set default domainname)
                         +bufsize=###        (Set EDNS0 Max UDP packet size)
                         +ndots=###          (Set NDOTS value)
                         +edns=###           (Set EDNS version)
                         +[no]search         (Set whether to use searchlist)
                         +[no]showsearch     (Search with intermediate results)
                         +[no]defname        (Ditto)
                         +[no]recurse        (Recursive mode)
                         +[no]ignore         (Don‘t revert to TCP for TC responses.)
                         +[no]fail           (Don‘t try next server on SERVFAIL)
                         +[no]besteffort     (Try to parse even illegal messages)
                         +[no]aaonly         (Set AA flag in query (+[no]aaflag))
                         +[no]adflag         (Set AD flag in query)
                         +[no]cdflag         (Set CD flag in query)
                         +[no]cl             (Control display of class in records)
                         +[no]cmd            (Control display of command line)
                         +[no]comments       (Control display of comment lines)
                         +[no]question       (Control display of question)
                         +[no]answer         (Control display of answer)
                         +[no]authority      (Control display of authority)
                         +[no]additional     (Control display of additional)
                         +[no]stats          (Control display of statistics)
                         +[no]short          (Disable everything except short
                                              form of answer)
                         +[no]ttlid          (Control display of ttls in records)
                         +[no]all            (Set or clear all display flags)
                         +[no]qr             (Print question before sending)
                         +[no]nssearch       (Search all authoritative nameservers)
                         +[no]identify       (ID responders in short answers)
                         +[no]trace          (Trace delegation down from root)
                         +[no]dnssec         (Request DNSSEC records)
                         +[no]nsid           (Request Name Server ID)
                         +[no]sigchase       (Chase DNSSEC signatures)
                         +trusted-key=####   (Trusted Key when chasing DNSSEC sigs)
                         +[no]topdown        (Do DNSSEC validation top down mode)
                         +[no]multiline      (Print records in an expanded format)
                         +[no]onesoa         (AXFR prints only one soa record)
        
    正向解析:
        dig [-t type] name [@SERVER] [query options]
            -t type:指定资源记录类型
            name:将名称解析为指定的资源类型
            @SERVER:指定解析的服务器,指定服务器后,/etc/resolv.conf中的配置的nameserver将无意义。
            query options:
                +[no]trace :[不]跟踪解析过程 : dig +trace magedu.com
                +[no]recurse :[不]进行递归解析
    测试反向解析:
        dig -x IP = dig –t ptr reverseip.in-addr.arpa
            注意:有正向解析,不一定能反响解析出域名,因为ip和FQDN不在一个树状结构系统上。
    模拟区域传送:
        dig -t axfr ZONE_NAME @SERVER
        
            dig -t axfr magedu.com @10.10.10.11
            dig –t axfr 100.1.10.in-addr.arpa @172.16.1.1
            dig -t NS . @114.114.114.114
            dig -t NS . @a.root-servers.net
    dig整个输出的格式简化如下:
        [domain]    [ttl]   IN  [[RR type]  [RR data]]
        待查数据    暂存时间(秒) IN  [[资源类型] [资源内容]]

host

    host - DNS lookup utility
    host    [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time][-R number] [-m flag] hostname [server]
        -a: 显示详细的DNS信息;
        -c<类型>: 指定查询类型,默认值为“IN“;
        -C: 查询指定主机的完整的SOA记录;
        -r: 在查询域名时,不使用递归的查询方式;
        -t<类型>: 指定查询的域名信息类型;
        -v: 显示指令执行的详细信息;
        -w: 如果域名服务器没有给出应答信息,则总是等待,直到域名服务器给出应答;
        -W<时间>: 指定域名查询的最长时间,如果在指定时间内域名服务器没有给出应答信息,则退出指令;
        -4: 使用IPv4;
        -6: 使用IPv6.
        
    host [-t type] name [SERVER]
        host –t NS magedu.com 172.16.0.1
        host –t soa magedu.com
        host –t mx magedu.com
        host –t axfr magedu.com
        host 1.2.3.4

nslookup

    nslookup - query Internet name servers interactively
    Nslookup is a program to query Internet domain name servers.
    nslookup [-option] [name | -] [server]
    交互式模式:
    nslookup>
        server IP:  指明使用哪个DNS server 进行查询
        set q=RR_TYPE:  指明查询的资源记录类型
        NAME:  要查询的名称

rndc

    rndc - name server control utility
    rndc    [-b source-address] [-c config-file] [-k key-file] [-s server] [-p port] [-V][-y key_id] {command}
        reload      重载主配置文件和区域解析库文件Reload configuration file and zones.
        reload zone [class [view]]  重载区域解析库文件
        refresh zone [class [view]] 安排区域的及时维护
        retransfer zone [class [view]]  手动启动 区域传送, 而不管序列号是否增加
        freeze      暂停对所有动态区域的更新
        freeze zone [class [view]]  暂停更新一个动态区域
        thaw            启动更新所有动态区域并重新加载它们
        thaw zone [class [view]]    启动更新一个冻结的动态区域并重新加载它
        notify zone [class [view]]  重新对区域传送发通知
        reconfig        重载主配置文件
        sign zone [class [view]]    更新区域keys,并按需求进行签名
        loadkeys zone [class [view]]    更新keys但不立即签名 
        stats           将服务器统计信息写入统计文件
        querylog        开启或关闭查询日志文件/var/log/message
        dumpdb [-all|-cache|-zones] [view ...]  将缓存存储到转存文件
        secroots [view ...] 将安全roots写入到secroots文件
        stop            Save pending updates to master files and stop the server.
        stop -p     Save pending updates to master files and stop the serverreporting process id.
        halt            在不保存花费更新的情况瞎停止服务        halt -p     停止服务而不保存挂起更新的报告进程id
        trace           递增debug 一个级别.
        trace level 指定使用的级别
        notrace     将调试级别设置为 0
        flush       清空DNS服务器的所有缓存记录
        flush [view]        刷新服务器的缓存以查看视图
        flushname name [view]   从服务器缓存中刷新已给名称
        status      显示服务状态
        recursing       转存当前recuring的查询 (named.recursing)
        tsig-list       列出所有当前活动的TSIG keys,包括静态配置和TKEY-NEGOTIATED
            的keys
        tsig-delete keyname [view]      删除一个 TKEY-negotiated TSIG key.
        validation newstate [view]  启/禁用 DNSSEC 验证
        addzone ["file"] zone [class [view]] { zone-options }   将区域添加到给定视图中,需要新区域文件选项
        delzone ["file"] zone [class [view]]    从给定视图中移除区域,需要新区域文件选项
        *restart        重启服务

whois

    whois可以查询到当初注册这个domain的用户的相关信息。
    whois - client for the whois directory service
    whois   [ { -h | --host } HOST ] [ { -p | --port } PORT ] [ -abBcdGHKlLmMrRx ] [ -g SOURCE:FIRST-LAST ][ -i ATTR[,ATTR]... ] [ -s SOURCE[,SOURCE]... ] [ -T TYPE[,TYPE]... ] [ --verbose ] OBJECT
    whois   -q KEYWORD
    whois   -t TYPE
    whois   -v TYPE
    whois [OPTION]... OBJECT...

测试DNS服务的命令

标签:markdown   save   line   查看   attr   new   named   发送   short   

原文地址:https://www.cnblogs.com/shenxm/p/8457597.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!