Appendix A - TCP/IP Utilities Reference

This appendix is a reference for using Microsoft TCP/IP utilities, which are diagnostic and connectivity utilities for network and connectivity administration. These client utilities are provided for file transfer, terminal emulation, and network diagnostics.

Diagnostic commands help you detect TCP/IP networking problems. Connectivity commands enable users to interact with and use resources on Microsoft hosts and non-Microsoft hosts such as UNIX workstations. The following commands are included:

Diagnostic commands: arp, hostname, ipconfig, lpq, nbtstat, netstat, ping, route, and tracert 

Connectivity commands: finger, ftp, lpr, rcp, rexec, rsh, telnet, and tftp 

Important All passwords used by Windows networking services are encrypted. However, the ftp, ftpsvc, rexec, and telnet connectivity utilities all rely on clear-text password authentication by the remote computer. Clear-text passwords are not encrypted before being sent over the network. This enables another user equipped with a network analyzer on the same network to steal a user's remote account password. For this reason, it is strongly recommended that users of these utilities choose different passwords than their Windows NT-based workgroup, workstation, or domain for the passwords used on non-Microsoft remote computers to which they connect by using the ftp, ftpsvc, rexec, and telnet utilities.

Note Switches used in the syntax for TCP/IP commands are case-sensitive. For example, for nbtstat, the switch -R has a different effect from the -r switch.

See also the topic "TCP/IP Procedures Help" in Control Panel Help.

arp

This diagnostic command displays and modifies the IP-to-Ethernet or Token Ring physical address translation tables used by the Address Resolution Protocol (ARP).

Syntax

arp -a [inet_addr] [-N [if_addr]]
arp -d inet_addr [if_addr]
arp -s inet_addr ether_addr [if_addr]

Parameters

-a Displays current ARP entries by querying TCP/IP. If inet_addr is specified, only the IP and physical addresses for the specified host are displayed. -d Deletes the entry specified by inet_addr. -g Same as -a -s Adds an entry in the ARP cache to associate the IP address inet_addr with the physical address ether_addr. The physical address is given as 6 hexadecimal bytes separated by hyphens. The IP address is specified using dotted decimal notation. The entry is static. It will not be automatically removed from the cache after the timeout expires and will not exist after a reboot of your computer. -N [if_addr] Displays the ARP entries for the network interface specified by if_addr. ether_addr Specifies a physical address. if_addr Specifies, if present, the IP address of the interface whose address translation table should be modified. If not present, the first applicable interface will be used. inet_addr Specifies an IP address in dotted decimal notation.

finger

This connectivity command displays information about a user on a specified host running the Finger service. Output varies based on the configuration of the remote host.

Syntax

finger [-l] [user]@ hostname [...]

Parameters

-l Displays information in long list format; not supported on all remote computers. user Specifies the user you want information about. Omit the user parameter to display information about all users on the specified host. @hostname Specifies the host name or IP address of the remote computer whose users you want information about.

ftp

This connectivity command transfers files to and from a host running an FTP server service, for example the Microsoft Internet Information Server. (A service is called a daemon in UNIX). Ftp is a complete session-oriented file transfer protocol. Ftp can be used interactively or by processing ASCII text files.

Syntax

ftp [-v] [-n] [-i] [-d] [-g] [-s: filename] [hostname]

Parameters

-v Suppresses display of remote server responses. -n Suppresses autologon upon initial connection. -i Turns off interactive prompting during multiple file transfers. -d Enables debugging, displaying all ftp commands passed between the client and server. -g Disables filename globbing, which permits the use of wildcard characters in local file and path names. (See the glob command in the TCP/IP Procedure Help. ) -s: filename Specifies a text file containing ftp commands; the commands automatically run after ftp starts. Use this switch instead of redirection (>). hostname Specifies the host name or IP address of the remote host to connect to. The host, if specified, must be the last parameter on the line.

The following table lists the ftp commands. For details about syntax of individual ftp commands, choose the ftp commands topic in the TCP/IP Procedure Help.

CommandPurpose

!

Runs the specified command on the local computer.

?

Displays descriptions for ftp commands. ? is identical to help.

append

Appends a local file to a file on the remote computer using the current file type setting.

ascii

Sets the file transfer type to ASCII, which is the default.

bell

Toggles a bell to ring after each file transfer command is completed. By default, the bell is off.

binary

Sets the file transfer type to binary.

bye

Ends the FTP session with the remote host and exits ftp.

