Linux/DNS: Difference between revisions

From Wiki
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
== host ==
== Ubuntu 18.04 show DNS settings ==
<pre>
systemd-resolve --status
</pre>
 
== host (scripting) ==
 
== dig (testing) ==
* install
<pre>apt install dnsutils</pre>
 
* Basic query
<pre>dig google.com</pre>
 
* Query all record types
<pre>dig google.com ANY</pre>
 
* Query specific DNS server
<pre>dig google.de @8.8.8.8</pre>
 
* Reverse DNS lookup
<pre>dig -x 193.99.144.80</pre>
 
* Trace DNS path
<pre>dig google.com +trace</pre>


== nslookup ==
== nslookup ==
<pre>
nslookup google.com
nslookup -query=ANY google.com
</pre>
== DNS entry ==
<pre>
$TTL 86400
@ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. (
    2000091604  ; Serial
    14400      ; Refresh
    1800        ; Retry
    604800      ; Expire
    86400  )    ; Minimum
@          IN NS    ns1.first-ns.de.
@          IN NS    robotns2.second-ns.de.
@          IN NS    robotns3.second-ns.com.


localhost  IN A    127.0.0.1
@          IN A    1.2.3.4
www        IN A    2.3.4.5
www        IN AAAA  2001:db8::1
mail        IN A    2.3.4.5


== dig ==
loopback    IN CNAME localhost
<pre>apt install dnsutils</pre>  
pop        IN CNAME www
smtp        IN CNAME www
relay      IN CNAME www
imap        IN CNAME www
ftp    3600 IN CNAME ftp.anderedomain.de.
 
@          IN MX 10 mail
 
technik    IN A    5.6.7.8
technik    IN MX 10 technik
 
@          IN TXT  "v=spf1 mx -all"
</pre>


== DNS entry types ==
* ANY (all types)
* A (Host address)
* AAAA (IPv6 host address)
* ALIAS (Auto resolved alias)
* CNAME (Canonical name for an alias)
* MX (Mail eXchange)
* NS (Name Server)
* PTR (Pointer)
* SOA (Start Of Authority)
**
<blockquote>
<pre>
$TTL 86400
@ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. (
2000091604  ; Serial
14400      ; Refresh
1800        ; Retry
604800      ; Expire
86400  )    ; Minimum
</pre>
</blockquote>
* SRV (location of service)
* TXT (Descriptive text)





Latest revision as of 11:29, 19 August 2019

Ubuntu 18.04 show DNS settings

systemd-resolve --status

host (scripting)

dig (testing)

  • install
apt install dnsutils
  • Basic query
dig google.com
  • Query all record types
dig google.com ANY
  • Query specific DNS server
dig google.de @8.8.8.8
  • Reverse DNS lookup
dig -x 193.99.144.80
  • Trace DNS path
dig google.com +trace

nslookup

nslookup google.com
nslookup -query=ANY google.com

DNS entry

$TTL 86400
@ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. (
     2000091604  ; Serial
     14400       ; Refresh
     1800        ; Retry
     604800      ; Expire
     86400  )    ; Minimum

@           IN NS    ns1.first-ns.de.
@           IN NS    robotns2.second-ns.de.
@           IN NS    robotns3.second-ns.com.

localhost   IN A     127.0.0.1
@           IN A     1.2.3.4
www         IN A     2.3.4.5
www         IN AAAA  2001:db8::1
mail        IN A     2.3.4.5

loopback    IN CNAME localhost
pop         IN CNAME www
smtp        IN CNAME www
relay       IN CNAME www
imap        IN CNAME www
ftp    3600 IN CNAME ftp.anderedomain.de.

@           IN MX 10 mail

technik     IN A     5.6.7.8
technik     IN MX 10 technik

@           IN TXT   "v=spf1 mx -all"

DNS entry types

  • ANY (all types)
  • A (Host address)
  • AAAA (IPv6 host address)
  • ALIAS (Auto resolved alias)
  • CNAME (Canonical name for an alias)
  • MX (Mail eXchange)
  • NS (Name Server)
  • PTR (Pointer)
  • SOA (Start Of Authority)
$TTL 86400
@ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. (
2000091604  ; Serial
14400       ; Refresh
1800        ; Retry
604800      ; Expire
86400  )    ; Minimum
  • SRV (location of service)
  • TXT (Descriptive text)