『楼 主』:
DOS下常用的相关网络命令
使用 LLM 解释/回答一下
DOS下常用的相关网络命令Sample Text
Arp
显示和修改“地址解析协议”(ARP) 所使用的到以太网的 IP 或令牌环物理地址翻译表。该命令只有在安装了 TCP/IP 协议之后才可用。
arp -a ]
arp -d inet_addr
arp -s inet_addr ether_addr
参数
-a
通过询问 TCP/IP 显示当前 ARP 项。如果指定了 inet_addr,则只显示指定计算机的 IP 和物理地址。
-g
与 -a 相同。
inet_addr
以加点的十进制标记指定 IP 地址。
-N
显示由 if_addr 指定的网络界面 ARP 项。
if_addr
指定需要修改其地址转换表接口的 IP 地址(如果有的话)。如果不存在,将使用第一个可适用的接口。
-d
删除由 inet_addr 指定的项。
-s
在 ARP 缓存中添加项,将 IP 地址 inet_addr 和物理地址 ether_addr 关联。物理地址由以连字符分隔的 6 个十六进制字节给定。使用带点的十进制标记指定 IP 地址。项是永久性的,即在超时到期后项自动从缓存删除。
ether_addr
指定物理地址。
Finger
在运行 Finger 服务的指定系统上显示有关用户的信息。根据远程系统输出不同的变量。该命令只有在安装了 TCP/IP 协议之后才可用。
finger @computer
参数
-l
以长列表格式显示信息。
user
指定要获得相关信息的用户。省略用户参数以显示指定计算机上所有用户的信息:
@computer
Ftp
将文件传送到正在运行 FTP 服务的远程计算机或从正在运行 FTP 服务的远程计算机传送文件(有时称作 daemon)。Ftp 可以交互使用。单击“相关主题”列表中的“ftp 命令”以获得可用的“ftp”子命令描述。该命令只有在安装了 TCP/IP 协议之后才可用。Ftp 是一种服务,一旦启动,将创建在其中可以使用 ftp 命令的子环境,通过键入 quit 子命令可以从子环境返回到 Windows 2000 命令提示符。当 ftp 子环境运行时,它由 ftp 命令提示符代表。
ftp
参数
-v
禁止显示远程服务器响应。
-n
禁止自动登录到初始连接。
-i
多个文件传送时关闭交互提示。
-d
启用调试、显示在客户端和服务器之间传递的所有 ftp 命令。
-g
禁用文件名组,它允许在本地文件和路径名中使用通配符字符(* 和 ?)。(请参阅联机“命令参考”中的 glob 命令。)
-s: filename
指定包含 ftp 命令的文本文件;当 ftp 启动后,这些命令将自动运行。该参数中不允许有空格。使用该开关而不是重定向 (> )。
-a
在捆绑数据连接时使用任何本地接口。
-w:windowsize
替代默认大小为 4096 的传送缓冲区。
computer
指定要连接到远程计算机的计算机名或 IP 地址。如果指定,计算机必须是行的最后一个参数。
Nbtstat
该诊断命令使用 NBT(TCP/IP 上的 NetBIOS)显示协议统计和当前 TCP/IP 连接。该命令只有在安装了 TCP/IP 协议之后才可用。
nbtstat
参数
-a remotename
使用远程计算机的名称列出其名称表。
-A IP address
使用远程计算机的 IP 地址并列出名称表。
-c
给定每个名称的 IP 地址并列出 NetBIOS 名称缓存的内容。
-n
列出本地 NetBIOS 名称。“已注册”表明该名称已被广播 (Bnode) 或者 WINS(其他节点类型)注册。
-R
清除 NetBIOS 名称缓存中的所有名称后,重新装入 Lmhosts 文件。
-r
列出 Windows 网络名称解析的名称解析统计。在配置使用 WINS 的 Windows 2000 计算机上,此选项返回要通过广播或 WINS 来解析和注册的名称数。
-S
显示客户端和服务器会话,只通过 IP 地址列出远程计算机。
-s
显示客户端和服务器会话。尝试将远程计算机 IP 地址转换成使用主机文件的名称。
interval
重新显示选中的统计,在每个显示之间暂停 interval 秒。按 CTRL+C 停止重新显示统计信息。如果省略该参数,nbtstat 打印一次当前的配置信息。
Netstat
显示协议统计和当前的 TCP/IP 网络连接。该命令只有在安装了 TCP/IP 协议后才可以使用。
netstat
参数
-a
显示所有连接和侦听端口。服务器连接通常不显示。
-e
显示以太网统计。该参数可以与 -s 选项结合使用。
-n
以数字格式显示地址和端口号(而不是尝试查找名称)。
-s
显示每个协议的统计。默认情况下,显示 TCP、UDP、ICMP 和 IP 的统计。-p 选项可以用来指定默认的子集。
-p protocol
显示由 protocol 指定的协议的连接;protocol 可以是 tcp 或 udp。如果与 -s 选项一同使用显示每个协议的统计,protocol 可以是 tcp、udp、icmp 或 ip。
-r
显示路由表的内容。
interval
重新显示所选的统计,在每次显示之间暂停 interval 秒。按 CTRL+B 停止重新显示统计。如果省略该参数,netstat 将打印一次当前的配置信息。
Ping
验证与远程计算机的连接。该命令只有在安装了 TCP/IP 协议后才可以使用。
ping | ] destination-list
参数
-t
Ping 指定的计算机直到中断。
-a
将地址解析为计算机名。
-n count
发送 count 指定的 ECHO 数据包数。默认值为 4。
-l length
发送包含由 length 指定的数据量的 ECHO 数据包。默认为 32 字节;最大值是 65,527。
-f
在数据包中发送“不要分段”标志。数据包就不会被路由上的网关分段。
-i ttl
将“生存时间”字段设置为 ttl 指定的值。
-v tos
将“服务类型”字段设置为 tos 指定的值。
-r count
在“记录路由”字段中记录传出和返回数据包的路由。count 可以指定最少 1 台,最多 9 台计算机。
-s count
指定 count 指定的跃点数的时间戳。
-j computer-list
利用 computer-list 指定的计算机列表路由数据包。连续计算机可以被中间网关分隔(路由稀疏源)IP 允许的最大数量为 9。
-k computer-list
利用 computer-list 指定的计算机列表路由数据包。连续计算机不能被中间网关分隔(路由严格源)IP 允许的最大数量为 9。
-w timeout
指定超时间隔,单位为毫秒。
destination-list
指定要 ping 的远程计算机。
Rcp
在 Windows 2000 计算机和运行远程外壳端口监控程序 rshd 的系统之间复制文件。rcp 命令是一个连接命令,从 Windows 2000 计算机发出该命令时,也可以用于其他传输在两台运行 rshd 的计算机之间复制文件。rshd 端口监控程序可以在 UNIX 计算机上使用,而在 Windows 2000 上不能使用,所以 Windows 2000 计算机仅可以作为发出命令的系统参与。远程计算机必须也通过运行 rshd 提供 rcp 实用程序。
rcp source1 source2 ... sourceN destination
参数
-a
指定 ASCII 传输模式。此模式在传出文件上将回车/换行符转换为回车符,在传入文件中将换行符转换为回车/换行符。该模式为默认的传输模式。
-b
指定二进制图像传输模式。没有执行回车/换行符转换。
-h
传输 Windows 2000 计算机上标记为隐藏属性的源文件。如果没有该选项,在 rcp 命令行上指定隐藏文件的效果与文件不存在一样。
-r
将源的所有子目录内容递归复制到目标。source 和 destination 都必须是目录,虽然即使源不是目录,使用 -r 也能够工作。但将没有递归。
source 和 destination
格式必须为 :]filename。如果忽略了 :] 部分,计算机将假定为本地计算机。如果省略了 部分,将使用当前登录的 Windows 2000 用户名。如果使用了完全合格的计算机名,其中包含句点 (.) 分隔符,则必须包含 。否则,计算机名的最后部分将解释为用户名。如果指定了多个源文件,则 destination 必须是目录。
如果文件名不是以 UNIX 的正斜杠 (/) 或 Windows 2000 系统的反斜杠 (\) 打头,则假定相对于当前的工作目录。在 Windows 2000 中,这是发出命令的目录。在远程系统中,这是远程用户的登录目录。句点 (.) 表示当前的目录。在远程路径中使用转义字符(\、" 或 '),以便在远程计算机中使用通配符。
Rexec
在运行 REXEC 服务的远程计算机上运行命令。rexec 命令在执行指定命令前,验证远程计算机上的用户名,只有安装了 TCP/IP 协议后才可以使用该命令。
rexec computer command
参数
computer
指定要运行 command 的远程计算机。
-l username
指定远程计算机上的用户名。
-r
将 rexec 的输入重定向到 NULL。
command
指定要运行的命令。
Route
控制网络路由表。该命令只有在安装了 TCP/IP 协议后才可以使用。
route ]
参数
-f
清除所有网关入口的路由表。如果该参数与某个命令组合使用,路由表将在运行命令前清除。
-p
该参数与 add 命令一起使用时,将使路由在系统引导程序之间持久存在。默认情况下,系统重新启动时不保留路由。与 print 命令一起使用时,显示已注册的持久路由列表。忽略其他所有总是影响相应持久路由的命令。
command
指定下列的一个命令。
命令 目的
print 打印路由
add 添加路由
delete 删除路由
change 更改现存路由
destination
指定发送 command 的计算机。
mask subnetmask
指定与该路由条目关联的子网掩码。如果没有指定,将使用 255.255.255.255。
gateway
指定网关。
名为 Networks 的网络数据库文件和名为 Hosts 的计算机名数据库文件中均引用全部 destination 或 gateway 使用的符号名称。如果命令是 print 或 delete,目标和网关还可以使用通配符,也可以省略网关参数。
metric costmetric
指派整数跃点数(从 1 到 9999)在计算最快速、最可靠和(或)最便宜的路由时使用。
Rsh
在运行 RSH 服务的远程计算机上运行命令。该命令只有在安装了 TCP/IP 协议后才可以使用。
rsh computer command
参数
computer
指定运行 command 的远程计算机。
-l username
指定远程计算机上使用的用户名。如果省略,则使用登录的用户名。
-n
将 rsh 的输入重定向到 NULL。
command
指定要运行的命令。
Tftp
将文件传输到正在运行 TFTP 服务的远程计算机或从正在运行 TFTP 服务的远程计算机传输文件。该命令只有在安装了 TCP/IP 协议后才可以使用。
tftp computer source
参数
-i
指定二进制图像传送模式(也称为“八位字节”)。在二进制图像模式中,文件一个字节接一个字节地逐字移动。在传送二进制文件时使用该模式。
如果省略了 -i,文件将以 ASCII 模式传送。这是默认的传送模式。此模式将 EOL 字符转换为 UNIX 的回车符和个人计算机的回车符/换行符。在传送文本文件时应使用此模式。如果文件传送成功,将显示数据传输率。
computer
指定本地或远程计算机。
put
将本地计算机上的文件 destination 传送到远程计算机上的文件 source。
get
将远程计算机上的文件 destination 传送到本地计算机上的文件 source。
如果将本地计算机上的文件 file-two 传送到远程计算机上的文件 file-one,请指定 put。如果将远程计算机上的文件 file-two 传送到远程计算机上的文件 file-one,请指定 get。
因为 tftp 协议不支持用户身份验证,所以用户必须登录,并且文件在远程计算机上必须可以写入。
source
指定要传送的文件。如果本地文件指定为 -,则远程文件在 stdout 上打印出来(如果获取),或从 stdin(如果放置)读取。
destination
指定将文件传送到的位置。如果省略了 destination,将假定与 source 同名。
Tracert
该诊断实用程序将包含不同生存时间 (TTL) 值的 Internet 控制消息协议 (ICMP) 回显数据包发送到目标,以决定到达目标采用的路由。要在转发数据包上的 TTL 之前至少递减 1,必需路径上的每个路由器,所以 TTL 是有效的跃点计数。数据包上的 TTL 到达 0 时,路由器应该将“ICMP 已超时”的消息发送回源系统。Tracert 先发送 TTL 为 1 的回显数据包,并在随后的每次发送过程将 TTL 递增 1,直到目标响应或 TTL 达到最大值,从而确定路由。路由通过检查中级路由器发送回的“ICMP 已超时”的消息来确定路由。不过,有些路由器悄悄地下传包含过期 TTL 值的数据包,而 tracert 看不到。
tracert target_name
参数
/d
指定不将地址解析为计算机名。
-h maximum_hops
指定搜索目标的最大跃点数。
-j computer-list
指定沿 computer-list 的稀疏源路由。
-w timeout
每次应答等待 timeout 指定的微秒数。
target_name
目标计算机的名称。
Last edited by oookillooo on 2007-2-8 at 09:41 AM ]
Common Network Commands under DOSSample Text
Arp
Displays and modifies the address translation table used by the Address Resolution Protocol (ARP) for Ethernet or Token Ring physical addresses. This command is only available after the TCP/IP protocol is installed.
arp -a ]
arp -d inet_addr
arp -s inet_addr ether_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 computer are displayed.
-g
Same as -a.
inet_addr
Specifies an IP address in dotted-decimal notation.
-N
Displays ARP entries for the network interface specified by if_addr.
if_addr
Specifies the IP address of the interface whose address translation table should be modified (if any). If not specified, the first applicable interface is used.
-d
Deletes the entry specified by inet_addr.
-s
Adds an entry to the ARP cache, associating the IP address inet_addr with the physical address ether_addr. The physical address is given by 6 hexadecimal bytes separated by hyphens. Use dotted-decimal notation to specify the IP address. The entry is permanent, meaning it is not automatically deleted from the cache after the timeout expires.
ether_addr
Specifies the physical address.
Finger
Displays information about users on the specified system running the Finger service. Output varies depending on the remote system. This command is only available after the TCP/IP protocol is installed.
finger @computer
Parameters
-l
Displays information in long format.
user
Specifies the user for whom information is to be obtained. Omit the user parameter to display information for all users on the specified computer:
@computer
Ftp
Transfers files to or from a remote computer running an FTP service (sometimes called a daemon). Ftp can be used interactively. Click "Related Topics" and then "ftp commands" to get descriptions of available ftp subcommands. This command is only available after the TCP/IP protocol is installed. Ftp is a service that, once started, creates a sub-environment where ftp commands can be used. You can return to the Windows 2000 command prompt from this sub-environment by typing the quit subcommand. When the ftp sub-environment is running, it is represented by the ftp command prompt.
ftp
Parameters
-v
Suppresses display of remote server responses.
-n
Suppresses automatic logon to the 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 grouping, which allows wildcard characters (* and ?) in local filenames and pathnames. (See the glob command in the online "Command Reference.")
-s: filename
Specifies a text file containing ftp commands; these commands are automatically run when ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>).
-a
Uses any local interface when binding the data connection.
-w:windowsize
Overrides the default transfer buffer size of 4096.
computer
Specifies the computer name or IP address of the remote computer to connect to. If specified, computer must be the last parameter on the line.
Nbtstat
This diagnostic command uses NBT (NetBIOS over TCP/IP) to display protocol statistics and current TCP/IP connections. This command is only available after the TCP/IP protocol is installed.
nbtstat
Parameters
-a remotename
Lists the name table for the remote computer using its name.
-A IP address
Lists the name table for the remote computer using its IP address.
-c
Lists the contents of the NetBIOS name cache, giving the IP address for each name.
-n
Lists local NetBIOS names. "Registered" indicates that the name has been registered by broadcast (Bnode) or WINS (other node types).
-R
Reloads the Lmhosts file after clearing all names from the NetBIOS name cache.
-r
Lists name resolution statistics for Windows network name resolution. On a Windows 2000 computer configured to use WINS, this option returns the number of names resolved and registered by broadcast or WINS.
-S
Displays client and server sessions, listing remote computers only by IP address.
-s
Displays client and server sessions. Attempts to convert remote computer IP addresses to names using the host file.
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.
Netstat
Displays protocol statistics and current TCP/IP network connections. This command is only available after the TCP/IP protocol is installed.
netstat
Parameters
-a
Displays all connections and listening ports. Server connections are not usually displayed.
-e
Displays Ethernet statistics. This parameter can be combined with the -s option.
-n
Displays addresses and port numbers in numerical format (instead of trying to look up names).
-s
Displays statistics for each protocol. By default, statistics for TCP, UDP, ICMP, and IP are displayed. The -p option can be used to specify a default subset.
-p protocol
Displays connections for the protocol specified by protocol; protocol can be tcp or udp. If used with the -s option to display statistics for each protocol, 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+B to stop redisplaying statistics. If this parameter is omitted, netstat prints the current configuration information once.
Ping
Verifies connections to remote computers. This command is only available after the TCP/IP protocol is installed.
ping | ] destination-list
Parameters
-t
Pings the specified computer until interrupted.
-a
Resolves addresses to computer names.
-n count
Sends count specified ECHO packets. The default is 4.
-l length
Sends ECHO packets containing the amount of data specified by length. The default is 32 bytes; the maximum is 65,527.
-f
Sends the "Don't Fragment" flag in the packet. The packet will not be fragmented by gateways along 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 for outgoing and returning packets in the "Record Route" field. count can specify a minimum of 1 and a maximum of 9 computers.
-s count
Specifies a time stamp for the number of hops specified by count.
-j computer-list
Routes packets using the list of computers specified by computer-list. Intermediate gateways can separate consecutive computers (sparse source route). The maximum number allowed by IP is 9.
-k computer-list
Routes packets using the list of computers specified by computer-list. Intermediate gateways cannot separate consecutive computers (strict source route). The maximum number allowed by IP is 9.
-w timeout
Specifies the timeout interval in milliseconds.
destination-list
Specifies the remote computer to ping.
Rcp
Copies files between Windows 2000 computers and systems running the remote shell port monitor rshd. The rcp command is a connection command that can also be used to copy files between two computers running rshd when issued from a Windows 2000 computer. The rshd port monitor can be used on UNIX computers but not on Windows 2000, so Windows 2000 computers can only participate as the system issuing the command. The remote computer must also provide the rcp utility by running rshd.
rcp source1 source2 ... sourceN destination
Parameters
-a
Specifies ASCII transfer mode. This mode converts carriage return/linefeed characters to carriage returns on outgoing files and linefeeds to carriage return/linefeeds on incoming files. This mode is the default transfer mode.
-b
Specifies binary image transfer mode. No carriage return/linefeed conversion is performed.
-h
Transfers source files marked as hidden attributes on the Windows 2000 computer. Without this option, specifying a hidden file on the rcp command line has the same effect as the file not existing.
-r
Recursively copies the contents of all subdirectories of source to destination. Both source and destination must be directories, although using -r works even if source is not a directory. But there will be no recursion.
source and destination
The format must be :]filename. If the :] part is omitted, the computer is assumed to be the local computer. If the part is omitted, the current logged-on Windows 2000 username is used. If a fully qualified computer name containing period (.) separators is used, must be included. Otherwise, the last part of the computer name will be interpreted as the username. If multiple source files are specified, destination must be a directory.
If the filename does not start with a UNIX forward slash (/) or a Windows 2000 system backslash (\), it is assumed to be relative to the current working directory. In Windows 2000, this is the directory from which the command is issued. In the remote system, this is the remote user's login directory. A period (.) represents the current directory. Use escape characters (\, " or ') in remote paths to use wildcards on the remote computer.
Rexec
Runs a command on a remote computer running the REXEC service. The rexec command verifies the username on the remote computer before executing the specified command and is only available after the TCP/IP protocol is installed.
rexec computer command
Parameters
computer
Specifies the remote computer on which to run command.
-l username
Specifies the username on the remote computer.
-r
Redirects the input of rexec to NULL.
command
Specifies the command to run.
Route
Controls the network routing table. This command is only available after the TCP/IP protocol is installed.
route ]
Parameters
-f
Clears the routing table of all gateway entries. If this parameter is combined with a command, the routing table is cleared before the command is run.
-p
When used with the add command, makes the route persistent between system boots. By default, routes are not retained when the system restarts. When used with the print command, displays a list of registered persistent routes. Ignores all other commands that always affect the corresponding persistent route.
command
Specifies one of the following commands.
Command Purpose
print Prints routes
add Adds a route
delete Deletes a route
change Changes an existing route
destination
Specifies the computer to which the command is sent.
mask subnetmask
Specifies the subnet mask associated with this route entry. If not specified, 255.255.255.255 is used.
gateway
Specifies the gateway.
Symbolic names used for all destination or gateway are referenced in the network database file named Networks and the computer name database file named Hosts. If the command is print or delete, the destination and gateway can also use wildcards, and the gateway parameter can be omitted.
metric costmetric
Assigns an integer hop count (from 1 to 9999) used when calculating the fastest, most reliable, and/or cheapest route.
Rsh
Runs a command on a remote computer running the RSH service. This command is only available after the TCP/IP protocol is installed.
rsh computer command
Parameters
computer
Specifies the remote computer on which to run command.
-l username
Specifies the username used on the remote computer. If omitted, the logged-on username is used.
-n
Redirects the input of rsh to NULL.
command
Specifies the command to run.
Tftp
Transfers files to or from a remote computer running a TFTP service. This command is only available after the TCP/IP protocol is installed.
tftp computer source
Parameters
-i
Specifies binary image transfer mode (also called "octet"). In binary image mode, files are transferred one byte at a time. Use this mode when transferring binary files.
If -i is omitted, files are transferred in ASCII mode. This is the default transfer mode. This mode converts EOL characters to UNIX carriage returns and personal computer carriage return/linefeeds. Use this mode when transferring text files. If the file transfer is successful, the data transfer rate is displayed.
computer
Specifies the local or remote computer.
put
Transfers the file destination on the local computer to the file source on the remote computer.
get
Transfers the file destination on the remote computer to the file source on the local computer.
Specify put if you want to transfer the file file-two on the local computer to the file file-one on the remote computer. Specify get if you want to transfer the file file-two on the remote computer to the file file-one on the remote computer.
Because the tftp protocol does not support user authentication, the user must be logged on and the file must be writable on the remote computer.
source
Specifies the file to transfer. If the local file is specified as -, the remote file is printed on stdout (if getting) or read from stdin (if putting).
destination
Specifies the location to which the file is transferred. If destination is omitted, it is assumed to have the same name as source.
Tracert
This diagnostic utility sends Internet Control Message Protocol (ICMP) echo packets with different Time To Live (TTL) values to the target to determine the route taken to reach the target. Each router on the required path must decrement the TTL on the forwarded packet by at least 1, so TTL is an effective hop count. When the TTL on the packet reaches 0, the router should send an "ICMP Time Exceeded" message back to the source system. Tracert first sends an echo packet with TTL 1 and increments the TTL by 1 in subsequent sends until the target responds or the TTL reaches the maximum, thus determining the route. The route is determined by examining the "ICMP Time Exceeded" messages sent back by intermediate routers. However, some routers silently forward packets with expired TTL values, which tracert does not see.
tracert target_name
Parameters
/d
Specifies not to resolve addresses to computer names.
-h maximum_hops
Specifies the maximum number of hops to search for the target.
-j computer-list
Specifies a sparse source route along computer-list.
-w timeout
Waits timeout microseconds for each response.
target_name
The name of the target computer.
Last edited by oookillooo on 2007-2-8 at 09:41 AM ]
|