测试DNS服务的命令

测试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...

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

时间: 2024-08-30 10:01:20

测试DNS服务的命令的相关文章

Centos 基本DNS服务搭建

定义: DNS:根据一个域名和IP地址相互映射的一个分布式数据库.通过主机名,最终得到该主机名对应的IP地址的过程叫做域名解析(或主机名解析). 通常 Internet 主机域名的一般结构为:主机名.三级域名.二级域名.顶级域名. 资源记录:rr(resource record),常见的资源记录的类型: SOA: Start Of Authority, 起始授权记录,一个区域文件只能有一个: NS:Name Server MX: Mail eXchange, 邮件交换器,MX记录有优先级属性(0

DNS服务之bind安装配置与应用

BIND是实现DNS服务的一套软件(官方站点:isc.org),其包含了服务器端程序named(由bind程序包提供,监听套接字:53/tcp.53/udp),和客户端工具host.nslookup.dig(由bind-utils程序包提供).为保证服务器的安全性,bind还提供了一种"沙箱机制",bind-chroot是将原文件系统的根"/"替换成"/var/named/chroot"来使用. 目前主流的bind程序依旧是9.x系列.使用yum

DNS服务的配置与验证

DNS服务的配置与验证 一.DNS的用途    DNS服务器(Domain Name System)即域名解析服务器,因特网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直接读取的IP数串.通过主机名,最终得到该主机名对应的IP地址的过程叫做域名解析(或主机名解析).DNS协议运行在UDP协议之上,使用端口号53. 二.DNS服务的安装 检查是否已安装bind软件 三.DNS的配置 基于案例的配置: 案例说明: 服务器IP:     192.

RHEL7 DNS 服务 unbound 测试

测试环境: rhel1.rusky.com 192.168.100.1 RHEL7(辅DNS) rhel2.rusky.com 192.168.100.2 RHEL7(主DNS) rhdl3.rusky.com 192.168.100.3 RHEL6 一.搭建主DNS服务器 在安装前先停止系统自带的dnsmasq服务,因为该服务也用53端口,并且已经启动.否则 unbound服务无法启动. [[email protected] ~]# netstat -antulp | grep 53 tcp

【详解】DNS服务工作原理、正反向解析和主从同步

目录: 一.理论部分 二.实验部分 ******************************理论部分*************************************** 正文: 一.什么是DNS服务. DNS服务是互联网的基础性服务之一.全称为Domain Name System(域名系统).DNS是因特网上作为域名和IP地址相互映射的一个分布式数据库,提供将域名转换成对应IP地址的信息条目,能够使用户更方便的通过域名(如baidu.com)去访问互联网,而不用去记住能够被机器直接

DNS服务基础知识

一.DNS的基本概念 DNS:domain name server域名:www.baidu.com(主机名,FQDN,full qualified domain name,完全限定域名) 二.DNS的类型主DNS服务器:数据的修改 DNS服务器类型辅助DNS服务器:请求数据的同步serial numberrefreshretryexpirenagative answer TTL 缓存dns服务器转发器 三.资源记录 数据库中的,每一个条目称作一个资源记录(resource record RR)资

DNS服务搭建

※DNS基础知识: DNS(Domain Name Service):域名解析服务,应用层协议. BIND:实现DNS服务的一种软件. DNS监听的端口:53/TCP,53/UDP DNS查询类型:递归查询,迭代查询 DNS的两种解析方式:正向解析(FQDN ---> IP),反向解析(IP --->FQDN) 区域解析库:由众多资源记录组成: 资源记录(RR)类型: SOA:Start Of Authority,起始授权记录:一个区域解析库有且仅能有一个SOA记录,而必须为解析库的第一条记录

DNS服务基础及bind基础配置和应用

DNS服务基础及bind基础配置和应用  DNS服务基础011.DNS:Domain   Name  Service,  ( 应用层协议)2.tld:Top Level Domain 顶级域(1)顶级域中的组织域.com  (company).net    网络组织.org非盈利型组织   org:other  organizations.gov  government.edu    教育机构.mil   military军事的,军队,军人...(2)顶级域中的国家域.tw   .hk  .cn

dns服务bind使用

正向,反向,主从,子域,转发器,安全控制. 介绍: top level domain(tld) 顶级域 域的组织络式,我们也看到箭头是单向的,这也是域名解析的方式,在本地DNS服务器无法解析的情况下,本地DNS服务器会直接去找根域,再找顶级域,找到组织域再找到主机名.注册域名一般就是注册的组织域,现在也有那种net.co,这种不知道是怎么个情况. 递归 迭代: 现在我们先来看看左下角这个用户是如何解析到redhat.com下面的主机的.server是对应的dns服务器. 用户向本地的DNS服务器