Operating System - Linux
1820390 Members
3674 Online
109623 Solutions
New Discussion юеВ

ping command to look every time for the next hop

 
SOLVED
Go to solution
'chris'
Super Advisor

ping command to look every time for the next hop

hi

how is the ping command to look every time for the next hop ?

for example:

first ping:

# ping 192.168.24.1 -c 4

PING 192.168.24.1 (192.168.24.1) 56(84) bytes of data.
From 192.168.0.10: icmp_seq=1 Redirect Host(New nexthop: 192.168.0.15)
64 bytes from 192.168.24.1: icmp_seq=1 ttl=255 time=37.8 ms
64 bytes from 192.168.24.1: icmp_seq=2 ttl=255 time=33.6 ms
64 bytes from 192.168.24.1: icmp_seq=3 ttl=255 time=35.1 ms
64 bytes from 192.168.24.1: icmp_seq=4 ttl=255 time=37.8 ms

--- 192.168.24.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 33.658/324.144/37.895/1.831 ms


second ping:

# ping 192.168.24.1 -c 4

PING 192.168.24.1 (192.168.24.1) 56(84) bytes of data.
64 bytes from 192.168.24.1: icmp_seq=1 ttl=255 time=34.7 ms
64 bytes from 192.168.24.1: icmp_seq=2 ttl=255 time=36.2 ms
64 bytes from 192.168.24.1: icmp_seq=3 ttl=255 time=37.1 ms
64 bytes from 192.168.24.1: icmp_seq=4 ttl=255 time=34.3 ms

--- 192.168.24.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 34.393/35.641/37.153/1.152 ms

first ping looks for the next hop but following next one it doesn't.

kind regards
chris


7 REPLIES 7
Vitaly Karasik_1
Honored Contributor

Re: ping command to look every time for the next hop

as far as I understand, first time when you try to reach remote host, you machine receives a routing information from its default router. Next time your machine already has it in its cache.
Steven E. Protter
Exalted Contributor

Re: ping command to look every time for the next hop

Shalom,

netstat -rn
# before the command
netstat -rn
# after the first ping.

You should see the routing tables updated.

ifconfig eth#

Your routing/network environment is the source of this issue.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
'chris'
Super Advisor

Re: ping command to look every time for the next hop

thanks,

but howto delete the routing cache ?
Vitaly Karasik_1
Honored Contributor
Solution

Re: ping command to look every time for the next hop

"ip route flush cache" should delete all entries.

BTW, do you have some network problem or you just curious how it works?
Sergejs Svitnevs
Honored Contributor

Re: ping command to look every time for the next hop

You need only add new route:
# route add -net 192.168.24.0 netmask 255.255.255.0 gw 192.168.0.15

Regards,
Sergejs
'chris'
Super Advisor

Re: ping command to look every time for the next hop

thanks, but this command doesn't work on my Debian Sarge Stable:

linux:~# ip route flush cache
-bash: ip: command not found

I've written a small perl program to check the routing and I must delete the routing cache all the time before I do a ping


and:

# route add -net 192.168.24.0 netmask 255.255.255.0 gw 192.168.0.15

will not help in my case.

greetings
chris
'chris'
Super Advisor

Re: ping command to look every time for the next hop

thanks a lot

# apt-get install iproute

helps

and

# ip route flush cache

solved my problem !