7.8. Networking and Internet Command-Line Tools For many networking and troubleshooting tasks, your best bet is to use command-line tools. This section covers the networking command-line tools built into Vista. Connection Manager Profile Installer: \windows\system32\cmstp.exe An automated connection profile installation utility. To open Command Prompt cmstp Description You use the Connection Manager Profile Installer to automate the installation (or removal) of connection profiles. For example, an ISP or network administrator may build an .inf file containing all the necessary information to connect to another computer or service, and then use the Connection Manager Profile Installer to integrate the information into a particular computer. Type cmstp at any prompt for information on its usage. |
Finger: \windows\system32\finger.exe Display information about a user account. To open Command Prompt finger Usage finger [-l] [user][@host] Description The Finger client uses a standard protocol to retrieve publicly available information from any networked computer that is running the Finger daemon. Let's say you want to find out about the username "Woodrow" on your own system; you would simply type: finger woodrow Finger accepts the following options: user The username you want to query. Omit to list all the users currently logged in on the specified host. @host The target machine containing the user account(s) you want to query. Omit to query the local machine (localhost). -l Displays information in a long list format. The Finger protocol has been around for a long time, and all versions of Windows NT, Windows 2000, Windows XP, Windows Vista, Unix, Solaris, and other platforms support it. The output from a Finger request varies widely (if you get a response at all); it depends on the operating system running on the specified host and the specific settings imposed by that machine's administrator. Finger, when it works, commonly retrieves a report that looks something like this: Login: woodrow Name: Gordie Howe Directory: /usr/local/home/woodrow Shell: /bin/csh Never logged in. New mail received Mon Oct 1 23:35 2001 (PDT) Unread since Wed Nov 20 11:54 1996 (PDT) No Plan. Although most of the information included in this simple report is self-evident, the last line mentions a plan. The plan is a text file to be shown when one's account is fingered. It might contain contact information, office hours, personal statistics, or anything else the user wants. Notes The Finger daemon is the service responsible for responding to finger requests. This service is disabled by default, but you can enable or otherwise configure it using the services component of the Microsoft Management Console. Note that enabling the service on your computer may pose a security hazard, allowing outsiders to gain some information about one or more users on your system. As more users and administrators become security-savvy, you'll find fewer occasions when a Finger request actually gets a response. Typically, you'll receive a "connection refused" message. |
FTP: \windows\system32\ftp.exe File Transfer Protocol; transfer files between two computers, typically across the Internet. To open Command Prompt ftp Usage ftp url ftp [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-w:size] [host] Description You use FTP to transfer files to and from a remote computer, typically on the Internet. Like many Internet applications, FTP is a client application that requires a corresponding FTP server to work. When you start FTP, you are connecting to a remote host and then issuing commands to instruct the host to send or receive files, display directory listings, and so on. Although each FTP session requires a username and password, there's a very common workaround that allows anonymous connections. Typically, one enters anonymous or ftp as the username and an email address (or, frankly, any bogus text ending in @) as the password to log in (assuming anonymous access is allowed on the server at all). Once you've logged in, you issue commands by typing in the prompt; the complete list of FTP commands is documented later in this section. The exception is when FTP is run in noninteractive mode using the url option. Command-line parameters for FTP are as follows: url A web-style address (URL) to a specific file located on an anonymous FTP server, which looks something like this: ftp://example.com/path/file If you specify a complete URL, FTP will download the file and then quit automatically, rather than going into interactive mode. host Specify the hostname or IP address of the remote host (server) to connect to. If you omit it, you can enter it once FTP has started by using the open command. For example: ftp ftp.microsoft.com Note that the common ftp. prefix, although not mandatory with FTP, is merely a hostname that signifies a specific machine, often solely devoted to serving FTP requests. -v Suppress the display of remote server responses to commandsuseful if you're running FTP from a script. -n Suppress auto-login upon initial connection. To connect, you'll need to use the user command once FTP is running. -i Turn off interactive prompting during multiple file transfers when using the mget and mput FTP commands. -d Enable debuggingdisplaying all FTP commands passed between the client and server (for troubleshooting purposes). -g Disable filename globbing, which permits the use of wildcard characters in local file- and pathnames. (See the FTP glob command in the list that follows.) -s: filename Specify an FTP script, a plain-text file containing sequential FTP commands, one per line. The commands are issued as though they were typed at the keyboard. -a Use any local interface when establishing a connection. -A Log in as anonymous (note the capital A). This is the same as logging in normally and manually typing in anonymous as the username and an email address as the password. -w: size Override the default transfer buffer size of 4,096. Change only if you encounter performance problems. Note that you can start FTP without any command-line parameters to enter interactive mode, but you won't be able to use most of the commands until you log in with the open command (see the following list). FTP commands The following list shows the commands available once FTP is running. Most require that a connection has been established and not all will work with every FTP server. The most important commands to know are put, get, mput, mget, cd, lcd, dir, and bye. If you are transferring binary files across platforms (from a Unix host to a Windows-based client, for example), be sure to use the binary command first, or the files may be corrupted in transit. ! [ command] Run the specified command (e.g., cd) on the local computer, as though you temporarily jumped out of FTP, ran a command, and then jumped back inall without disconnecting. Naturally, you could just open a second Command Prompt window, but some contextual commands, such as cd (see Chapter 14), require the use of the ! command to be effective. Type ! by itself to start a mini-Command Prompt session in which you can type multiple commands; type EXIT to return to the active FTP session. ? [ command] Same as help. append Append a local file to a file on the remote computer. ascii Set the file transfer type to ASCII (plain text), the default (except in noninteractive mode). ASCII mode is useful if you're transferring plain-text files between Unix and Windows systems, as line-ending translation must be performed on these types of files. Note that this translation will almost always corrupt binary files such as ZIP archives or Word documents, so you should use the binary command if you're not transferring ASCII files. bell Turn on or off the beep after each file transfer command is completed. By default, the bell is off. binary Set the file transfer type to binary, a crucial step for transferring nontext files (such as .zip, .gif, and .doc) between Unix and Windows-based machines. Although it's not necessary if the server is also a Windows system, it's a good idea to get into the habit of typing binary (or simply bin) every time you use FTP. Note that binary is the default in noninteractive mode, when used with the url command-line parameter. See also "ascii," earlier in this list. bye End the FTP session and, if necessary, disconnect from the remote computer. The standard Command Prompt exit command won't work here, but quit will. cd [ directory] Change the working directory on the remote computer (to cd on the local machine, use ! cd or lcd). close Disconnect from the remote computer without exiting FTP. Use open to connect to a different FTP server or bye to exit FTP. debug Toggle debugging. When debugging is on, each internal command sent to the remote computer is displayed, preceded by the string --->. By default, debugging is off. delete remote_file Delete a file on the remote computer. You can delete only a single file at a time with delete (no wildcards are allowed); use mdelete to delete multiple files at once. dir Display a list of the contents of the working directory on the remote computer, with details. Use ls for a simple listing. Occasionally, directory listings for anonymous users may be disabled, in which case dir will not work; if you want to download, you'll need to know the particular filename(s) beforehand. disconnect Same as close. get remote_file [ local_file] Transfer remote_file from the server to the local machine. If local_file is not specified, the local file will be given the same name as the original. The file will be placed in the local working directory; to choose a different destination, use lcd. You can download only a single file at a time with get (no wildcards are allowed); use mget to transfer multiple files at once. If transferring binary (nontext) files, use the binary command first. glob Toggle filename globbing. Globbing permits use of wildcard characters in local file- or pathnames. By default, globbing is on. You also can disable globbing with the -g command-line parameter. hash Turn on or off FTP's crude progress bar for file transfers. A hash mark (#) character is displayed for each 2 KB of data transferred, so large files will have longer progress bars than small files. By default, hash mark printing is off. help [ command] Display all the available commands. Include command to get help with a single command (e.g., help get). Same as ?. lcd [ directory] Change the working directory on the local computer. Enter a full path as directory (e.g., c:\downloads) to effectively instruct FTP to place downloaded files there. Omit directory to simply display the current working directory. By default, the working directory is in use when FTP is started; if FTP is opened from Start Run, the working directory is literal command_line Send so-called "arbitrary" commands to the remote FTP server (such as retr, stor, pasv, and port). A single FTP reply code is expected in return. Typical use of FTP does not involve using literal, but it can provide access to some advanced functions; among the more interesting is the ability to transfer files between two remote computers without having to first transfer them to the local machine. ls Display an abbreviated list of a remote directory's files and subdirectories. This is useful when a directory contains a lot of files. Type ls -l (or use dir) to show the "long" listing, including file details. Occasionally, you can disable directory listings for anonymous users, in which case ls will not work; if you want to download, you'll need to know the particular filename(s) beforehand. mdelete [ files] Delete multiple files on remote computers. Unlike with delete, you can use wildcards (e.g., *.txt for all .txt files). mdir remote_files local_file Store a listing of the remote working directory's contents (with details) into a file; both parameters are required. You use the remote_files parameter to modify the listing, either by specifying a wildcard (use * to list all files) or by specifying the name of another directory. local_file is the target filename in which the directory listing is stored. mget remote_files Transfer one or more remote files to the local computer. Unlike with get, you can use wildcards (e.g., *.txt for all .txt files). You will be asked to confirm each transfer unless you turn off prompting with the prompt command. Local files will be given the same names as their remote counterparts. If transferring binary (nontext) files, use the binary command first. mkdir directory Create a remote directory. Note that anonymous users are usually not permitted to create directories on remote systems. mls remote_dir local_file Same as mdir, except that a short listing (no details) is stored. mput local_files Transfer one or more local files to the remote computer. Unlike with put, you can use wildcards (e.g., *.txt for all .txt files). You will be asked to confirm each transfer unless you turn off prompting with the prompt command. Remote files will be given the same names as their local counterparts. If transferring binary (nontext) files, use the binary command first. open hostname or IP address Connect to the specified FTP server. This is the same as specifying a server in the FTP command line; use open if you omitted the host parameter. You can use open whenever there's no current connection, either if you disconnected using disconnect or close, or if the initial connection attempt was unsuccessful. prompt Turn on or off prompting for multiple file transfers. When you use the mput or mget command, FTP will prompt you before transferring each file. By default, prompt is turned on; type prompt before using mput or mget to transfer multiple files without being prompted. put local_file [ remote_file] Transfer local_file from the local machine to the server. If you do not specify remote_file, the remote file will be given the same name as the original. The file will be placed in the remote working directory; to choose a different destination, use cd. You can upload only a single file at a time with put (no wildcards are allowed); use mput to transfer multiple files at once. If transferring binary (nontext) files, use the binary command first. pwd Print Working Directory (PWD) displays the remote working directory; use cd to change to a different remote directory. quit End the FTP session with the remote computer and exit FTP. quote [ command_line] Same as literal. recv remote_file [ local_file] Same as get. remotehelp [ command] Display help for remote commands supported by the server. This is probably similar to the commands available on the client, but may not be identical. As with ? and help, supplying no arguments returns a list of command names. Use remotehelp command to get more information on each command. rename from_name to_name Rename a remote file. Note that anonymous users are usually not permitted to rename files on remote systems. rmdir remote_directory Delete a remote directory. Note that anonymous users are usually not permitted to delete directories on remote systems. send local_file [ remote_file] Same as put. status Display the current status of the connection and the current settings of options such as prompt, verbose, and ascii|binary. trace Turn on or off packet tracing, which displays the route of each packet when executing an FTP command. By default, trace is off. type [ type] Display whether transfers are performed in binary or ascii mode. Use type binary (or just binary) to transfer binary files. user username [ password] Specify the username on the remote computer; if you do not specify a password, you will be prompted for one. Typically, FTP prompts for the username and password when a connection is first established; however, if you type an incorrect username and password, you can try again with the user command without having to reconnect. verbose Turn on or off verbose mode. If verbose is on (the default), all FTP responses are displayed, such as when a file transfer completes and any statistics regarding the efficiency of the transfer. Examples To copy the file preface.doc from the directory /pub/nutshell on a remote computer to \temp\docs on your local computer, once you're logged on to a server, you would perform the following from the command prompt (note that cd within ftp is for the remote computer): C:\>cd \temp\docs C:\temp\docs>ftp remote_computer username password ftp>binary ftp>cd /pub/nutshell ftp>get preface.doc Run a script containing ftp commands: C:\>ftp -s:myfile.scr This will load ftp and run myfile.scr, executing any ftp commands in the file. Notes Most web browsers support the ftp:// protocol, which provides limited FTP functionality without having to use an FTP client. For example, you can retrieve a single file from an anonymous FTP server by opening this address in any web browser: ftp://example.com/path/filename.ext. Furthermore, you can specify a username and (optionally) a password, like this: ftp://username:password@example.com/path/filename.ext. Some browsers will even let you upload files when connected to an FTP server (assuming the server permits you to do so). In Internet Explorer, you can simply drag and drop files into an FTP window as though it were a folder on your hard disk. You can abbreviate all ftp command names to their first four letters, sometimes fewer. If you omit any nonoptional arguments from most FTP commands, you'll be prompted for them. When using the get or mget command, transferred files will be placed in whatever directory was the working directory when you launched FTP. Once an FTP session has begun, you can change the working directory with the lcd command: to switch from the local C:\ drive to the A:\ drive, for example, you would type: ftp>lcd a:/ In FTP, to maintain consistency with its Unix heritage, you must use the forward slash (/) instead of the backslash (\) when specifying pathnames. Furthermore, directory and filenames are case-sensitive when connecting to a Unix FTP server; readme.txt is a different file than Readme.TXT. Many FTP servers impose an "idle timeout" on FTP connections; that is, if you open an FTP connection and let it sit for several minutes without typing any commands, the FTP server will disconnect you. |
Msg: \windows\system32\msg.exe Send a text message to one or all local users. To open Command Prompt msg Usage msg recipient [/server:name] [/time:sec] [/v] [/w] [message] Description You use Msg to send a text message to a user currently logged in to the local computer; you also can use it to send a message simultaneously to all logged-in users. Note that Msg is not intended to send messages to other computers, but to users remotely logged in to your computer. The exception is a user on another machine currently logged in to your machine (or the machine specified by /server), assuming that machine is set up as a Terminal Server. To send a message to another computer, use an instant messaging program such as MSN Messenger or Chat (or just send an email). Msg accepts the following options: message The text message to send. If you omit it, Msg prompts for it. Also can read from standard input; see Chapter 14. recipient Recipient can be a username, a session name, a session ID, or a filename (pointing to a file containing a list of usernames, session names, or session IDs). Or, specify an asterisk (*) to send a message to all sessions on the specified server. /server: name Specifies /server:name to send the message to users on another machine, where name is the name of a Terminal Server (see "Services," in the "Microsoft Management Console" section in Chapter 10, for details). /time: sec Indicates the amount of time, in seconds, to wait for the recipient to acknowledge the message being sent. /v Verbose mode; displays additional information about the actions being performed. /w Waits for a response from the recipient; useful with /v. |
Net: \windows\system32\net.exe Display, modify, and troubleshoot your current workgroup settings. To open Command Prompt net Usage net command [parameters] Description Net is a general-purpose diagnostic tool used to configure, control, and troubleshoot the networking settings on a Windows Vista system. The Net tool will appeal most to more advanced users or those who need to control network settings from the command line. To use Net, you must specify one of the following 21 commands, followed by any of the applicable parameters. To get more information about any of these commands, use the help command, like this: net help command Here are the commands used with Net: accounts Use net accounts to update the user accounts database and modify password and logon requirements for all accounts. If used without parameters, the current settings for password, logon limitations, and domain information are displayed. computer Use net computer to add or delete computers from a domain database; it is available only on Windows Server. config The net config command displays configuration information about the workstation or server service. See the "Example" section at the end of this list. continue Type net continue to reactivate a Windows service that has been suspended by net pause. file net file closes a shared file and removes any file locks. When you use it without options, net file lists the open files on a server. The listing includes the ID number, location, number of locks, and user currently accessing the file. group net group adds, displays, or modifies global groups on servers. When you use it without options, net group displays a list of the groups on the server. help net help displays more information about any command. When you use it without options, net help displays all the available commands. helpmsg The net helpmsg command displays information about error, warning, and alert messages relating to a Windows network. For example, type net helpmsg 2181 to display an explanation of error #2181 and any possible remedies. localgroup net localgroup modifies local groups on computers. When you use it without options, net localgroup displays a list of the groups on the server. name The net name command adds or deletes a messaging name, an alias to which messages are sent (via net send). When you use it without options, a list of names accepting messages at the computer is displayed. pause Use net pause to temporarily suspend a Windows service or resource, and use net continue to reactivate it when you're ready. print The net print command displays print jobs and shared printer queues. session net session lists or disconnects sessions between the computer and other computers on the network. share The net share command makes a server's resources available to network users. When you use it without options, it lists information about all resources being shared. See also "Create A Shared Folder," earlier in this chapter. start Use net start to start a service. When you use it without options, it lists services that have already been started. statistics net statistics displays the statistics log for the local workstation or server service. When you use it without parameters, net statistics displays the services for which statistics are available. stop Use net stop to stop a service that has been started with net start. Note that stopping some services will cause others to be stopped, and some services cannot be stopped at all. time Probably the most interesting command in the bunch, net time is used to synchronize the computer's clock with that of another computer or domain. You can also use net time to set the NTP timeserver for the computer. use The net use command connects (or disconnects) a computer to a shared resource (shared with net share). When you use it without options, it lists the computer's active connections. user net user creates and modifies user accounts. When you use it without options, net user lists the user accounts for the computer. The user account information is stored in the same user accounts database used by Control Panel User Accounts; see "User Accounts," in Chapter 10. view net view displays a list of resources being shared on a remote computer. When you use it without options, it displays a list of computers in the current domain or network. Example To display your computer's current workgroup settings, type this: C:\>net config workstation Computer name \\Vista-Desktop Full Computer name Vista-Desktop User name Preston Workstation active on NetbiosSmb (000000000000) NetBT_Tcpip_{BB30432A-962C-4AB4-806D-35A14EE4E36C} (00123F7DD66F) Software version Windows Vista (TM) Ultimate Workstation domain WORKGROUP Logon domain Vista-Desktop COM Open Timeout (sec) 0 COM Send Count (byte) 16 COM Send Timeout (msec) 250 The command completed successfully. | Netsh: \windows\system32\netsh.exe Wide-ranging command-line tool with an extremely large number of available commands. To open Command Prompt netsh Usage netsh command [parameters] Description The netsh command contains many, many dozens of commands and useful features; to list them all is well beyond the scope of this book. Suffice it to say that if there's some networking information you want to get from the command line, or a task you want to perform, there's a reasonable chance that netsh can help. Many levels and sublevels of commands are available. There are many categories of commands used with netsh; type this command: Netsh command? to get the primary list, which follows: Dhcpclient Diagnostic and configuration tools relating to clients that use DHCP Firewall Diagnostic and configuration tools relating to your firewall ipsec Diagnostic and configuration tools relating to IPsec security lan Diagnostic and configuration tools for your LAN Wlan Diagnostic and configuration tools related to the WAN to which you're connected Example To display the current configuration of your firewall, type this: C:\> Netsh firewall show config Domain profile configuration: ------------------------------------------------------------------- Operational mode = Enable Exception mode = Enable Multicast/broadcast response mode = Enable Notification mode = Enable Allowed programs configuration for Domain profile: Mode Traffic direction Name / Program ------------------------------------------------------------------- Port configuration for Domain profile: Port Protocol Mode Traffic direction Name ------------------------------------------------------------------- Standard profile configuration (current): ------------------------------------------------------------------- Operational mode = Enable Exception mode = Enable Multicast/broadcast response mode = Enable Notification mode = Enable Service configuration for Standard profile: Mode Customized Name ------------------------------------------------------------------- Enable No File and Printer Sharing Enable No Network Discovery Allowed programs configuration for Standard profile: Mode Traffic direction Name / Program ------------------------------------------------------------------- Port configuration for Standard profile: Port Protocol Mode Traffic direction Name ------------------------------------------------------------------- ICMP configuration for Standard profile: Mode Type Description ------------------------------------------------------------------- Enable 8 Allow inbound echo request Log configuration: ------------------------------------------------------------------- File location = J:\Windows\system32\LogFiles\Firewall\pfirewall.log Max file size = 4096 KB Dropped packets = Disable Connections = Disable | NSLookup: \windows\system32\nslookup.exe Perform a DNS lookup; used to convert domain names to IP addresses and vice versa. To open Command Prompt nslookup Usage nslookup address Description When you type a web address into a browser's address bar and press Enter, Windows looks up the server name to determine the corresponding IP address. Then the IP address is used to initiate communication with the server. If the lookup fails, either because the name servers (the machines containing the DNS lookup tables) are down or because the specified domain does not exist, the connection attempt will fail as well. NSLookup is a simple tool that allows you to look up the IP address of any domain name or server name, as well as find the server name associated with any particular IP address. To use NSLookup, just specify the domain name at the prompt, like this: c:\> nslookup annoyances.org Name: annoyances.org Address: 209.133.53.130 Likewise, you can specify an IP address, and NSLookup will report the associated domain (called a reverse lookup): c:\> nslookup 209.204.146.22 Name: www.oreilly.com Address: 209.204.146.22 Notes Every time you initiate communication with a server, there will be a delay while Windows performs an NSLookup. To eliminate the delay, use NSLookup to determine the IP address and then replace the reference with the IP address. However, take care to do this only with IP addresses that you know will not change; it is not unusual for web and mail servers to occasionally change IP addresses (and some servers have multiple IP addresses). Most ISPs employ at least two nameservers, which are used for lookups for all of their customers. If one goes down, the other takes up the slack. However, if both nameservers are down for some reason, or even are just performing poorly, it can disable most Internet communication. If, however, you use IP addresses as described in the preceding note, you eliminate your susceptibility to this problem. Because NSLookup and the automatic lookups performed behind the scenes depend on your ISP's nameservers, they are susceptible to receiving outdated information. If you're having trouble accessing a particular server, you can use an NSLookup gateway to double-check your findings. An NSLookup gateway is simply a web-enabled version of NSLookup. You also can use it to perform lookups; however, if the gateway site is outside your ISP, it will use its own nameservers and therefore may provide more up-to-date information. To find such a site, perform a web search for "NSLookup gateway." NSLookup also performs a lookup of the IP address of your local computer and displays it before performing the requested lookup. In many cases, though, it will fail, which means that you may see an error message every time you run NSLookup (such as "Can't find server name . . . "). However, this won't interfere with NSLookup's primary function. Windows caches some lookups, which means that you may see outdated information. To flush the cache, type ipconfig /flushdns at the command prompt. See "Windows IP Configuration," later in this chapter, for more information. See also "Ping," "Tracert," and "Windows IP Configuration" |
Ping: \windows\system32\ping.exe Test the "reachability" of another computer on the network or across the Internet. To open Command Prompt ping Usage ping target [-t] [-a] [-n count] [-l size] [-f] [-w timeout] [-r count] [-s count] [-j host_list | -k host_list] [-i ttl] [-v tos] Description The primary function of Ping is to see whether another computer is "alive" and reachable. Ping works on local networks and across Internet connections. For example, type the following at a command prompt: ping oreilly.com and you'll get a report that looks something like this: Pinging oreilly.com [209.204.146.22] with 32 bytes of data: Reply from 209.204.146.22: bytes=32 time=78ms TTL=238 Reply from 209.204.146.22: bytes=32 time=31ms TTL=238 Reply from 209.204.146.22: bytes=32 time=15ms TTL=238 Reply from 209.204.146.22: bytes=32 time=78ms TTL=238 Ping statistics for 209.204.146.22: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 15ms, Maximum = 78ms, Average = 50ms Here, Ping sent out four pings (the default), reported the time it took for them to return (in milliseconds), and then displayed various statistics about the session. Ping is especially useful if you're having trouble contacting a server and you want to see whether the server is alive (running and accepting connections). If the server does not reply (meaning that it is down, the connection has been severed, or the server is ignoring Ping messages for security reasons), you'll see Request timed out. Ping accepts the following options: target The machine to ping; it can be the name of a computer on your network, an IP address (e.g., 209.204.146.22), or an Internet address (e.g., oreilly.com). -t Normally, Ping sends out four pings and then quits. Include the -t option to ping continually until you interrupt Ping by pressing Ctrl-C. Press Ctrl-Break to display statistics without interrupting. -a Resolve addresses to hostnames. -n count The number of pings to send; the default is four. -l size The size of the packets to send, in bytes; the default is 32 bytes. -f Turn on the "Don't Fragment" flag in packet. -w timeout The amount of time to wait, in milliseconds, before Ping gives up and displays Request timed out; the default is 500 milliseconds (half a second). -r count Display the route taken to reach the server (see "Tracert," later in this chapter). The count is the maximum number of hops to record and can range from one to nine. -s count Display a timestamp for count hops. -j host_list Impose a "loose" route (see the -r option) along which to ping. -k host-list Impose a "strict" route (see the -r option) along which to ping. -i ttl Specify the Time to Live (TTL); valid range is from 0 to 255. -v tos Specify the Type of Service (TOS); valid range is from 0 to 255. -R Use routing header to test reverse route also (IPv6 only). -S srcaddr Source address to use (IPv6 only). -4 Force using IPv4. -6 Force using IPv6. Notes The word ping comes from submarine lingo, when sonar was used to detect nearby objects, such as ships and other submarines. Pulses of sound were sent through the water; those that returned indicated the existence of an object off which the pulses were reflected. ping.exe works very similarly, except it sends packets rather than sonic pulses. See also "Tracert" and "NSLookup" | Route: \windows\system32\route.exe Manipulate the TCP/IP routing table for the local computer. To open Command Prompt route Usage route [-f] [-p] [command] [destination] [gateway] [mask netmask] [meTRic metric] [if interface] Description Routing tables provide information necessary to connect to other computers on a network or the Internet. Route accepts the following options: command Specifies one of four commands: print Prints a route (similar to netstat -r). The route print command is useful if you are having a problem (e.g., "Host unreachable" or "Request timed out") with the routes on your computer, because it will display all the different fields in the active route (see the example). add Adds a route to the routing table; used until the computer is shut down (unless the -p option is specified). delete Deletes a route from the routing table. change Modifies an existing route in the routing table. destination The remote computer that is reachable via gateway. -f Frees (clears) the routing tables of all gateway entries. If you use this in conjunction with one of the commands listed earlier, the tables are cleared prior to running the command. -p When you use this with the add command, -p makes a route persistent across boots of the system. If you don't specify -p, any route you add will be valid only until the computer is restarted. The -p option has no effect on other commands, as they're all persistent. gateway The gateway computer to be used for traffic going to destination. It is possible to use a hostname for the gateway, but it is safer to use an IP address because a hostname may resolve to multiple IP addresses. For example, you might type the following: route add 0.0.0.0 10.0.0.200 mask netmask Specifies the subnet mask for a destination. If you do not specify it, a mask of 255.255.255.255 is used (i.e., a "host route" to a single host, not a network). metric metric Specifies the metric or "hop count" for this route. The metric indicates which route is preferred when multiple routes to a destination exist and signifies the number of hops or gateways between the local computer and the gateway. The route with the lowest metric is used unless it is unavailable, in which case the route with the next lowest metric takes over. if interface Specifies the interface number for the specified route. If you type route print at the command prompt, you'll get something that looks like this: =========================================================================== Interface List 8 ...00 12 3f 7d d6 6f ...... Intel(R) PRO/1000 PL Network Connection 1 ........................... Software Loopback Interface 1 9 ...02 00 54 55 4e 01 ...... Teredo Tunneling Pseudo-Interface 10 ...00 00 00 00 00 00 00 e0 isatap.hsd1.ma.comcast.net. =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.107 20 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 192.168.1.0 255.255.255.0 On-link 192.168.1.107 276 192.168.1.107 255.255.255.255 On-link 192.168.1.107 276 192.168.1.255 255.255.255.255 On-link 192.168.1.107 276 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 192.168.1.107 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 192.168.1.107 276 =========================================================================== Persistent Routes: None IPv6 Route Table =========================================================================== Active Routes: If Metric Network Destination Gateway 9 18 ::/0 On-link 1 306 ::1/128 On-link 9 18 2001::/32 On-link 9 266 2001:0:4136:e378:1c9f:3624:3f57:fe94/128 On-link 8 276 fe80::/64 On-link 9 266 fe80::/64 On-link 10 281 fe80::5efe:192.168.1.107/128 On-link 8 276 fe80::1c84:e9d0:6b05:c9d5/128 On-link 9 266 fe80::1c9f:3624:3f57:fe94/128 On-link 1 306 ff00::/8 On-link 9 266 ff00::/8 On-link 8 276 ff00::/8 On-link =========================================================================== Persistent Routes: None The fields in this printout are as follows: Gateway The IP address of the gateway for the route. The gateway will know what to do with traffic for the specified network address. Interface The IP address of the network interface that the route will use when leaving the local computer. Metric The hop count or number of gateways between the local computer and the gateway. Netmask The mask to be applied to the network address. If the mask is 255.255.255.255, the route is a host route and refers to a single machine, not a network. Network Address Any network matched by this address should use this route. The default route is all zeros and is used if no other route is found. Notes See also "Tracert" |
Tracert: \windows\system32\tracert.exe Trace the route of communication across the Internet. To open Command Prompt tracert Usage tracert [-d] [-h max_hops] [-j list] [-w timeout] target Description The Internet is a decentralized interconnection of computers. This means that there is rarely, if ever, a direct connection between two computers on the Internet. Instead, information is transferred across several computers, if not dozens, to make it from one place to another. The further the geographical distance between two machines, the greater the likelihood that there will be more hubs and other intermediate computers along the way. You use Tracert to list all the computers encountered on the journey from one computer to another. Type the following at a command prompt (while connected to the Internet) to trace the route from your computer to microsoft.com: tracert microsoft.com Tracert accepts the following options: target The name or IP address of the computer to contact. -d If you specify an IP address, Tracert will attempt to resolve the hostname (using DNS, which could slow things down). Include the -d option to skip this step. -h max_hops Specifies the maximum number of "hops" (servers along the route) to display before giving up; the default is 30 hops. -j host-list Loosely imposes a route to follow, where list is a list of hosts (IPv4 only). -w timeout Sets the amount of time to wait (in milliseconds) for each reply. -R Traces the round-trip path (IPv6 only). -S scaddr Specifies the source address to use (IPv6 only). -4 Forces it to use IPv4. -6 Forces it to use IPv6. Notes Tracert has many uses, but probably the most valuable on a day-to-day basis is troubleshooting. For example, if you are trying to contact a web server, email server, or any other machine on the Internet, and it does not appear to be responding, you can perform a Tracert to see whether it is the fault of the actual machine or one of the hosts along the way. If it turns out to be one of the hosts along the way, your network administrator or ISP may be able to use your Tracert report to help solve the problem. See also "NSLookup" and "Ping" |
Windows IP Configuration: \windows\system32\ipconfig.exe Display the current IP address(es) of the active connection(s). To open Command Prompt ipconfig Usage ipconfig [/command] [adapter] Description The Windows IP Configuration tool, used without any options, displays your computer's current IP address, subnet mask, and default gateway. Knowing your computer's IP address is important for many reasons, such as allowing other users to connect to you by using Remote Desktop Connection or calling you with Microsoft NetMeeting. Windows IP Configuration takes the following parameters: adapter Used with some of the commands in this list, adapter specifies the name of a network connection (see "Manage Network Connections," earlier in this chapter) on which to act. Adapter can contain wildcards, such as *. Omit adapter (if allowed) to act on the default connection. /all Displays all available configuration information. /allcompartments Displays detailed information about all compartments. /release [ adapter] Releases the IPv4 address(es) for the specified connection, effectively disconnecting that connection from all network communication. Use /renew to reestablish communication. /release6 [ adapter] Releases the IPv6 address(es) for the specified connection, effectively disconnecting that connection from all network communication. Use /renew6 to reestablish communication. /renew [ adapter] Renews the IPv4 address for the specified adapter, effectively reestablishing communication for the connection. /renew6 [ adapter] Renews the IPv6 address for the specified adapter, effectively reestablishing communication for the connection. /flushdns Purges the DNS Resolver cache. See "NSLookup," earlier in this chapter, for details. See the entry in this list for /displaydns to show the contents of the DNS cache. /registerdns Refreshes all DHCP leases and reregisters DNS names. /displaydns Displays the contents of the DNS Resolver Cache (see /flushdns). /showclassid adapter Displays all the DHCP class IDs allowed for adapter. /setclassid adapter [ classid] Modifies the DHCP class ID for adapter. Notes Windows Vista supports IPv6 and its longer IP address format, and reports to you both the IPv4 and IPv6 addresses. The IP address of any given network connection is also shown in the connection's Status window, which you can view by double-clicking the connection in the Network Connections window. See "Manage Network Connections," earlier in this chapter, for details. | |