Linux and Windows under the ping command detailed

Source: Internet
Author: User
Tags sigint signal

Ext.: http://linux.chinaitlab.com/command/829332.html

One, the ping parameter under Linux

Use

Sends a loopback signal request to the network host.

Grammar

ping [-d] [-d] [-n] [-Q] [-r] [-v] [\-R] [-a addr_family] [-C Count] [-w timeout] [-f |-i \ Wait] [- L preload] [-P Pattern] [-S packetsize] [-s HOSTNAME/IP addr] \ [-l] [-I a.b.c.d.] [-O interface] [-t TTL] Host [packetsize] \ [Count]

Describe

The/usr/sbin/ping command sends an Internet Control Message Protocol (ICMP) echo_request to obtain an ICMP Echo_response signal from the host or gateway. The ping command is used to:

* Determine the status of the network and the external hosts.

* Track and isolate hardware and software issues.

* Test, evaluate and manage the network.

If the host is running and connected to the network, it responds to the loopback signal. Each echo request consists of an Internet Protocol (IP) and an ICMP header, followed by a Tim structure, and sufficient bytes to fill in the packet. The default is to send the loopback signal request continuously until the interrupt signal (CTRL-C) is received.

The ping command sends a datagram every second and prints a line of output for each response received. The ping command calculates the statistics of the signal round-trip time and (information) packet loss, and displays a brief summary after completion. The ping command ends when the program times out or when a SIGINT signal is received. The host parameter is either a valid host name or an Internet address.

By default, the ping command sends an ECHO signal continuously to the monitor until the interrupt signal (CTRL-C) is received. The interrupt key can be changed using the Stty command.

Repeated request signals should be used primarily as problem isolation because successive loopback requests can cause a certain load on the system.

Sign

-C count Specifies the number of loopback signal requests to be sent (or received), as indicated by the Count variable.

-w Timeout This option only works with the-C option. It causes the ping command to wait for a reply with the longest timeout (after the last packet is sent).

-D starts debugging at the socket level.

-d This option causes a hexadecimal dump of ICMP echo_reply packets to standard output.

-f Specifies the flood-ping option. The-F flag "dumps" or outputs packets, when they come back or 100 times per second, choose a faster one. Each time a echo_request is sent, a period is printed, and every echo_reply signal is received, a backspace is printed. This provides a quick display of how much information packets are discarded. Only the root user can use this option.

Note: This will be very difficult on the network and must be used with care. The Flood ping command can only be used by the root user. The-f flag is incompatible with the-I Wait flag.

-I a.b.c.d specifies that the interface indicated by the A.B.C.D will be used for the outward IPv4 multicast. The-I flag is uppercase I.

-O interface points out that interface will be used for outward IPv6 multicast. Interfaces are specified in the form "En0", "tr0", and so on.

-I wait waits for the time (in seconds) specified by the wait variable between each packet send. The default value is to wait 1 seconds between each packet send. This option is incompatible with the-f flag.

-L disables local loopback for multipoint broadcast ping commands.

-l preload sends a specified number of packets of preload variables as soon as possible before entering normal behavior mode (1 per second). The-l flag is lowercase l.

-n Specifies output numbers only. Do not attempt to search for the symbolic name of the host address.

-P Pattern Specifies that the packets you send are populated with up to 16 "padding" bytes. This facilitates the diagnosis of data-dependent problems on the network. For example,-p FF is all populated with 1 packets.

-Q Specifies the silent output. Nothing is displayed except that the summary line is displayed at startup and end.

-R ignores the routing table directly to the host on the connected network. If the host is not on a directly connected network, the ping command generates an error message. This option can be used to ping a local host through an interface that no longer has a route to pass through.

-r Specifies the record routing option. The-R flag includes the Record_route option in the Echo_request packet and displays the route buffer on the return packet.

Note: The IP header is only large to fit 9 such routes. Also, many hosts and gateways ignore this option.

-A Addr_family maps the destination address of the ICMP packets to the IPV6 format, if addr_family equals "Inet6".

-S packetsize Specifies the number of bytes to send data. The default value is 56, which is converted to 64 bytes of ICMP data when combined with 8 bytes of ICMP header data.

