I learnt about these commands in my Computer Network classes. I didn't know about these commands initially. Well, I am still learning. One of the commands is
Ping: Packet Internet Groper. Imagine a sonar. Ping is similar. Also, sonar makes a ping sound. Here is a site dedicated to the ping. An interesting introduction can be found there.
ping IP
ping hostname
It is as simple as that. Press enter and packets are sent out and you find out whether the IP is reachable or not. But first you need to check whether the network is up by pinging yourself. Your machine is "localhost" or "127.0.0.1". Ping any of them or 0. Packets will be sent until Ctrl+C is pressed
ping localhost
ping 127.0.0.1
ping 0
Now the options are like ornaments to the basic ping. They do add an edge when used creatively.
-c specify the number of echo requests.
in the following example ping sends 3 packets. Notice that although 58 bytes are sent, 64 bytes are received. The extra 8 bytes are due to ICMP headers
Ping: Packet Internet Groper. Imagine a sonar. Ping is similar. Also, sonar makes a ping sound. Here is a site dedicated to the ping. An interesting introduction can be found there.
The way this works is the computer or device will generate an ICMP packet that is sent over the local network or internet. The ICMP packet will find its way across the network by having a source and destination IP address. When the device receives this information it then sends a reply saying “yes, I am here”.Ping depends on ARP and DNS.
ping IP
ping hostname
It is as simple as that. Press enter and packets are sent out and you find out whether the IP is reachable or not. But first you need to check whether the network is up by pinging yourself. Your machine is "localhost" or "127.0.0.1". Ping any of them or 0. Packets will be sent until Ctrl+C is pressed
ping localhost
ping 127.0.0.1
ping 0
Now the options are like ornaments to the basic ping. They do add an edge when used creatively.
-c specify the number of echo requests.
in the following example ping sends 3 packets. Notice that although 58 bytes are sent, 64 bytes are received. The extra 8 bytes are due to ICMP headers
using ping the ip can be found if the host name is given. In the following example, the ip of facebook is found
-i specify the number of seconds between each ping. If the interval is less than 0.2 seconds, superuser privileges are required.
One trick with this option is to simulate sleep. You only need to redirect the output to a bit bucket. In Unix or Linux /dev/null and in windows NUL is the bit bucket.
in the example below, the interval will be of 2 seconds and also the simulation of sleep is shown.
-a gives a beep sound when host is reachable. This thing can help by removing the need to look into the screen to check about successful ping
-f ping flood. By default, the interval between pings is set to zero seconds. It send an echo request immediately after receiving the reply to the previous one. I writes a '.' when a packet is sent and a backspace when reply is received. Super user privileges are required for this. In the following example, 20171 packets were sent and received in around 2.8 seconds.
-q Quiet mode.Prints only ping command statistics.
-s Set packet size. In the following example, size of ping packet is set to 50. However, 78 bytes of data are sent. The additional 28 bytes belong to IP header and ICMP payload.
This option was, once upon time, to used to create the ping of death.
-w Set deadline. It is used to set the total amount of time the ping packets should be sent. If it is use with -c then, whichever comes first will terminate the sending of packets. Again, this option can be used as a repalcement for the sleep command by directing the output to the bit bucket (/dev/null). In the example below, deadline is set to 2 seconds.
-p Ping pattern. Upto 16 padding bytes to fill out the packet sent can be specified. This is useful for diagnosing data-dependent problems in a network. In the following example, 2 bytes of alternating 0s and 1s is used.
-R Records route. Turns on route recording for the Echo Request packets, and display the route buffer on returned packets (ignored by many routers).
ping hop1 hop2 hop3 hop4 destination This can be used to set the path for ping.
press Ctrl+| (SIGQUIT) to get short summary as shown below
No comments:
Post a Comment