cd

Changes the working directory on the remote host.

close

Ends the FTP session with the remote server and returns to the command interpreter.

debug

Toggles debugging. When debugging is on, each command sent to the remote host is printed, preceded by the string --->. By default, debugging is off.

delete

Deletes files on remote hosts.

dir

Displays a list of a remote directory's files and subdirectories.

disconnect

Disconnects from the remote host, retaining the ftp prompt.

get

Copies a remote file to the local host using the current file transfer type.

glob

Toggles filename globbing. Globbing permits use of wildcard characters in local file or path names. By default, globbing is on.

hash

Toggles hash-sign (#) printing for each data block transferred. The size of a data block is 2048 bytes. By default, hash-sign printing is off.

help

Displays descriptions for ftp commands.

lcd

Changes the working directory on the local host. By default, the current directory on the local host is used.

literal

Sends arguments, verbatim, to the remote FTP server. A single FTP reply code is expected in return.

ls

Displays an abbreviated list of a remote directory's files and subdirectories.

mdelete

Deletes files on remote hosts.

mdir

Displays a list of a remote directory's files and subdirectories. Mdir enables you to specify multiple files.

mget

Copies remote files to the local host using the current file transfer type.

mkdir

Creates a remote directory.

mls

Displays an abbreviated list of a remote directory's files and subdirectories.

mput

Copies local files to the remote host using the current file transfer type.

open

Connects to the specified FTP server.

prompt

Toggles prompting. Ftp prompts during multiple file transfers to enable you to selectively retrieve or store files; mget and mput transfer all files if prompting is turned off. By default, prompting is on.

put

Copies a local file to the remote host using the current file transfer type.

pwd

Displays the current directory on the remote host.

quit

Ends the FTP session with the remote host and exits ftp.

quote

Sends arguments, verbatim, to the remote FTP server. A single FTP reply code is expected in return. Quote is identical to literal.

recv

Copies a remote file to the local host using the current file transfer type. Recv is identical to get.

remotehelp

Displays help for remote commands.

rename

Renames remote files.

rmdir

Deletes a remote directory.

send

Copies a local file to the remote host using the current file transfer type. Send is identical to put.

status

Displays the current status of FTP connections and toggles.

trace

Toggles packet tracing; trace displays the route of each packet when running an ftp command.

type

Sets or displays the file transfer type.

user

Specifies a user to the remote host.

verbose

Toggles verbose mode. If on, all ftp responses are displayed; when a file transfer completes, statistics regarding the efficiency of the transfer are also displayed. By default, verbose is on.

hostname

This diagnostic command prints the name of the host on which the command is issued.

Syntax

hostname

This command has no parameters.

ipconfig

This diagnostic command displays all current TCP/IP network configuration values. This command is useful on computers running DHCP because it enables users to determine which TCP/IP configuration values have been configured by DHCP. If you enter only ipconfig without parameters, the response is a display of all of the current TCP/IP configuration values, including IP address, subnet mask, and default gateway.

Syntax

ipconfig [/all | /renew [adapter] | /release [adapter]]

Parameters

all Produces a full display. Without this switch, ipconfig displays only the IP address, subnet mask, and default gateway values for each network card. renew [adapter] Renews DHCP configuration parameters. This option is available only on computers running the DHCP Client service. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters. release [adapter] Releases the current DHCP configuration. This option disables TCP/IP on the local computer and is available only on DHCP clients. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.

lpq

This diagnostic utility is used to obtain the status of a print queue on a host running the LPD server. To use the lpq command from the Windows NT command prompt, you must first install the Microsoft TCP/IP Printing service from the Network option in Control Panel. 

Syntax

lpq -SServer -PPrinter [-l]

Parameters

-SServer Specifies the name of the host that has the printer attached to it. -PPrinter Specifies the name of the printer for the desired queue. -l Specifies that a detailed status should be given.

lpr

This connectivity utility is used to print a file to a host running an LPD server. You use the lpr command from the Windows NT command prompt, you must first install the Microsoft TCP/IP Printing service from the Network option in Control Panel.

Syntax

lpr -SServer -PPrinter [-oOptions] [-CClass] [-JJobname] [-o option] [-x] [-d] filename 

Parameters

-SServer Specifies the name of the host that has the printer attached to it. -PPrinter Specifies the name of the printer for the desired queue. -CClass Specifies the content of the banner page for the class. -JJobname Specifies the name of this job. -o option Indicates the type of the file (by default assumes a text file). Use "-o l" for binary PostScript files. -x Indicates compatibility with SunOS version 4.1.x and earlier. -d Send data file first. filename The name of the file to be printed.

Notes

To print a nontext file, such as a PostScript file, from a Windows NT-based computer to a printer controlled by a UNIX computer, use the lpr utility with the -ol switch. The l option specifies that the print file should be passed as is to the printer, with no processing by the Lpdsvc service.

To print a nontext file from a UNIX computer to a printer controlled by a Windows NT-based computer, use the lpr utility on the UNIX computer with the
-l switch. For details on the UNIX lpr utility, see your UNIX documentation.

nbtstat

This diagnostic command displays protocol statistics and current TCP/IP connections using NetBIOS over TCP/IP (NetBT).

Syntax

nbtstat [-a remotename] [-A IPaddress] [-c] [-n] [-R] [-r] [-S] [-s] [interval]

Parameters

-a remotename Lists the remote computer's name table using the computer's name. -A IPaddress Lists the remote computer's name table using the computer's IP address. -c Lists the contents of the NetBIOS name cache, giving the IP address of each name. -n Lists local NetBIOS names. -R Reloads the LMHOSTS file after purging all names from the NetBIOS name cache. Can be used if LMHOSTS LOOKUP is enabled on the computer. (To enable LMHOSTS LOOKUP, check Enable LMHOSTS LOOKUP on the WINS Address tab on the TCP/IP Properties page. -r Lists name resolution statistics for Windows networking. On a Windows NT-based computer configured to use WINS, this option returns the number of names resolved and registered via broadcast or via WINS. -S Displays both workstation and server sessions, listing the remote computers by IP address only.

-s Displays both workstation and server sessions. It attempts to resolve the remote computer IP address to a name by using the name resolution services (including, but not limited to, HOSTS FILE LOOKUP) which are configured on the computer. interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If this parameter is omitted, nbtstat prints the current configuration information once.

Notes

The column headings generated by the nbtstat utility have the following meanings.

In Number of bytes received. Out Number of bytes sent. In/Out Whether the connection is from the computer (outbound) or from another computer to the local computer (inbound). Life The remaining time that a name table cache entry will live before it is purged. Local Name The local NetBIOS name associated with the connection. Remote Host The name or IP address associated with the remote computer. Type This refers to the type of name. A name can either be a unique name or a group name. <03> Each NetBIOS name is 16 characters long. The last byte has special significance, and is used to indicate specific NetBIOS applications that each identify themselves by using the NetBIOS computer name. (The <> notation is the last byte converted to a hexadecimal value.)

State The state of NetBIOS connections. The possible states are shown in the following list:

StateMeaning

Connected

The session has been established.

Associated

A connection endpoint has been created and associated with an IP address.

Listening

This endpoint is available for an inbound connection.

Idle

This endpoint has been opened but cannot receive connections.

Connecting

The session is in the connecting phase where the name-to-IP address mapping of the destination is being resolved.

Accepting

An inbound session is currently being accepted and will be connected shortly.

Reconnecting

A session is trying to reconnect if it failed to connect on the first attempt.

Outbound

A session is in the connecting phase where the TCP connection is currently being created.

Inbound

An inbound session is in the connecting phase.

Disconnecting

A session is in the process of disconnecting.

Disconnected

The local computer has issued a disconnect, and it is waiting for confirmation from the remote computer.

netstat

This diagnostic command displays protocol statistics and current TCP/IP network connections.

Syntax

netstat [-a] [-e][-n][-s] [-p protocol] [-r] [interval]

Parameters

-a Displays all connections and listening ports; server connections are usually not shown. -e Displays Ethernet statistics. This can be combined with the -s option. -n Displays addresses and port numbers in numerical form (rather than attempting name lookups). -s Displays per-protocol statistics. By default, statistics are shown for TCP, UDP, ICMP, and IP; the -p option can be used to specify a subset of the default.

-p protocol Shows connections for the protocol specified by proto; proto (See notes) can be tcp or udp. If used with the -s option to display per-protocol statistics, protocol can be tcp, udp, icmp, or ip. -r Displays the contents of the routing table. interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If this parameter is omitted, netstat prints the current configuration information once.

Notes

The netstat utility provides statistics on the following network components.

StatisticPurpose

Foreign Address

The IP address and port number of the remote computer to which the socket is connected. The name corresponding to the IP address is shown, instead of the number, if the HOSTS file contains an entry for the IP address. In cases where the port is not yet established, the port number is shown as an asterisk (*).

Local Address

The IP address of the local computer, as well as the port number the connection is using. The name corresponding to the IP address is shown, instead of the number, if the HOSTS file contains an entry for the IP address. In cases where the port is not yet established, the port number is shown as an asterisk (*).

Proto

The name of the protocol used by the connection.

(state)

Indicates the state of TCP connections only. The possible states are:
CLOSED FIN_WAIT_1 SYN_RECEIVED
CLOSE_WAIT FIN_WAIT_2 SYN_SEND
ESTABLISHED LISTEN TIMED_WAIT
LAST_ACK

nslookup

This diagnostic tool displays information from Domain Name System (DNS) name servers. Before using this tool, you should be familiar with how DNS works. Nslookup is available only if the TCP/IP protocol has been installed.

Syntax

nslookup [-option …] [hostname | - [server]]

Modes

Nslookup has two modes: interactive and non-interactive.

If you only need to look up a single piece of data, use non-interactive mode. For the first argument, type the name or IP address of the host to be looked up. For the second argument, type the name or IP address of a DNS name server. If you omit the second argument, the default DNS name server will be used.

If you need to look up more than one piece of data, you can use interactive mode. Type a hyphen (-) for the first argument and the name or IP address of a DNS name server for the second argument. Or, omit both arguments (the default DNS name server will be used).

Parameters

-option … Specifies one or more nslookup commands as a command-line option. For a list of these optional commands, see the following Table A.2, Nslookup Commands in Windows NT. Each option consists of a hyphen (-) followed immediately by the command name and, in some cases, an equal sign (=) and then a value. For example, to change the default query type to host information and the initial timeout to 10 seconds, you would type: nslookup -querytype=hinfo -timeout=10 The command line length must be less than 256 characters. hostname Look up information for hostname using the current default server or using server if specified. If computer-to-find is an IP address and the query type is A or PTR, the name of the computer is returned. If hostname is a name and does not have a trailing period, the default DNS domain name is appended to the name. (You can change this behavior by using the nslookup set command. Refer to the following Table A.2, Nslookup Commands in Windows NT. To look up a computer not in the current DNS domain, append a period to the name. If you type a hyphen (-) instead of hostname, the command prompt changes to nslookup interactive mode. server Host name of the DNS server to use. If you omit server, the default DNS name server is used.

Notes

Interactive Commands

To interrupt interactive commands at any time, press CTRL+C. 

To exit, type exit.

The command line length must be less than 256 characters.

To treat a built-in command as a host name, precede it with the escape character (\).

An unrecognized command is interpreted as a host name.

Diagnostics

If the nslookup command fails, an error message prints. Possible errors are:

Timed out 

The server did not respond to a request after a certain amount of time (changed with set timeout=value) and a certain number of retries (changed with set retry=value).

No response from server 

No DNS name server is running on the server.

No records 

The DNS name server does not have resource records of the current query type for the host, although the host name is valid. The query type is specified with the set querytype command.

Non-existent domain 

The host name or DNS domain name does not exist.

Connection refused 

– Or –

Network is unreachable 

The connection to the DNS name server or Finger server could not be made. This error commonly occurs with ls and finger requests.

Server failure 

The DNS name server found an internal inconsistency in its database and could not return a valid answer.

Refused 

The DNS name server refused to service the request.

Format error 

The DNS name server found that the request packet was not in the proper format. It may indicate an error in nslookup.

The following table shows the nslookup commands. For details about syntax for individual nslookup commands, choose the nslookup commands topic in the TCP/IP Procedure Help.

CommandPurpose

exit

Exits interactive nslookup.

finger

Connects with the Finger server on the current host. The current host is defined when a previous lookup for a host was successful and returned the address information.

help

Displays a brief summary of nslookup commands.

ls

Lists information for a DNS domain. The default output contains host names and their IP addresses. (When output is directed to a file, hash marks (###) are printed for every 50 records received from the server.)

lserver

Changes the default server to the specified DNS domain. Lserver uses the initial server to look up the information about the specified DNS domain. (This is in contrast to the server command, which uses the current default server.)

root

Changes the default server to the server for the root of the DNS domain name space. Currently, the host G.ROOT-SERVERS.NET. is used. (This command is a synonym for lserver g.root-server.net.) The name of the root server can be changed with the set root command.

server

Changes the default server to the specified DNS domain. Server uses the current default server to look up the information about the specified DNS domain. (This is in contrast to the lserver command, which uses the initial server.)

set

Changes configuration settings that affect the behavior of the nslookup commands.

set all

Prints the current values of the configuration settings. Also prints information about the default server and host..

set cl[ass]

Changes the query class. (The class specifies the protocol group of the information.)

set [no]d2

Turns exhaustive debugging mode on or off. Essentially all fields of every packet are printed.

set [no] deb[ug]

Turns debugging mode on or off. With debugging on, more information is printed about the packet sent to the server and the resulting answer.

set [no] def[name]

If set, appends the default DNS domain name to a single-component lookup request. (A single component is a component that contains no periods.)

set do[main]

Changes the default DNS domain to the name specified. The default DNS domain name is appended to a lookup request depending on the state of the defname and search options. The DNS domain search list contains the parents of the default DNS domain if it has at least two components in its name. For example, if the default DNS domain is mydomain.mycompany.com, the search list is mydomain.mycompany.com and mycompany.com. Use the set srchlist command to specify a different list. Use the set all command to display the list.

Set [no] ig[nore]

If set, ignores packet truncation errors.

Set po[rt]

Changes the default TCP/UDP DNS name server port to the value specified.

Set q[uerytype]

Changes the type of information query. More information about types can be found in RFC 1035. (The set type command is a synonym for set querytype.)

set [no] rec[urse]

If set, tells the DNS name server to query other servers if it does not have the information.

Set ret[ry]

Sets the number of retries. When a reply to a request is not received within a certain amount of time (changed with set timeout), the timeout period is doubled and the request is resent. The retry value controls how many times a request is re-sent before giving up.

Set ro[ot]

Changes the name of the root server. This affects the root command.

Set [no] sea[rch]

If set and the lookup request contains at least one period but does not end with a trailing period, appends the DNS domain names in the DNS domain search list to the request until an answer is received.

Set srchl[ist]

Changes the default DNS domain name and search list. A maximum of six names separated by slashes (/) can be specified. This command overrides the default DNS domain name and search list of the set domain command. Use the set all command to display the list.

Set ti[meout]

Changes the initial number of seconds to wait for a reply to a request. When a reply to a request is not received within this time period, the timeout is doubled and the request is re-sent. (The number of retries is controlled with the set retry option.)

set ty[pe]

Changes the type of information query. More information about types can be found in RFC 1035. (The set type command is a synonym for set querytype.)

set [no] v[c]

If set, always uses a virtual circuit when sending requests to the server.

view

Sorts and lists the output of previous ls command(s).

References

For in-depth coverage of nslookup, see DNS and BIND by Paul Albitz and Cricket Liu, published by O'Reilly and Associates.

ping

This diagnostic command verifies connections to one or more remote computers.

Syntax

ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count]
[[-j host-list] | [-k host-list]] [-w timeout] destination-list 

Parameters

-t Pings the specified host until interrupted. -a Resolves addresses to host names. -n count Sends the number of ECHO packets specified by count. The default is 4. -l length Sends ECHO packets containing the amount of data specified by length. The default is 64 bytes; the maximum is 8192. -f Sends a Do Not Fragment flag in the packet. The packet will not be fragmented by gateways on the route. -i ttl Sets the time to live field to the value specified by ttl. -v tos Sets the type of service field to the value specified by tos. -r count Records the route of the outgoing packet and the returning packet in the record route field. A minimum of 1 to a maximum of 9 hosts must be specified by count. -s count Specifies the timestamp for the number of hops specified by count. -j host-list Routes packets via the list of hosts specified by host-list. Consecutive hosts can be separated by intermediate gateways (loose source routed). The maximum number allowed by IP is 9. -k host-list Routes packets via the list of hosts specified by host-list. Consecutive hosts cannot be separated by intermediate gateways (strict source routed). The maximum number allowed by IP is 9. -w timeout Specifies a timeout interval in milliseconds. destination-list Specifies the remote hosts to ping.

Notes

The ping command verifies connections to remote hosts by sending ICMP echo packets to the host and listening for echo reply packets. Ping waits for up to 1 second for each packet sent and prints the number of packets transmitted and received. Each received packet is validated against the transmitted message. By default, four echo packets containing 64 bytes of data (a periodic sequence of uppercase alphabetic characters) are transmitted.

You can use the ping utility to test both the host name and the IP address of the host. If the IP address is verified but the host name is not, you might have a name resolution problem. In this case, be sure that the host name you are querying is in either the local HOSTS file or in the DNS database.

The following shows sample output for ping:

C:\>ping ds.internic.net

Pinging ds.internic.net [192.20.239.132] with 32 bytes of data:

Reply from 192.20.239.132: bytes=32 time=101ms TTL=243
Reply from 192.20.239.132: bytes=32 time=100ms TTL=243
Reply from 192.20.239.132: bytes=32 time=120ms TTL=243
Reply from 192.20.239.132: bytes=32 time=120ms TTL=243

rcp

This connectivity command copies files between a Window NT computer and a computer running rshd, the remote shell server service or daemon. (A service is called a daemon in UNIX.) The rcp command can also be used for third-party transfer to copy files between two computers running rshd when the command is issued from a Windows NT-based computer. The rshd server service (daemon) is available on UNIX computers, but not on a Windows NT-based computer. The Windows NT-based computer can only participate as the computer from which the commands are issued. The remote computers must also support the rcp utility in addition to running rshd.

Syntax

rcp [-a | -b] [-h] [-r] source1 source2 ... sourceN destination 

Parameters

-a Specifies ASCII transfer mode. This mode converts the carriage return/linefeed characters to carriage returns on outgoing files, and linefeed characters to carriage return/linefeeds for incoming files. This is the default transfer mode. -b Specifies binary image transfer mode. No carriage return/linefeed conversion is performed. -h Transfers source files marked with the hidden attribute on the Windows NT-based computer. Without this option, specifying a hidden file on the rcp command line has the same effect as if the file did not exist. -r Recursively copies the contents of all subdirectories of the source to the destination. Both the source and destination must be directories. source and destination Must be of the form [host[.user]:]filename. If the [host[.user]:] portion is omitted, the host is assumed to be the local computer. If the user portion is omitted, the currently logged-on Windows NT user name is used. If a fully qualified host name is used, which contains the period (.) separators, then the [.user] must be included. Otherwise, the last part of the host name is interpreted as the user name. If multiple source files are specified, the destination must be a directory. If the filename does not begin with a forward slash ( / ) for UNIX computers or a backward slash ( \ ) for Windows NT-based computers, it is assumed to be relative to the current working directory. Under Windows NT, this is the directory from which the command is issued. On the remote computer, it is the logon directory for the remote user. A period (.) means the current directory. Use the escape characters ( \ , ", or ') in remote paths to use wildcard characters on the remote host.

Notes

Remote Privileges

The rcp command does not prompt for passwords; the current or specified user-name must exist on the remote host and enable remote command execution via rcp.

The .rhosts File

The .rhosts file specifies which remote computer or users can assess a local account using rsh or rcp. This file (or a HOSTS equivalent) is required on the remote computer for access to a remote computer using these commands. Rsh and rcp both transmit the local user name to the remote computer. The remote computer uses this name plus the IP address (usually resolved to a host name) or the requesting computer to determine whether access is granted. There is no provision for specifying a password to access an account using these commands.

If the user is logged on to a Windows NT Server domain, the domain controller must be available to resolve the currently logged-on name, because the logged-on name is not cached on the local computer. Because the user name is required as part of the rsh protocol, the command fails if the user name cannot be obtained.

The .rhosts file is a text file where each line is an entry. An entry consists of the local host name, the local user name, and any comments about the entry. Each entry is separated by a tab or space, and comments begin with a hash mark (#),for example:

computer5 marie #This computer is in room 31A

The .rhosts file must be in the user's home directory on the remote computer. (Normally a DNS name server is used instead of the .rhosts file.)

Additionally, have your host name added to the remote computer's /Etc/Hosts file. This enables the remote computer to authenticate remote requests for your computer using the Microsoft TCP/IP utilities.

For more information about a remote computer's specific implementation of the .rhosts file, see the remote computer's documentation

Specifying Hosts

Use the host.user variables to use a user name other than the current user name. If host.user is specified with source, the .rhosts file on the remote host must contain an entry for user.

If a host name is supplied as a full domain name containing periods, a user name must be appended to the host name. This prevents the last element of the domain name from being interpreted as a user name. For example,

rcp domain-name1.user:johnm domain-name2.user:richr
Remote Processing

Remote processing is performed by a command run from the user's logon shell on most UNIX computers. The user's .profile or .cshrc is executed before parsing filenames, and exported shell variables can be used (using the escape characters or quotation marks) in remote filenames.

Copying Files

If you attempt to copy a number of files to a file rather than a directory, only the last file is copied. Also, the rcp command cannot copy a file onto itself.

Examples

These examples show syntax for some common uses of rcp.

To copy a local file to the logon directory of a remote computer:

rcp filename remotecomputer:

To copy a local file to an existing directory and a new filename on a remote computer:

rcp filename remotecomputer:/directory/newfilename

To copy multiple local files to a subdirectory of a remote logon directory:

rcp file1 file2 file3 remotecomputer:subdirectory/filesdirectory

To copy from a remote source to the current directory of the local computer:

rcp remotecomputer:filename 

To copy from multiple files from multiple remote sources to a remote destination with different user names:

rcp remote1.user1:file1 remote2.user2:file2 remotedest.destuser:directory

To copy from a remote computer using an IP address to a local computer (where the user name is mandatory because a period is used in the remote host name):

rcp 11.101.12.1.user:filename filename 

rexec

This connectivity command runs commands on remote hosts running the rexecd service. Rexec authenticates the user name on the remote host by using a password, before executing the specified command.

Syntax

rexec host [-l username] [-n] command 

Parameters

host Specifies the remote host on which to run command. -l username Specifies the user name on the remote host. -n Redirects the input of rexec to NUL. command Specifies the command to run.

Notes

Rexec prompts the user for a password and authenticates the password on the remote host. If the authentication succeeds, the command is executed.

Rexec copies standard input to the remote command, standard output of the remote command to its standard output, and standard error of the remote command to its standard error. Interrupt, quit, and terminate signals are propagated to the remote command. Rexec normally terminates when the remote command does.

Using Redirection Symbols

Use quotation marks around redirection symbols to redirect onto the remote host. If quotation marks are not used, redirection occurs on the local computer. For example, the following command appends the remote file remotefile to the local file localfile:

rexec otherhost cat remotefile >> localfile

The following command appends the remote file remotefile to the remote file otherremotefile:

rexec otherhost cat remotefile ">>" otherremotefile

Using Interactive Commands

You cannot run most interactive commands. For example, vi or emacs cannot be run using rexec. Use telnet to run interactive commands.

route

This diagnostic command manipulates network routing tables.

Syntax

route [-f] [command [destination] [MASK netmask] [gateway] [METRIC metric]]

Parameters

-f Clears the routing tables of all gateway entries. If this parameter is used in conjunction with one of the commands, the tables are cleared prior to running the command. -p When used with the route add command, makes a route persistent across restarts of the computer. By default, routes are not preserved when the computer is restarted. When used with the route print command, displays the list of registered persistent routes. Ignored for all other commands. command Specifies one of four commands.

CommandPurpose

print

Prints a route

add

Adds a route

delete

Deletes a route

change

Modifies an existing route

destination Specifies the host to send command. MASK Specifies, if present, that the next parameter be interpreted as the netmask parameter. netmask Specifies, if present, the subnet mask value to be associated with this route entry. If not present, this parameter defaults to 255.255.255.255. gateway Specifies the gateway. METRIC Specifies the route metric (cost) for the destination.

Notes

The route utility does not accept a subnet mask value of 255.255.255.255 on the command line. To specify a subnet mask with this value, you must accept the default.

On a multihomed computer on which a network is available from more than one adapter card, all network traffic is passed over the first gateway defined. If you add a second gateway to the same network, the entry is added to the route table, but it is never used.

The route utility uses the Networks file to convert destination names to addresses. For the route utility to work correctly, the network numbers in the Networks file must specify all four octets in dotted decimal notation. For example, a network number of 284.122.107 must be specified in the Networks file as 284.122.107.0, with trailing zeroes appended.

All symbolic names used for destination or gateway are looked up in the network and host name database files NETWORKS and HOSTS, respectively. If the command is route print or route delete, wildcards may be used for the destination and gateway, or the gateway argument may be omitted.

rsh

This connectivity command runs commands on remote hosts running the rsh service. For information about the .rhosts file, see the Rcp command.

Syntax

rsh host[-l username] [-n] command 

Parameters

host -l username Specifies the user name to use on the remote host. If omitted, the logged-on user name is used. -n Redirects the input of rsh to NUL. command Specifies the command to run.

Notes

Rsh copies standard input to the remote command, standard output of the remote command to its standard output, and the standard error of the remote command to its standard error. Rsh normally terminates when the remote command does.

Using Redirection Symbols

Use quotation marks around redirection symbols to redirect onto the remote host. If quotation marks are not used, redirection occurs on the local computer. For example, the following command appends the remote file remotefile to the local file localfile:

rsh otherhost cat remotefile >> localfile 

The following command appends the remote file remotefile to the remote file otherremotefile:

rsh otherhost cat remotefile ">>" otherremotefile

Using Rsh on a Windows NT Server Domain

If the user is logged on to a Windows NT Server domain, the domain controller must be available to resolve the currently logged-on name, because the logged-on name is not cached on the local computer. Because the username is required as part of the rsh protocol, the command fails if the username cannot be obtained.

The .rhosts File

The .rhosts file generally permits network access rights on UNIX computers. The .rhosts file lists computer names and associated logon names that have access to remote computers. When issuing rcp, rexec, or rsh commands to a remote computer with a properly configured .rhosts file, you do not need to provide logon and password information for the remote computer.

The .rhosts file is a text file where each line is an entry. An entry consists of the local computer name, the local user name, and any comments about the entry. Each entry is separated by a tab or space, and comments begin with a hash mark (#), for example:

computer5 marie #This computer is in room 31A

The .rhosts file must be in the user's home directory on the remote computer. For further information about a remote computer's specific implementation of the .rhosts file, see the remote computer's documentation. (Normally a DNS name server is used instead of the .rhosts file.)

telnet

This connectivity command starts terminal emulation with a remote host running a Telnet server service. Telnet provides DEC VT 100, DEC VT 52, or TTY emulation, using the connection-based services of TCP.

To provide terminal emulation from a Windows NT computer, the remote host must be running TCP/IP and a Telnet server service. The Windows NT-based Telnet client must also have a user account on the remote Telnet server.

The Telnet client can be started by selecting Telnet from the Accessories program group or by using the command prompt. The syntax and usage for starting the Telnet client from the command prompt is described next. For information about starting the Telnet client by selecting Telnet from the Accessories program group, see online Help.

Note Windows NT Server and Windows NT Workstation provide the telnet client utility but do not provide a Telnet server service (telnetd), also referred to as the Telnet daemon.

Syntax

telnet [host [port]]

Parameters

hostname Specifies the host name or IP address of the remote host with which you want to connect. port Specifies the remote port you want to connect to. The default value is specified by the telnet entry in the Services file. If no entry exists in the Services file, the default connection port value is decimal 23.

tftp

This connectivity command transfers files to and from a remote computer running the Trivial File Transfer Protocol (TFTP) service. This utility is similar to ftp, but it does not provide user authentication, although the files require read and write UNIX permissions. Tftp can only be used for unidirectional transfer of files.

Syntax

tftp [-i] host [get | put] source [destination]

Parameters

-i Specifies binary image transfer mode (also called octet). In binary image mode, the file is moved literally byte by byte. Use this mode when transferring binary files. If -i is omitted, the file is transferred in ASCII mode. This is the default transfer mode. This mode converts the end-of-line (EOL) characters to a carriage return for UNIX and to a carriage return/linefeed for personal computers. Use this mode when transferring text files. If a file transfer is successful, the data transfer rate is displayed. host Specifies the local or remote host. get Transfers destination on the remote computer to source on the local computer. Because the TFTP protocol does not support user authentication, the user must be logged on, and the files must be writable on the remote computer. put Transfers source on the local computer to destination on the remote computer. source Specifies the file to transfer. destination Specifies where to transfer the file.

tracert

This diagnostic utility determines the route taken to a destination by sending Internet Control Message Protocol (ICMP) echo packets with varying time-to-live (TTL) values to the destination. Each router along the path is required to decrement the TTL on a packet by at least 1 before forwarding it, so the TTL is effectively a hop count. When the TTL on a packet reaches 0, the router is supposed to send back an ICMP Time Exceeded message to the source computer. Tracert determines the route by sending the first echo packet with a TTL of 1 and incrementing the TTL by 1 on each subsequent transmission until the target responds or the maximum TTL is reached. The route is determined by examining the ICMP Time Exceeded messages sent back by intermediate routers. Notice that some routers silently drop packets with expired TTLs and will be invisible to tracert.

Syntax

tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name 

Parameters

-d Specifies not to resolve addresses to host names. -h maximum_hops Specifies maximum number of hops to search for target. -j host-list Specifies loose source route along host-list. -w timeout Waits the number of milliseconds specified by timeout for each reply. target_name Name of the target host.



© 2014 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy Statement