Ping localhost using ip

$ ping 127.0.0.1

To quit the ping command, send SIGINT signal by pressing CTRL+C. If you have not specified any option to make the ping to exit automatically, then you will be terminating using CTRL+C ( SIGINT ) which will show the statistics and then terminate the ping process. When everything is working properly, it should say ‘0% packet loss’

Ping Example 6. Audible ping: Give beep when the peer is reachable

This option is useful for sysadmin during troubleshooting. There is no need for you to look at the ping output after each and every change. You can continue working with your changes, and when the remote machine become reachable you’ll hear the beep automatically.

$ ping -a IP

Note: It can give beep only from terminal number 1 through 7 and gnome-terminal ( It will not work in console ).

Ping Packet Size

In the above example, when we set the packet size to 100, it displays ‘128 bytes’ in the output. This is because of the Ping packet header size, which is 28 bytes. So, if you specify the packet size as 100, 28 bytes for header will be added to it and 128 bytes will be sent.

Thanks for your very nice tutorial. Could you please also help me with these two questions:

1- Ping claims to give an estimation about RTT(Round Trip Time) for SPECIFIC PACKET SIZE. But as it shows the packet that is coming back is 20Bytes less. So we have a RTT for which packet size (86 which goes or 66 which is coming back) ?

can you tell me what the difference between Ping -R and normal ping
i notice i can always ping but Ping -R doesnt behave the same

we had some issues with mac not being able print or use afp ( we recently upgraded to mountain lion)

we narrowed it down to the bridge that connects another bridge connection which links to a gateway to the windows 2008 server side. As soon as we disconnected the bridge connection and use Ping -R to a printer works straight away and afp works too.. soon as we connected it back it stops working and ping -R time out

Bob, I assume you’re using Mac OS X or FreeBSD?
I’ve got the same error on FreeBSD:
~ ~> ping -V
ping: illegal option — V
Ramesh should specify that some examples may vary on non-Linux OSes or even on some Linux versions.
A better way to determine IP is dig:
~ ~> dig +short google.com
173.194.70.101
173.194.70.139
…
In order to try “drill” I had to install /usr/ports/dns/ldns, but in my taste the “dig” is better.

Ujwal, you can use -i key:
-i wait Wait wait seconds between sending *each packet*.
Or you can use bash-script:
while :; do ping -c yy a.b.c.d; sleep xx; done
This script will send yy icmp-packets every xx seconds.

Hi Ramesh,
This is very useful article. I have a question.
The time displayed in the ping statistics is taken from where? Is the time taken to run the the ping command?
for example, 5 packets transmitted, 5 received, 0% packet loss, time 3998ms
Then no.of packets sent * avg RTT is the time taken to send and receive is the time taken for the pings right. Why both the times are not equal?

hi I tried to use the command ping -c 5 google.com it gives me a message that access denied option -c requires administrative privileges… while I am logged in as administrator with an elevated command prompt please help

Hello, just had a bit of a problem when I tried to use the ping -s command. I tried to change the value to 100, but it gave me an error saying “Bad value for option -s, valid range is from 1 to 4.” Anyone know why this is happening? Thanks

In this statemement i am setting a ttl value as 80 and i have one hop for the destination, so i was expecting ttl=79 in my result but it is showing it as 63 which is default TTL. Can anyone explain me what is happening here?

Decent article from a ‘what’ ping can do perspective but, you need to expand to include ‘why’ some of the options can be useful in various situations. For example, what are the benefits of using larger buffer sizes …

About The Geek Stuff

My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.

Contact Us

Email Me :
Use this Contact Form to get in touch me with your comments, questions or suggestions about this site. You can also simply drop me a line to say hello!.