dns.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1887 7ace23894f44
child 1911 870693ce6ff0
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1862
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
.. include:: HEADER.rst
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
======
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 DNS.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
======
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
About DNS resolving protocol.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
=============================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
Default port for name resolving is ``53``::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  $ nslookup -port=53 microsoft.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
Debugging name resolution.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
==========================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
  $ nslookup -debug microsoft.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
Dumping all available resords::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  $ nslookup -type=any microsoft.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
1863
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    25
Timing information and traces available via::
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    26
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    27
  $ dig +trace google.com
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    28
  $ dig @8.8.4.4 +noall +answer +stats A defun.work
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    29
1873
d64682ab74a2 ``+additional`` option
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1863
diff changeset
    30
Despite ``dig`` shown only names for NS replays also have IP adresses (to avoid
d64682ab74a2 ``+additional`` option
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1863
diff changeset
    31
chicken/egg ptoblem when you request name resolution but asked to resolve
d64682ab74a2 ``+additional`` option
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1863
diff changeset
    32
another name). To see IP addressed use ``+additional`` option::
d64682ab74a2 ``+additional`` option
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1863
diff changeset
    33
d64682ab74a2 ``+additional`` option
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1863
diff changeset
    34
  $ dig +trace +additional google.com
d64682ab74a2 ``+additional`` option
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1863
diff changeset
    35
1862
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
IP from host name.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
==================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
This request is for the ``A`` record and default for ``nslookup`` command::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
  $ nslookup defun.work
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
  $ nslookup -type=a defun.work
1863
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    43
  $ nslookup -type=a defun.work 8.8.8.8
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    44
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    45
  $ dig @8.8.8.8 A defun.work
1532554ca0b4 Timing information and traces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1862
diff changeset
    46
  $ dig +nocmd +noall +answer defun.work
1862
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
Host name from IP.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
==================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
If that information available::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
  $ nslookup -type=ptr 8.8.8.8
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
List authoritative NS for domain.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
=================================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
  $ dig ns defun.work
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
  $ nslookup -type=ns defun.work
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
List MX records for domain.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
===========================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
  $ dig mx mail.google.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
  $ nslookup -type=mx mail.google.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
1881
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    70
Query for TXT records.
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    71
======================
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    72
::
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    73
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    74
  $ dig -t TXT google.com
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    75
  $ dig google.com TXT
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    76
  $ nslookup -type=txt google.com
1887
7ace23894f44 nslookup -q=txt
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1881
diff changeset
    77
  $ nslookup -q=txt google.com
1881
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    78
  $ host -t txt google.com
889e37c1c5b5 Query for TXT records.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1874
diff changeset
    79
1862
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
List SOA records for domain.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
============================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
SOA ("Start Of Authority") Record for a domain provides technical information
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
about the domain::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
  $ dig soa defun.work
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
Human readable format can be viewed via::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
  $ nslookup -type=mx defun.work
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
    origin = ns1.mindsandmachines.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
    mail addr = admin.mindsandmachines.com
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
    serial = 2011091101
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
    refresh = 10800
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
    retry = 7200
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
    expire = 604800
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
    minimum = 86400
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
Email adress for domain administrator is ``admin@mindsandmachines.com`` for
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
above output.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
List domain names.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
==================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
  $ dig ns dp.gov.ua
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
  ...
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
  ;; ANSWER SECTION:
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
  dp.gov.ua.              3600    IN      NS      ns.giknpc.com.ua.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
  ...
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
  $ dig @ns.giknpc.com.ua dp.gov.ua AXFR
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
  ...
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
  dp.gov.ua.              3600    IN      MX      200 relay2.giknpc.com.ua.
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
  dp.gov.ua.              3600    IN      A       195.64.190.1
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
  adm.dp.gov.ua.          3600    IN      A       195.64.190.1
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
1874
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   119
Get info about NS.
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   120
==================
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   121
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   122
Version of running NS::
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   123
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   124
  $ dig @4.2.2.1 version.bind chaos txt
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   125
  $ nslookup -q=txt -class=CHAOS version.bind. 4.2.2.1
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   126
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   127
Server name::
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   128
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   129
  $ dig @4.2.2.1 id.server txt chaos
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   130
  $ nslookup -q=txt -class=CHAOS id.server. 4.2.2.1
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   131
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   132
  $ dig @4.2.2.1 hostname.bind txt chaos
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   133
  $ nslookup -q=txt -class=CHAOS hostname.bind. 4.2.2.1
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   134
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   135
That strings come from BIND config::
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   136
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   137
  options {
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   138
    version "none of your business";
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   139
    server-id "Host A";
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   140
    hostname "Host A";
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   141
  };
12f24827be09 Get info about NS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1873
diff changeset
   142
1862
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
How reread config file?
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
=======================
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
FreeBSD::
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
f4e844aa1217 Debugging name resolution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
  $ named.reload