Link to home
Start Free TrialLog in
Avatar of jl66
jl66Flag for United States of America

asked on

How to know the ip reachable quickly.

What is the quickest way to know the ip is reachable. For example, with ping utility,

ping -c 1 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.082 ms

--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.082/0.082/0.082/0.000 ms

The above is really fast. However,
ping -c 1 128.0.0.1
PING 128.0.0.1 (128.0.0.1) 56(84) bytes of data.

--- 128.0.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 10000ms

It took 10000ms to know 128.0.0.1 is no good.

Actually when waiting, I already know this is not good.

My question is that there is any other way to know quickly the ip is unreachable or if I want to give a certain number to cut off, saying after 10ms, if ping can't return, I will say the ip is bad.
How to do it?

 
SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
of course not, if your pinging a pc or server that is not on your network it is going to be over 10MS. You have to wait, you can adjust the time with ttl but if say you are on the east coast and ping a server on the west coast it will take at least 45ms round trip. If you adjusted the ttl to 10ms you would get request timed out and think that there was a issue when there really was not.
Avatar of jl66

ASKER

Thanks for the info.
michelp: how to adjust the ttl? What is the default value?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you really cant adjust the limit on the round trip time in MS only the number of hops.
Avatar of jl66

ASKER

I tried to add option -i , but it did not make any difference.

[root@bare ~]# ping -c 1 -i 1 128.0.0.1
PING 128.0.0.1 (128.0.0.1) 56(84) bytes of data.

--- 128.0.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 10000ms

It seems if I have a timer, after less than 1 sec. I time it out. Does the shell commands on linux OS have this command?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad you liked it :)
Avatar of jl66

ASKER

Thanks a lot for everyone's tips.