-S HOSTNAME/IP addr uses the IP address as the source address in the ping packet being emitted. On a host with more than one IP address, you can use the-s flag to force the source address to be any address other than the IP address of the interface on which the package is sent. If the IP address is not one of the following machine interface addresses, an error is returned and no send is made.

-T TTL specifies the time-to-live of TTL seconds for multicast packets.

-V requests verbose output, which lists the ICMP information received in addition to the echo signal response.

Parameters

PACKETSIZE Specifies the number of bytes to send data. The default value is 56, which is converted to 64 bytes of ICMP data when combined with 8 bytes of ICMP header data. This parameter is included for compatibility with previous versions of the ping command.

COUNT Specifies the number of loopback signal requests to send (receive). This parameter is included for compatibility with previous versions of the ping command.

Second, the ping parameter under Windows

ping [-t] [-a] [-N Count] [-l length] [-f] [-i TTL] [-v TOS] [-R Count] [-s count] [[-j computer-list] | [-K computer-list]

[-w timeout] Destination-list

The Ping command can be used to authenticate a connection to a remote computer. (This command is only available if the TCP/IP protocol is installed)

"Parameter description":

-T: Ping the specified computer until the CONTROL-C interrupt is pressed from the keyboard.

-A: Resolves the address to the computer NetBIOS name.

-N: Sends the number of ECHO packets specified by count. , this command allows you to define the number of messages you send, which is helpful for measuring network speed. Ability to test the average return time of sending packets, and how quickly and slowly. The default value is 4.

-L: The ECHO packet that sends the specified amount of data. The default is 32 bytes; The maximum value is 65500byt.

-F: Send the "Do not Fragment" flag in the packet and the packet will not be fragmented by the gateway on the route. Typically, the packets that you send are sent to each other by routing segments, and the route will not be fragmented after this parameter is added.

-I: Sets the time to live field to the value specified by the TTL. Specifies the time that the TTL value stays in the other's system. At the same time check the network operation situation.

-v:tos Set the Service Type field to the value specified by the TOS.

-R: Records the routing of outgoing and returned packets in the Record routing field. Typically, a packet is sent through a series of routes to reach the destination address, which can be set by this parameter to detect the number of routes routed. Limits can be traced to 9 routes.

-S: Specifies the timestamp of the metric specified by count. It is similar to parameter-R, but this parameter does not log the route that the packet returns, with a maximum of 4 records.

-J: Routes packets with the list of computers specified by Computer-list. The maximum number of consecutive computers that can be separated by an intermediary gateway (Route sparse source) IP is 9.

-k:computer-list routes packets using the list of computers specified by Computer-list. Continuous computers cannot be separated by an intermediary gateway (strict routing source) the maximum number of IPs allowed is 9.

-W:TIMEOUT Specifies the time-out interval, in milliseconds.

Destination-list: Specifies the remote computer to ping.

In general, by pinging the destination address, you can let the other side return the TTL value of the size, through the TTL value can be roughly determined whether the target host system type is Windows or Unix/linux, typically the Windows system returns a TTL value between 100-130, and Unix The TTL value returned by the/linux system is between 240-255. However, the value of the TTL can be modified. Therefore, the method can be used as a reference.

****************************************************************

The return information for ping is "Request Timed out", "Destination Net unreachable" and "bad IP address" and "Source Quench received".

The message "Request Timed out" indicates that the other host can reach time out, which is usually caused by a packet loss that the other party refuses to receive packets that you send to it. Most of the reason may be that the other side is equipped with a firewall or offline.

The "Destination Net unreachable" message indicates that the other host does not exist or has not established a connection with the other. Here to explain the difference between "destination host unreachable" and "Time Out", if the routing table of the routed router has a route to the destination, and the destination is unreachable for other reasons, "Time Out" appears, If there are no routes in the routing table that reach the destination, then "destination host unreachable" appears.

The "Bad IP address" message indicates that you may not be connected to a DNS server so it cannot be resolved, or the IP address may not exist.

The

Source Quench received information is special and has very little chance of appearing. It indicates that the other or Midway server is busy and unable to respond.

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.