Network Commands Commands specific to Windows: hostname ipconfig nbtstat net tracert Commands used by Linux, Unix and Windows arp finger ftp hostname ipconfig lpq lpr msg nbtstat net nslookup ping rsh telnet tftp Commands used by Linux and Unix ifconfig traceroute ------------------------------------------------------------------------------ J:\>finger Displays information about a user on a specified system running the Finger service. Output varies based on the remote system. FINGER [-l] [user]@host [...] -l Displays information in long list format. user Specifies the user you want information about. Omit the user parameter to display information about all users on the specified host. @host Specifies the server on the remote system whose users you want information about. ----------------------------------------------------------------------------- J:\>ftp -help Transfers files to and from a computer running an FTP server service (sometimes called a daemon). Ftp can be used interactively. FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host] -v Suppresses display of remote server responses. -n Suppresses auto-login upon initial connection. -i Turns off interactive prompting during multiple file transfers. -d Enables debugging. -g Disables filename globbing (see GLOB command). -s:filename Specifies a text file containing FTP commands; the commands will automatically run after FTP starts. -a Use any local interface when binding data connection. -A login as anonymous. -w:buffersize Overrides the default transfer buffer size of 4096. host Specifies the host name or IP address of the remote host to connect to. Notes: - mget and mput commands take y/n/q for yes/no/quit. - Use Control-C to abort commands. ----------------------------------------------------------------------------- J:\>hostname computer1 hostname returns the name of the local host. ----------------------------------------------------------------------------- ifconfig Specific to Unix and Linux. Does much the same as ipconfig but gives more information. It also can be used to set configuration parameters for a network interface and to start and stop the interface. For more info under Unix or Linux, enter: man ifconfig ----------------------------------------------------------------------------- J:\>ipconfig -? USAGE: ipconfig [/? | /all | /renew [adapter] | /release [adapter] | /flushdns | /displaydns | /registerdns | /showclassid adapter | /setclassid adapter [classid] ] where adapter Connection name (wildcard characters * and ? allowed, see examples) Options: /? Display this help message /all Display full configuration information. /release Release the IP address for the specified adapter. /renew Renew the IP address for the specified adapter. /flushdns Purges the DNS Resolver cache. /registerdns Refreshes all DHCP leases and re-registers DNS names /displaydns Display the contents of the DNS Resolver Cache. /showclassid Displays all the dhcp class IDs allowed for adapter. /setclassid Modifies the dhcp class id. The default is to display only the IP address, subnet mask and default gateway for each adapter bound to TCP/IP. For Release and Renew, if no adapter name is specified, then the IP address leases for all adapters bound to TCP/IP will be released or renewed. For Setclassid, if no ClassId is specified, then the ClassId is removed. Examples: > ipconfig ... Show information. > ipconfig /all ... Show detailed information > ipconfig /renew ... renew all adapters > ipconfig /renew EL* ... renew any connection that has its name starting with EL > ipconfig /release *Con* ... release all matching connections, eg. "Local Area Connection 1" or "Local Area Connection 2" ------------------------------------------------------------------------------- J:\>lpq Displays the state of a remote lpd queue. Usage: lpq -Sserver -Pprinter [-l] Options: -S server Name or ipaddress of the host providing lpd service -P printer Name of the print queue -l verbose output -------------------------------------------------------------------------------- J:\>lpr Sends a print job to a network printer Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x] [-d] filena me Options: -S server Name or ipaddress of the host providing lpd service -P printer Name of the print queue -C class Job classification for use on the burst page -J job Job name to print on the burst page -o option Indicates type of the file (by default assumes a text file) Use "-o l" for binary (e.g. postscript) files -x Compatibility with SunOS 4.1.x and prior -d Send data file first --------------------------------------------------------------------------------- J:\>msg Send a message to a user. MSG {username | sessionname | sessionid | @filename | *} [/SERVER:servername] [/TIME:seconds] [/V] [/W] [message] username Identifies the specified username. sessionname The name of the session. sessionid The ID of the session. @filename Identifies a file containing a list of usernames, sessionnames, and sessionids to send the message to. * Send message to all sessions on specified server. /SERVER:servername server to contact (default is current). /TIME:seconds Time delay to wait for receiver to acknowledge msg. /V Display information about actions being performed. /W Wait for response from user, useful with /V. message Message to send. If none specified, prompts for it or reads from stdin. ------------------------------------------------------------------------------- J:\>nslookup url | ip-address nslookup sends a lookup request to the nearest dns server. It returns the ip-address for a url request or the url for an ip-address. ------------------------------------------------------------------------------- J:\>rsh Runs commands on remote hosts running the RSH service. RSH host [-l username] [-n] command host Specifies the remote host on which to run command. -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 NULL. command Specifies the command to run. ------------------------------------------------------------------------------- J:\>tracert Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name Options: -d Do not resolve addresses to hostnames. -h maximum_hops Maximum number of hops to search for target. -j host-list Loose source route along host-list. -w timeout Wait timeout milliseconds for each reply. --------------------------------------------------------------- Specific to any modern operating system: arp.exe Displays and modifies the IP-to-Physical address translation tables used by address resolution protocol (ARP). ARP -s inet_addr eth_addr [if_addr] ARP -d inet_addr [if_addr] ARP -a [inet_addr] [-N if_addr] -a Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP, entries for each ARP table are displayed. -g Same as -a. inet_addr Specifies an internet address. -N if_addr Displays the ARP entries for the network interface specified by if_addr. -d Deletes the host specified by inet_addr. -s Adds the host and associates the Internet address inet_addr with the Physical address eth_addr. The Physical address is given as 6 hexadecimal bytes separated by hyphens. The entry is permanent. eth_addr Specifies a physical address. if_addr If present, this specifies the Internet address of the interface whose address translation table should be modified. If not present, the first applicable interface will be used. Example: > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry. > arp -a .... Displays the arp table. --------------------------------------------------------------------------------- ftp file transfer program commands are: ! delete literal prompt send ? debug ls put status append dir mdelete pwd trace ascii disconnect mdir quit type bell get mget quote user binary glob mkdir recv verbose bye hash mls remotehelp cd help mput rename close lcd open rmdir --------------------------------------------------------------------------------- Nbtstat.exe Displays protocol statistics and current TCP/IP connections using NBT(NetBIOS ov er TCP/IP). NBTSTAT [-a RemoteName] [-A IP address] [-c] [-n] [-r] [-R] [-s] [S] [interval] ] -a (adapter status) Lists the remote machine's name table given its name -A (Adapter status) Lists the remote machine's name table given its IP address. -c (cache) Lists the remote name cache including the IP addresses -n (names) Lists local NetBIOS names. -r (resolved) Lists names resolved by broadcast and via WINS -R (Reload) Purges and reloads the remote cache name table -S (Sessions) Lists sessions table with the destination IP addresses -s (sessions) Lists sessions table converting destination IP addresses to host names via the hosts file. RemoteName Remote host machine name. IP address Dotted decimal representation of the IP address. interval Redisplays selected statistics, pausing interval seconds between each display. Press Ctrl+C to stop redisplaying statistics. --------------------------------------------------------------------------------- Net.exe For more information about a specific Microsoft NET command, type the command name followed by /? (for example, NET VIEW /?). NET CONFIG Displays your current workgroup settings. NET DIAG Runs the Microsoft Network Diagnostics program to display diagnostic information about your network. NET HELP Provides information about commands and error messages. NET INIT Loads protocol and network-adapter drivers without binding them to Protocol Manager. NET LOGOFF Breaks the connection between your computer and the shared resources to which it is connected. NET LOGON Identifies you as a member of a workgroup. NET PASSWORD Changes your logon password. NET PRINT Displays information about print queues and controls print jobs. NET START Starts services. NET STOP Stops services. NET TIME Displays the time on or synchronizes your computer's clock with the clock on a Microsoft Windows for Workgroups, Windows NT, Windows 95, or NetWare time server. NET USE Connects to or disconnects from a shared resource or displays information about connections. NET VER Displays the type and version number of the workgroup redirector you are using. NET VIEW Displays a list of computers that share resources or a list of shared resources on a specific computer. The command was completed successfully. -------------------------------------------------------------------------- netstat E:\Windir>netstat --h Displays protocol statistics and current TCP/IP network connections. NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval] -a Displays all connections and listening ports. -e Displays Ethernet statistics. This may be combined with the -s option. -n Displays addresses and port numbers in numerical form. -p proto Shows connections for the protocol specified by proto; proto may be TCP or UDP. If used with the -s option to display per-protocol statistics, proto may be TCP, UDP, or IP. -r Displays the routing table. -s Displays per-protocol statistics. By default, statistics are shown for TCP, UDP and IP; the -p option may be used to specify a subset of the default. interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If omitted, netstat will print the current configuration information once. ------------------------------------------------------------------------------ ping Ping sends icmp messages to a remote computer for testing connectivity to that remote computer. Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet. -i TTL Time To Live. -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply. ------------------------------------------------------------------------------- Route.exe Manipulates network routing tables. ROUTE [-f] [command [destination] [MASK netmask] [gateway] [METRIC metric]] -f Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command. command Must be one of four: PRINT Prints a route ADD Adds a route DELETE Deletes a route CHANGE Modifies an existing route destination Specifies the destination host. MASK Specifies that the next parameter is the 'netmask' value. netmask Specifies a subnet mask value to be associated with this route entry. If not specified, it defaults to 255.255.255.255. gateway Specifies gateway. METRIC Specifies that the next paramenter 'metric' is the cost for this destination All symbolic names used for destination are looked up in the network database file NETWORKS. The symbolic names for gateway are looked up in the host name database file HOSTS. If the command is PRINT or DELETE, wildcards may be used for the destination and gateway, or the gateway argument may be omitted. Diagnostic Notes: Invalid MASK generates an error, that is when (DEST & MASK) != DEST. Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 The route addition failed: 87 Examples: > route PRINT > route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 ^destination ^mask ^gateway ^metric > route PRINT > route DELETE 157.0.0.0 > route PRINT ------------------------------------------------------------------------------ Telnet.exe Telnet opens a terminal session to a remote host. You can then enter commands to that remote host as if your were sitting at a terminal connected to that host. J:\>telnet -? telnet [-a][-e escape char][-f log file][-l user][-t term][host [port]] -a Attempt automatic logon. Same as -l option except uses the currently logged on user's name. -e Escape character to enter telnet client prompt. -f File name for client side logging -l Specifies the user name to log in with on the remote system. Requires that the remote system support the TELNET ENVIRON option. -t Specifies terminal type. Supported term types are vt100, vt52, ansi and vtnt only. host Specifies the hostname or IP address of the remote computer to connect to. port Specifies a port number or service name. ---------------------------------------------------------------------------- >tftp -? Transfers files to and from a remote computer running the TFTP service. TFTP [-i] host [GET | PUT] source [destination] -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. host Specifies the local or remote host. GET Transfers the file destination on the remote host to the file source on the local host. PUT Transfers the file source on the local host to the file destination on the remote host. source Specifies the file to transfer. destination Specifies where to transfer the file. ------------------------------------------------------------------------------ J:\>traceroute Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name Options: -d Do not resolve addresses to hostnames. -h maximum_hops Maximum number of hops to search for target. -j host-list Loose source route along host-list. -w timeout Wait timeout milliseconds for each reply.