• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 802
  • Last Modified:

Ping delay[ Need explanation]

HI
i have configured my router with 3 ethernet card

eth0= [isp1]=192.168.2.120
eth1=[Internal]=10.0.0.1
eth2 =[isp2] = 192.168.2.10

Everything is running fine. Ineternal pc and server itself can resolv any dns query from both eth0 and eth2

but if i shutdown eth0. so all trafiq is going through eth2 , which is fine
but if try to ping a web site ( any) suppose ping gmail.com  or ping 78.25.268.45
there would be a few second[3to4] daly before it will starts to ping
i guess its before, its trying to go via eth0 , then it found out eth0 is not working then it diverts to eth2 , hense the delay.

am i right ?? or there is something i need to do to make this fast ??
                                                     
0
fosiul01
Asked:
fosiul01
  • 14
  • 9
  • 5
2 Solutions
 
joolsCommented:
do eth0 and eth2 have the same netmask?
0
 
fosiul01Author Commented:
[root@dhcp ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.255.255.0   U     0      0        0 eth1
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth2
169.254.0.0     *               255.255.0.0     U     0      0        0 eth2
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth0
0
 
joolsCommented:
are eth0 and eth2 on the same lan segment?

are bells starting to ring? can you see where I'm going with this?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
joolsCommented:
... I also need my eyes tested... looked at the 169 mask by mistake...

anyway, what happens if you change the netmask for eth2 to say 255.255.255.240

0
 
fosiul01Author Commented:
omm how will i do that ??
0
 
fosiul01Author Commented:
also
why 169.254.0.0     *               255.255.0.0     U     0      0        0 eth2 mask is there ??

0
 
joolsCommented:
# ifconfig eth2 192.168.1.0 netmask 255.255.255.240 up

The 169 address is the zeroconf address;
   http://www.zeroconf.org/
   http://en.wikipedia.org/wiki/Zeroconf

you can disable this by adding NOZEROCONF=true to the ifcfg-eth0 file (if you're using a redhat based distro)
0
 
fosiul01Author Commented:
i am following this tutorial :http://www.linuxquestions.org/linux/answers/Networking/Linux_Router_Configuration_0

omm you need to look at this one

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.255.255.0   U     0      0        0 eth1
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth2
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         home            0.0.0.0         UG    0      0        0 eth2
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth0

look at this :  default         home            0.0.0.0         UG    0      0        0 eth2

when i reboot the pc, then i can only ping via eth0 [ which is first isp]
then i need to add another gateway to allow trafiq to go via eth2
by adding this command : route add default gw 192.168.1.254 dev eth2
in Gatway , why its saying home ??
0
 
fosiul01Author Commented:
ok after putting zeroconf=false,

this is the output
[root@dhcp etc]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.255.255.0   U     0      0        0 eth1
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth2
default         home            0.0.0.0         UG    0      0        0 eth2
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth0


note : if i turned off eth0. now if i ping any ip its fine : ping 78.25.36.36  [ Fine, quickly as eth0]
only if i ping domain then there is a dealy                    ping gmail.com  [ thinking couple of second, then start to ping]

I have added dns server address of 2nd isp to /reslov.conf

0
 
joolsCommented:
I think it's getting confused as to what interface to use (you get something like this in solaris if you have the same netmask on multiple devices, or at least you used to). Having 2 default routes is also confusing matters.

Have you tried changing the netmask of one of the interfaces to see if it fixes the delay issue, it would be a quick check.

Get rid of one of the default routes.
0
 
fosiul01Author Commented:
omm but i need 2 default routes, other wise when i turned of one routes, other routes does not work.
i have change the 255.255.255.0 to  255.255.255.240 , as you said but then i am unable to ping my router!! because the netmask of my router is 255.255.255.0

i cant change that, its would be a pain ,

0
 
joolsCommented:
you can add a static route for the other interface.
0
 
fosiul01Author Commented:
you know its wired

in the server at resolv.conf

i have 2 nameserver

nameserver 192.168.2.1
nameserver 192.168.1.254  [ problematic one]

now if change this order like this

nameserver 192.168.1.254
nameserver 192.168.2.1

now if shutdown eth0 . so all trafiq should go via eth2

now if try to ping by domain  : ping gmail.com

it will just stuck , it will not ping!!!!

but with the first order, it ping but little bit delay

what do you think of this ??

As i said [ if i try to ping any public ip, its fine, only problem if i try to ping domain]

what i will do is, i will configure this server as dns server, then see what happended
0
 
giltjrCommented:
What are you trying to accomplish?

What are the real IP addresses of the 3 NIC's.  You stated that eth0 was 192.168.2.120 and that eth2 was 192.168.2.10, but you route table shows that eth2 is on 192.168.1.0/24.

You stated that you needed two default routes.  Think about it, you can't have two defaults of anything.  You can only have 1 default.  If you have 2 of anything, then you need to make a decision about which one to use.
0
 
fosiul01Author Commented:
I said 2 default route, because, if one isp is down so trafiq will not go via eth0, so trafiq will have to go via eth2

now if you dont add the default routes for eth2 which is 192.168.1.254 , then how internal nework will know which way to go ??

if i delete 2nd route, then if i shutdown eth0, then if try to ping any thing, it will say network unreacheble or it ping fail because pc is thinking internet is down
0
 
joolsCommented:
It now sounds likt you're trying to do some sort of failover rather than sort a ping/routing/configuration issue.
0
 
joolsCommented:
Isnt this related?
   http://www.experts-exchange.com/OS/Linux/Q__23897841.html

You're doing it again arent you... Can you ask one question at a time or create related questions for different issues please.

0
 
fosiul01Author Commented:
failover is fine.

what i just want to know, why there is a delay when i am trying to ping a domain ??

do you think, i should setup this servcer as dns server , and it will fast domain ping problem ??
0
 
fosiul01Author Commented:
hahahahhahah yes that question is related to same network. but thats different sort of problem!!!

and its different sort of problem

i will close that one soon.
0
 
giltjrCommented:
That will not work.  You can define two default routes, the 1st one will be used all of the time until it 'fails', then the second one will be used.  The problem is what defines a "failure".  From the linux system point of view the failure  is if eth0 detects that it is no longer physically connected.  This would mean a NIC failure, a LAN cable failure, or what ever it is connected (hub/switch/router) to failure.

Typically when you loose connection to the Internet it is a WAN (includes DLS or cable connections) failure.  Take the following picture:

     PC <-- eth0 --> Router <-  WAN connection -> Internet

If the WAN connection fails, the PC can still get to the router, so the PC still sees this as active and will still attempt to send data over this path.  Now, if the router fails or the cable between the PC and the router were to fail, then the PC would see this as a failure and start attempting to send data over another path if one is available.

What you need in order to try and get fail over is either a single router that has both ISP connections in it or setup both routers and the PC with dynamic routing functions (such as OSPF) where a WAN failure will cause the router to send route updates to the PC.

What type of Internet connections are these and what type of routers are being used to connect to your ISPs?
0
 
fosiul01Author Commented:
so if i take your word :
"
If the WAN connection fails, the PC can still get to the router, so the PC still sees this as active and will still attempt to send data over this path.  Now, if the router fails or the cable between the PC and the router were to fail, then the PC would see this as a failure and start attempting to send data over another path if one is available."

thats why there is a ping delay  when request is going via eth2 ??


its dsl connection : one is connected via BT router , anotehr one is connected via Rubbish belkin
0
 
joolsCommented:
it could have been a typo and he meant can't
0
 
giltjrCommented:
That is the way it works and I did mean "can".  You can even test this.

On your PC start ping'ing the IP adress of the DSL router/modem to the BT link.  Then disconnect the phone line going into the the DLS router/modem.  The pings still work.  The connect from your PC to the router is still up and running, so it will still us this as it (your PC) has no clue that the "far side" of the connection is down.


Now IIRC dead gateway detection takes about 30 seconds to realize that the next hop is dead an to start using another hop.  So, if you were to power down the DSL router/modem it may take up to 30 seconds for Linux to realize that path is dead and to start using the other default path.  And once that path comes back it may NOT automatically get added back to the routing table and you may have to manually add that route back.

Static routing is not designed to have redundant paths and fail over.  That is what dynamic routing protocols are for.

You may want to look for a DLS router/modem that supports dual DSL connections.  Or you might be able to use these guides to do what you are trying to do. These include information on using other Linux based programs/functions/scipts to ping the gateways/routers and hosts on the Internet to try and detect that something has failed:

http://blog.taragana.com/index.php/archive/how-to-configure-dual-adsl-cable-connections-firewall-gateway-nat-with-shorewall-firewall/

http://blog.taragana.com/index.php/archive/how-to-load-balancing-failover-with-dual-multi-wan-adsl-cable-connections-on-linux/
0
 
fosiul01Author Commented:
but program is : why delay in domain ping ??
[ as i said earlier, if i ping 78.10.25.25 = [its fine no delay] . but if ping gmaill.com  [ there would be dealy]

ip ping is fine, but when i am trying to ping domain, there is a dealy, if i take your word, then

if i try to ping ip and ping domain everything would be delay

not only domain...

ommmm does it anything to do with tcp and udp ??
0
 
giltjrCommented:
My guess is that the delay is not in the actual ping, but is a delay in doing the name look up to get what IP address gmail.com is, because the 1st DNS server it is configured to go to is now not available and typically name look ups have a 30 second timeout before they go to the next DNS server in the list.
0
 
fosiul01Author Commented:
yes, thats it

its the delay in name look up.

about your comments: typically name look ups have a 30 second timeout before they go to the next DNS server in the list.

i belived as well this is the problem ...

but is there any documents to backup this theory ??
0
 
giltjrCommented:
You can create one.  Install wireshark (http://www.wireshark.org) run a packet capture and watch it happen. When you start wireshark, on the menu bar click on capture, then interfaces.  There should be one that is labled something like "all" or "any", select that interface so you can see traffic going on all of the NIC's.

What you should see is a dns lookup going to the 1st dns server, then 30 seconds or so and a dns lookup going to the second dns server.

And this is not really a theory.  This is documented on how dns lookups work.

If fact what you could do is change the resolver timeout by adding:

         timeout:n

to your /etc/resolv.conf file, where "n" is how long you want the timeout to be.  I would suggest not taking it below 5 seconds.  
0
 
fosiul01Author Commented:
Thanks i will work on that

thanks to you and jools for the time
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 14
  • 9
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now