Linux ping command details how to use the Linux ping command

Source: Internet
Author: User
Tags network function

When the ping command is executed, the ICMP transmission protocol is used to send the request response message. If the network function of the remote host is normal, the system returns the response message, so that the host operates normally.

Syntax

Ping [-dfnqrRv] [-c <number of completions>] [-I <interval seconds>] [-I <network interface>] [-l <preload>] [-p <Template style>]

[-S <packet size>] [-t <survival value>] [host name or IP address]

Parameter description:

  • -D: Use the SO_DEBUG function of Socket.
  • -C <number of completions> set the number of completed requests.
  • -F limit detection.
  • -I <interval seconds> specifies the interval between sending and receiving information.
  • -I <network interface> use the specified network interface to send data packets.
  • -L <preload> sets the data packet that is sent before the request information is sent.
  • -N: only numbers are output.
  • -P <Template style> sets the template style for filling data packets.
  • -Q does not display the instruction execution process, except for the information at the beginning and end.
  • -R ignores common Routing tables and directly sends data packets to the remote host.
  • -R records the routing process.
  • -S <packet size> sets the packet size.
  • -T <survival value> sets the TTL value of the survival value.
  • -V displays the instruction execution process in detail.

Instance

Checks whether it is connected to the host.

# Ping www. w3cschool. cc // ping the host

PING aries.m.alikunlun.com (114.80.174.110) 56 (84) bytes of data.

64 bytes from 114.80.174.110: icmp_seq = 1 ttl = 64 time = 0.025 MS

64 bytes from 114.80.174.110: icmp_seq = 2 ttl = 64 time = 0.036 MS

64 bytes from 114.80.174.110: icmp_seq = 3 ttl = 64 time = 0.034 MS

64 bytes from 114.80.174.110: icmp_seq = 4 ttl = 64 time = 0.034 MS

64 bytes from 114.80.174.110: icmp_seq = 5 ttl = 64 time = 0.028 MS

64 bytes from 114.80.174.110: icmp_seq = 6 ttl = 64 time = 0.028 MS

64 bytes from 114.80.174.110: icmp_seq = 7 ttl = 64 time = 0.034 MS

64 bytes from 114.80.174.110: icmp_seq = 8 ttl = 64 time = 0.034 MS

64 bytes from 114.80.174.110: icmp_seq = 9 ttl = 64 time = 0.036 MS

64 bytes from 114.80.174.110: icmp_seq = 10 ttl = 64 time = 0.041 MS

--- Aries.m.alikunlun.com ping statistics ---

10 packets transmitted, 30 bytes ed, 0% packet loss, time 29246 ms

Rtt min/avg/max/mdev = 0.021/0.035/0.078/0.011 MS

// Manually terminate Ctrl + C

Number of packets received

# Ping-c 2 www. w3cschool. cc

PING aries.m.alikunlun.com (114.80.174.120) 56 (84) bytes of data.

64 bytes from 114.80.174.120: icmp_seq = 1 ttl = 54 time = 6.18 MS

64 bytes from 114.80.174.120: icmp_seq = 2 ttl = 54 time = 15.4 MS

--- Aries.m.alikunlun.com ping statistics ---

2 packets transmitted, 2 bytes ed, 0% packet loss, time 1016 ms

Rtt min/avg/max/mdev = 6.185/10.824/15.464/4.640 MS

// Automatically exit after receiving the two packages

Use multiple parameters

# Ping-I 3-s 1024-t 255 g.cn // ping the host

PING g.cn (203.208.37.104) 1024 (1052) bytes of data.

1032 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq = 0 ttl = 243 time = 62.5 MS

1032 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq = 1 ttl = 243 time = 63.9 MS

1032 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq = 2 ttl = 243 time = 61.9 MS

--- G.cn ping statistics ---

3 packets transmitted, 3 bytes ed, 0% packet loss, time 6001 ms

Rtt min/avg/max/mdev = 61.959/62.843/63.984/0.894 MS, pipe 2

[Root @ linux ~] #

//-I 3: the sending period is 3 seconds-s. Set the size of the package-t. Set the TTL value to 255.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.