606 lines
10 KiB
HTML
606 lines
10 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>DNS Users Tools</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.60"><LINK
|
|
REL="HOME"
|
|
TITLE="Securing and Optimizing Linux"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Software -Networking"
|
|
HREF="soft-netwrkng.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="DNS Administrative Tools"
|
|
HREF="chap21sec170.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Installed files"
|
|
HREF="chap21sec172.html"></HEAD
|
|
><BODY
|
|
CLASS="section"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Securing and Optimizing Linux: RedHat Edition -A Hands on Guide</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="chap21sec170.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 21. Software -Networking</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="chap21sec172.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H1
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN11447"
|
|
>21.10. <SPAN
|
|
CLASS="acronym"
|
|
>DNS</SPAN
|
|
> Users Tools</A
|
|
></H1
|
|
><P
|
|
> The commands listed belows are some that we use often, but many more exist. Check the man pages and documentation for more details and information.
|
|
</P
|
|
><DIV
|
|
CLASS="formalpara"
|
|
><P
|
|
><B
|
|
>nslookup. </B
|
|
>
|
|
The <B
|
|
CLASS="command"
|
|
>nslookup</B
|
|
> program allows the user to query Internet domain name servers interactively or non-interactively. In interactive mode the user can query name servers for information about various hosts
|
|
and domains, and print a list of hosts in a domain. In non-interactive mode the user can just print the name and request information for a host or domain.
|
|
|
|
Interactive mode has a lot of options and commands; it is recommended that you see the man page for nslookup, or the help under nslookup Interactive mode.
|
|
</P
|
|
></DIV
|
|
><P
|
|
> To enter under nslookup Interactive mode, use the command:
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>nslookup</B
|
|
>
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="literallayout"
|
|
><TT
|
|
CLASS="computeroutput"
|
|
> Default Server: deep.openna.com
|
|
Address: 208.164.186.1
|
|
|
|
> help
|
|
$Id: nslookup.help,v 8.4 1996/10/25 18:09:41 vixie Exp $
|
|
|
|
Commands: (identifiers are shown in uppercase, [] means optional)
|
|
NAME - print info about the host/domain NAME using default server
|
|
NAME1 NAME2 - as above, but use NAME2 as server
|
|
help or ? - print info on common commands; see nslookup(1) for details
|
|
set OPTION - set an option
|
|
all - print options, current server and host
|
|
[no]debug - print debugging information
|
|
[no]d2 - print exhaustive debugging information
|
|
</TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
</P
|
|
><P
|
|
> To run in non-interactive mode, use the command:
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>nslookup</B
|
|
> www.redhat.com
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="literallayout"
|
|
><TT
|
|
CLASS="computeroutput"
|
|
> Server: deep.openna.com
|
|
Address: 208.164.186.1
|
|
|
|
Non-authoritative answer:
|
|
Name: www.portal.redhat.com
|
|
Addresses: 206.132.41.202, 206.132.41.203
|
|
Aliases: www.redhat.com
|
|
</TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
Where <TT
|
|
CLASS="literal"
|
|
>www.redhat.com</TT
|
|
> is the host name or Internet address of the name server to be looked up.
|
|
</P
|
|
><DIV
|
|
CLASS="formalpara"
|
|
><P
|
|
><B
|
|
>dnsquery. </B
|
|
>
|
|
The dnsquery program queries domain name servers via the resolver library calls <TT
|
|
CLASS="filename"
|
|
>/etc/resolv.conf</TT
|
|
>.
|
|
|
|
To query domain name servers using resolver, use the command:
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>dnsquery</B
|
|
> <host>
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="example"
|
|
><A
|
|
NAME="AEN11472"
|
|
></A
|
|
><P
|
|
><B
|
|
>Example 21-1. dnsquery</B
|
|
></P
|
|
><P
|
|
> <TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>dnsquery</B
|
|
> www.redhat.com
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="literallayout"
|
|
><TT
|
|
CLASS="computeroutput"
|
|
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40803
|
|
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
|
|
;; www.redhat.com, type = ANY, class = IN
|
|
www.redhat.com. 2h19m46s IN CNAME www.portal.redhat.com.
|
|
redhat.com. 2h18m13s IN NS ns.redhat.com.
|
|
redhat.com. 2h18m13s IN NS ns2.redhat.com.
|
|
redhat.com. 2h18m13s IN NS ns3.redhat.com.
|
|
redhat.com. 2h18m13s IN NS speedy.redhat.com.
|
|
ns.redhat.com. 1d2h18m8s IN A 207.175.42.153
|
|
ns2.redhat.com. 1d2h18m8s IN A 208.178.165.229
|
|
ns3.redhat.com. 1d2h18m8s IN A 206.132.41.213
|
|
speedy.redhat.com. 2h18m13s IN A 199.183.24.251
|
|
</TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
|
|
Where <host> is the name of the host you want to query.
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="formalpara"
|
|
><P
|
|
><B
|
|
>host. </B
|
|
>
|
|
The host program looks up host names using <SPAN
|
|
CLASS="acronym"
|
|
>DNS</SPAN
|
|
>.
|
|
|
|
To look up host names using domain server, use the command:
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>host</B
|
|
> <FQDN, domain names, host names, or host numbers>
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="example"
|
|
><A
|
|
NAME="AEN11485"
|
|
></A
|
|
><P
|
|
><B
|
|
>Example 21-2. Look up host names</B
|
|
></P
|
|
><P
|
|
> <TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>host</B
|
|
> redhat.com
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="literallayout"
|
|
><TT
|
|
CLASS="computeroutput"
|
|
> redhat.com has address 207.175.42.154
|
|
</TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
Where <FQDN, domain names, host names, or host numbers> is either FDQN <TT
|
|
CLASS="literal"
|
|
>www.redhat.com</TT
|
|
>, domain names <TT
|
|
CLASS="literal"
|
|
>redhat.com</TT
|
|
>, host names <TT
|
|
CLASS="literal"
|
|
>www</TT
|
|
> or host numbers <TT
|
|
CLASS="literal"
|
|
>207.175.42.154</TT
|
|
>.
|
|
</P
|
|
></DIV
|
|
><P
|
|
> To find all of the information about a host maintained by the <SPAN
|
|
CLASS="acronym"
|
|
>DNS</SPAN
|
|
>, use the command:
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>host</B
|
|
> -a <domain names >
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
</P
|
|
><DIV
|
|
CLASS="example"
|
|
><A
|
|
NAME="AEN11500"
|
|
></A
|
|
><P
|
|
><B
|
|
>Example 21-3. Using host</B
|
|
></P
|
|
><P
|
|
> <TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>host</B
|
|
> -a redhat.com
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="literallayout"
|
|
><TT
|
|
CLASS="computeroutput"
|
|
> Trying null domain
|
|
rcode = 0 (Success), ancount=6
|
|
The following answer is not authoritative:
|
|
The following answer is not verified as authentic by the server:
|
|
redhat.com 8112 IN NS ns.redhat.com
|
|
redhat.com 8112 IN NS ns2.redhat.com
|
|
redhat.com 8112 IN NS ns3.redhat.com
|
|
redhat.com 8112 IN NS speedy.redhat.com
|
|
redhat.com 8112 IN A 207.175.42.154
|
|
redhat.com 11891 IN SOA ns.redhat.com noc.redhat.com(
|
|
2000021402 ;serial (version)
|
|
3600 ;refresh period
|
|
1800 ;retry refresh this often
|
|
604800 ;expiration period
|
|
86400 ;minimum TTL
|
|
)
|
|
For authoritative answers, see:
|
|
redhat.com 8112 IN NS ns.redhat.com
|
|
redhat.com 8112 IN NS ns2.redhat.com
|
|
redhat.com 8112 IN NS ns3.redhat.com
|
|
redhat.com 8112 IN NS speedy.redhat.com
|
|
Additional information:
|
|
ns.redhat.com 94507 IN A 207.175.42.153
|
|
ns2.redhat.com 94507 IN A 208.178.165.229
|
|
ns3.redhat.com 94507 IN A 206.132.41.213
|
|
speedy.redhat.com 8112 IN A 199.183.24.251
|
|
</TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
This option can be used to find all of the information that is maintained by the domain server about this host, in our example <TT
|
|
CLASS="literal"
|
|
>redhat.com</TT
|
|
>.
|
|
</P
|
|
></DIV
|
|
><P
|
|
> To list a complete domain, use the command:
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>host</B
|
|
> -l <domain names >
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
</P
|
|
><DIV
|
|
CLASS="example"
|
|
><A
|
|
NAME="AEN11511"
|
|
></A
|
|
><P
|
|
><B
|
|
>Example 21-4. List a complete domain</B
|
|
></P
|
|
><P
|
|
> <TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="screen"
|
|
> [root@deep] /# <B
|
|
CLASS="command"
|
|
>host</B
|
|
> -l openna.com
|
|
</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
<TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="literallayout"
|
|
><TT
|
|
CLASS="computeroutput"
|
|
> openna.com name server deep.openna.com
|
|
openna.com name server mail.openna.com
|
|
localhost.openna.com has address 127.0.0.1
|
|
deep.openna.com has address 208.164.186.1
|
|
mail.openna.com has address 208.164.186.2
|
|
www.openna.com has address 208.164.186.3
|
|
</TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
>
|
|
This option, in the official master file format, will give a complete download of the zone data for the domain name <TT
|
|
CLASS="literal"
|
|
>openna.com</TT
|
|
>. This command should be used only if it is absolutely necessary.
|
|
</P
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="chap21sec170.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="chap21sec172.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>DNS Administrative Tools</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="soft-netwrkng.html"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Installed files</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |