ping
Syntax
ping [ data-fill | datagram-size | interval
Description
Pings the specified IPv4 address or hostname with or without optional parameters.
Command context
Operator (>
) or Manager (#
)
Parameters
-
-
Selects the IPv4 address to ping.
-
-
Selects the hostname to ping. Range: 1-256 characters
-
data-fill
-
Specifies the data pattern in hexadecimal digits to send. A maximum of 16 "pad" bytes can be specified to fill out the ICMP packet. Default: AB
-
datagram-size
-
Specifies the ping datagram size. Range: 0-65399, default: 100.
-
interval
-
Specifies the interval between successive ping requests in seconds. Range: 1-60 seconds, default: 1 second.
-
repetitions
-
Specifies the number of packets to send. Range: 1-10000 packets, default: Five packets.
-
timeout
-
Specifies the ping timeout in seconds. Range: 1-60 seconds, default: 2 seconds.
-
tos
-
Specifies the IP Type of Service to be used in Ping request. Range: 0-255
-
ip-option [include-timestamp | include-timestamp-and-address | record-route]
-
Specifies an IP option (
record-route
ortimestamp
option).-
include-timestamp
-
Specifies the intermediate router time stamp.
-
include-timestamp-and-address
-
Specifies the intermediate router time stamp and IP address.
-
record-route
-
Specifies the intermediate router addresses.
-
-
vrf
-
Specifies the virtual routing and forwarding (VRF) to use. When VRF option is not given, the default VRF is used.
Authority
Operators or Administrators or local user group members with execution rights for this command. Operators can execute this command from the operator context (>) only.
Examples
Pinging an IPv4 address:
switch#ping 10.0.0.0PING 10.0.0.0 (10.0.0.0) 100(128) bytes of data. 108 bytes from 10.0.0.0: icmp_seq=1 ttl=64 time=0.035 ms 108 bytes from 10.0.0.0: icmp_seq=2 ttl=64 time=0.034 ms 108 bytes from 10.0.0.0: icmp_seq=3 ttl=64 time=0.034 ms 108 bytes from 10.0.0.0: icmp_seq=4 ttl=64 time=0.034 ms 108 bytes from 10.0.0.0: icmp_seq=5 ttl=64 time=0.033 ms --- 10.0.0.0 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.033/0.034/0.035/0.000 ms
Pinging the localhost:
switch#ping localhostPING本地主机(127.0.0.1)100(128)个字节的数据。108bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.060 ms 108 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.035 ms 108 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.043 ms 108 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.041 ms 108 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.034 ms --- localhost ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3998ms rtt min/avg/max/mdev = 0.034/0.042/0.060/0.011 ms
Pinging a server with a data pattern:
switch#ping 10.0.0.2 data-fill 1234123412341234acde123456789012 PATTERN: 0x1234123412341234acde123456789012PING 10.0.0.2 (10.0.0.2) 100(128) bytes of data. 108 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.207 ms 108 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.187 ms 108 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.225 ms 108 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.197 ms 108 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=0.210 ms --- 10.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.187/0.205/0.225/0.015 ms
Pinging a server with a datagram size:
switch#ping 10.0.0.0 datagram-size 200PING 10.0.0.0 (10.0.0.0) 200(228) bytes of data. 208 bytes from 10.0.0.0: icmp_seq=1 ttl=64 time=0.202 ms 208 bytes from 10.0.0.0: icmp_seq=2 ttl=64 time=0.194 ms 208 bytes from 10.0.0.0: icmp_seq=3 ttl=64 time=0.201 ms 208 bytes from 10.0.0.0: icmp_seq=4 ttl=64 time=0.200 ms 208 bytes from 10.0.0.0: icmp_seq=5 ttl=64 time=0.186 ms --- 10.0.0.0 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4000ms rtt min/avg/max/mdev = 0.186/0.196/0.202/0.016 ms
Pinging a server with an interval specified:
switch#ping 9.0.0.2 interval 2PING 9.0.0.2 (9.0.0.2) 100(128) bytes of data. 108 bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.199 ms 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.192 ms 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.208 ms 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.182 ms 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.194 ms --- 9.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 7999ms rtt min/avg/max/mdev = 0.182/0.195/0.208/0.008 ms
Pinging a server with a specified number of packets to send:
switch#ping 9.0.0.2 repetitions 10PING 9.0.0.2 (9.0.0.2) 100(128) bytes of data. 108 bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.213 ms 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.204 ms 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.201 ms 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.184 ms 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.202 ms 108 bytes from 9.0.0.2: icmp_seq=6 ttl=64 time=0.184 ms 108 bytes from 9.0.0.2: icmp_seq=7 ttl=64 time=0.193 ms 108 bytes from 9.0.0.2: icmp_seq=8 ttl=64 time=0.196 ms 108 bytes from 9.0.0.2: icmp_seq=9 ttl=64 time=0.193 ms 108 bytes from 9.0.0.2: icmp_seq=10 ttl=64 time=0.200 ms --- 9.0.0.2 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 8999ms rtt min/avg/max/mdev = 0.184/0.197/0.213/0.008 ms
Pinging a server with a specified timeout:
switch#ping 9.0.0.2 timeout 3PING 9.0.0.2 (9.0.0.2) 100(128) bytes of data. 108 bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.175 ms 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.192 ms 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.190 ms 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.181 ms 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.197 ms --- 9.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4000ms rtt min/avg/max/mdev = 0.175/0.187/0.197/0.007 ms
ping服务器指定的IP Ser的类型vice:
switch#ping 9.0.0.2 tos 2PING 9.0.0.2 (9.0.0.2) 100(128) bytes of data. 108 bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.033 ms 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.034 ms 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.031 ms 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.034 ms 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.031 ms --- 9.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.031/0.032/0.034/0.006 ms
switch#ping localhost vrf redPING本地主机(127.0.0.1)100(128)个字节的数据。108bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.048 ms 108 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.052 ms 108 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.044 ms 108 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.036 ms 108 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.055 ms --- localhost ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 0.036/0.047/0.055/0.006 ms
switch#ping localhost vrf mgmtPING本地主机(127.0.0.1)100(128)个字节的数据。108bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.085 ms 108 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.057 ms 108 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.047 ms 108 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.038 ms 108 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.059 ms --- localhost ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.038/0.057/0.085/0.016 ms
Pinging a server with the intermediate router time stamp:
switch#ping 9.0.0.2 ip-option include-timestamp萍9.0.0.2(9.0.0.2)100(168)个字节的数据。108bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.031 ms TS: 59909005 absolute 0 0 0 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.034 ms TS: 59910005 absolute 0 0 0 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.038 ms TS: 59911005 absolute 0 0 0 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.035 ms TS: 59912005 absolute 0 0 0 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.037 ms TS: 59913005 absolute 0 0 0 --- 9.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.031/0.035/0.038/0.002 ms
Pinging a server with the intermediate router time stamp and address:
switch#ping 9.0.0.2 ip-option include-timestamp-and-address萍9.0.0.2(9.0.0.2)100(168)个字节的数据。108bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.030 ms TS: 9.0.0.2 60007355 absolute 9.0.0.2 0 9.0.0.2 0 9.0.0.2 0 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.037 ms TS: 9.0.0.2 60008355 absolute 9.0.0.2 0 9.0.0.2 0 9.0.0.2 0 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.037 ms TS: 9.0.0.2 60009355 absolute 9.0.0.2 0 9.0.0.2 0 9.0.0.2 0 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.038 ms TS: 9.0.0.2 60010355 absolute 9.0.0.2 0 9.0.0.2 0 9.0.0.2 0 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.039 ms TS: 9.0.0.2 60011355 absolute 9.0.0.2 0 9.0.0.2 0 9.0.0.2 0 --- 9.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.030/0.036/0.039/0.005 ms
Pinging a server with the intermediate router address:
switch#ping 9.0.0.2 ip-option record-route萍9.0.0.2(9.0.0.2)100(168)个字节的数据。108bytes from 9.0.0.2: icmp_seq=1 ttl=64 time=0.034 ms RR: 9.0.0.2 9.0.0.2 9.0.0.2 9.0.0.2 108 bytes from 9.0.0.2: icmp_seq=2 ttl=64 time=0.038 ms (same route) 108 bytes from 9.0.0.2: icmp_seq=3 ttl=64 time=0.036 ms (same route) 108 bytes from 9.0.0.2: icmp_seq=4 ttl=64 time=0.037 ms (same route) 108 bytes from 9.0.0.2: icmp_seq=5 ttl=64 time=0.035 ms (same route) --- 9.0.0.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.034/0.036/0.038/0.001 ms