HostedDB - Dedicated UNIX Servers

-->
Internet Security Professional Reference:Understanding TCP/IP
Previous Table of Contents Next


The dig Command

The Domain Information Groper, dig, is a flexible command-line tool that can be used to gather information from the Domain Name System servers. The dig tool can operate in simple interactive mode, where it satisfies a single query, and a batch mode, in which multiple requests are satisfied.

The dig tool requires a slightly modified version of the BIND resolver library to gather count and time statistics. Otherwise, it is a straightforward effort of parsing arguments and setting appropriate parameters. The output of dig can be rather convoluted, as shown here:

# dig gatekeeper.dec.com
; <<>> DiG 2.0 <<>> gatekeeper.dec.com
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6
;; flags: qr rd ra ; Ques: 1, Ans: 1, Auth: 2, Addit: 2
;; QUESTIONS:
;;      gatekeeper.dec.com, type = A, class = IN

;; ANSWERS:
gatekeeper.dec.com.    150369  A       16.1.0.2

;; AUTHORITY RECORDS:
DEC.com.       166848  NS      GATEKEEPER.DEC.COM.
DEC.com.       166848  NS      CRL.DEC.COM.

;; ADDITIONAL RECORDS:
GATEKEEPER.DEC.COM.    150369  A       16.1.0.2
CRL.DEC.COM.   166848  A       192.58.206.2

;; Sent 1 pkts, answer found in time: 400 msec
;; FROM: oreo.widgets.ca to SERVER: default — 192.139.234.50
;; WHEN: Mon Oct 10 15:07:41 1994
;; MSG SIZE  sent: 36  rcvd: 141

#

In the output shown here, the dig command searches the Domain Name Server records looking for gatekeeper.dec.com. A DNS record is found and reported to the user. Consequently, the dig command can be used to help resolve difficult name server problems.

User Commands

Just as there are a number of commands to assist the system administrator in the management of the system and network, there are a number of commands that are used by the users to get the information they want and to perform the tasks they need. Although a user can execute some of the administration commands you have seen, the real work is done with commands you are about to examine: telnet, ftp, and the Berkeley r-commands.

The Berkeley r-Commands

The first of the commands examined here falls into the set called the Berkeley r-commands. These are the rlogin, rcp, and rsh/rcmd commands. They are called the Berkeley r-commands because they all start with the letter r, and they originated from the University of California at Berkeley. The successful use of the command in this section is dependent upon user and host equivalency being properly configured. Most users have difficulty with these commands because their network administrators have not properly configured the host and user equivalency.

rlogin

The rlogin command connects your local session to a remote session on a different host. To initiate a remote terminal session, use the following command:

rlogin remote

This command starts a connection to the rlogind server on the remote host, as illustrated here:

$ rlogin gateway
Last   successful login for chare: Sun Oct 09 16:16:03 EDT 1994 on ttyp1
Last unsuccessful login for chare: Tue Sep 27 07:18:54 EDT 1994 on ttyp0
SCO UNIX System V/386 Release 3.2
Copyright (C) 1976-1989 UNIX System Laboratories, Inc.
Copyright (C) 1980-1989 Microsoft Corporation
Copyright (C) 1983-1992 The Santa Cruz Operation, Inc.
All Rights Reserved
gateway

Terminal type is dialup
$

The terminal type of the remote connection is the same as the terminal type that is in use for the current connections, unless modified by the user’s shell startup files. All of the character echoing is done at the remote site, so except for delays, the use of the rlogin is transparent to the user. Termination of the connection is made either by logging out of the remote host, or through the termination character, which is ~. (tilde period).

rcp

The rcp, or remote copy, command enables the user to copy a file from one host to another. rcp copies files between two machines. Each file or directory argument is either a remote filename of the form “rhost:path”, or a local filename (containing no ‘:’ characters, or a ‘/’ before any ‘:’).

The syntax of the command is as follows:

rcp [ -p ] file1 file2
rcp [ -p ] [ -r ] file ... directory

The remote file must be specified using the syntax:

hostname:filename

The named file is copied to or from the remote system depending upon whether the source or destination file is remote. The following illustrates copying a file from the local host to the remote:

$ rcp test.new chelsea:test.new
$

When the filename, as illustrated in the preceding example, does not begin with a slash (/), the file is copied in a directory relative to your home directory on the remote system. The rcp command behaves like the cp command in that the file could be called by a different name on the remote system.

If the -r option is specified and any of the source files are directories, rcp copies each subtree rooted at that name; in this case, the destination must be a directory. By default, the mode and owner of file2 are preserved if the file already existed; otherwise, the mode of the source file modified by the umask on the destination host is used.

The -p option causes rcp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the umask. The following illustrates using rcp with the -r option to copy a directory tree:

$ pwd
/u/chare
$ lc tmp
arp.ADMN     bootpd       dig.new      route.new
arp.new      bootpd.ADMN  rarpd.new    routed.new
$rcp -r chelsea:/tmp tmp
$ lf tmp
arp.ADMN      bootpd        dig.new       route.new     test.new
arp.new       bootpd.ADMN   rarpd.new     routed.new    tmp/
$

After executing the rcp command in the preceding example, a new directory is created called tmp in /u/chare/tmp. This directory contains the contents of the /tmp directory on host chelsea.


Previous Table of Contents Next