首页

ping

ping
功能说明:检测主机。
语  法:ping [-dfnqrRv][-c<完成次数>][-i<间隔秒数>][-I<网络界面>][-l<前置载入>][-p<范本样式>][-s<数据包大小>][-t<存活数值>][主机名称或IP地址]
补充说明:执行ping指令会使用ICMP传输协议,发出要求回应的信息,若远端主机的网络功能没有问题,就会回应该信息,因而得知该主机运作正常。
参  数:
  -d   使用Socket的SO_DEBUG功能。
  -c<完成次数>   设置完成要求回应的次数。
  -f   极限检测。
  -i<间隔秒数>   指定收发信息的间隔时间。
  -I<网络界面>   使用指定的网络界面送出数据包。
  -l<前置载入>   设置在送出要求信息之前,先行发出的数据包。
  -n   只输出数值。
  -p<范本样式>   设置填满数据包的范本样式。
  -q   不显示指令执行过程,开头和结尾的相关信息除外。
  -r   忽略普通的Routing Table,直接将数据包送到远端主机上。
  -R   记录路由过程。
  -s<数据包大小>   设置数据包的大小。
  -t<存活数值>   设置存活数值TTL的大小。
  -v   详细显示指令的执行过程。

ping

ping [options] host

System administration command. Confirm that a remote host is online and responding. ping is intended for use in network testing, measurement, and management. Because of the load it can impose on the network, it is unwise to use ping during normal operations or from automated scripts.

Options

-a

Make ping audible. Beep each time response is received.

-A

Adapt to return interval of packets. Like -f ping, sends packets at approximately the rate at which they are received. This option may be used by an unprivileged user.

-b

Ping a broadcast address.

-B

Bind to original source address and do not change.

-c count

Stop after sending (and receiving) count ECHO_RESPONSE packets.

-f

Flood ping-output packets as fast as they come back or 100 times per second, whichever is greater. This can be very hard on a network and should be used with caution. Only a privileged user may use this option.

-i wait

Wait wait seconds between sending each packet. Default is to wait one second between each packet. This option is incompatible with the -f option.

-I name

Set source address to interface name. name may also be specified as an IP address.

-l preload

Send preload number of packets as fast as possible before falling into normal mode of behavior.

-L

If destination is a multicast address, suppress loopback.

-M hint

Specify Path MTU Discovery strategy. Accepted values are do, want, or dont.

-n

Numeric output only. No attempt will be made to look up symbolic names for host addresses.

-p digits

Specify up to 16 pad bytes to fill out packet sent. This is useful for diagnosing data-dependent problems in a network. digits are in hex. For example, -p ff will cause the sent packet to be filled with all 1s.

-q

Quiet output—nothing is displayed except the summary lines at startup time and when finished.

-Q tos

Set Quality of Service on ICMP datagrams.

-r

Bypass the normal routing tables and send directly to a host on an attached network.

-R

Set the IP record route option, which will store the route of the packet inside the IP header. The contents of the record route will be printed if the -v option is given, and will be set on return packets if the target host preserves the record route option across echoes or if the -l option is given.

-s packetsize

Specify number of data bytes to be sent. Default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.

-S size

Set send buffer (SNDBUF) size. The default is the size of one packet.

-t n

Set the IP Time to Live to n seconds.

-T option

Set IP timestamp options. Accepted option values are:

tsonly

Timestamps only.

tsandaddr

Timestamps and addresses.

tsprespec hosts

Timestamps with prespecified hops of one or more hosts.

-U

Use older ping behavior and print full user-to-user latency instead of network round-trip time.

-v

Verbose; list ICMP packets received other than ECHO_RESPONSE.

-V

Print version, then exit.

-w n

Exit ping after n seconds.

-W n

When waiting for a response, time out after n seconds.