networking - What external reliable IP to ping to detect internet is available?

08
2014-07
  • Dims

    Is there any common always up server, which I can setup to ping in automatic mode to detect internet is available? Like google or something? May be 8.8.8.8?

    What are people using?

    UPDATE

    My specific situation is that I am using dual WAN router. Each WAN is connected to one of ISPs. When my money is ending on one of ISP, it is not blocking the channel. Instead, it redirects to a warning page. So, router thinks internet is on, because bytes are travelling. Other option for this router is to ping for some address to check if internet is on.

    I wonder, if I ping 8.8.8.8, won't I be banned by Google for inappropriate usage?

    UPDATE 2

    I suspect, that Google can have some quotas. If I will ping it's nameservers too often, then I will get DNS rejects sometimes.

  • Answers
  • AlexC

    Try to ping 8.8.8.8, it's Google primary DNS server. I always ping it to verify my connection and I never found it down. Alternatively you can try 8.8.4.4, which is Google secondary DNS.

  • lserni

    Specific case

    You want to ping the "nearest" fixed IP that is non-routable when the ISP enters traffic overload state. On my system I can emulate this situation by failing the ADSL authentication. In that case, by comparing the results of traceroute -n in normal and abnormal conditions, I see that the first hop to 8.8.8.8 (or any surely external site) that does not respond is 151.6.68.45, which is part of my ISP's infrastructure.

    By using that IP as a "check-alive" host (after repeating the test just to be sure it is fixed), I can detect an ISP anomaly without getting a false positive in case the ADSL is OK, but the ISP routing has troubles.

    Of course, I could use 8.8.8.8 on purpose, reasoning that if I can't reach Google's infrastructure, I don't care about the reason, I might as well try with the backup router.

    General case

    "internet is available" is a much more complicated thing than simply "Is 8.8.8.8 (or other IP) reachable".

    For a quick, dirty and not always reliable check, pinging 8.8.8.8 is good. But seeing as how you use a numeric IP instead of a domain name, you've already cottoned up to the fact that you might have IP connectivity and still "no Internet" because of DNS problems.

    A complete diagnostic would have to start close to your PC.

    • query local network configuration and retrieve gateway and DNS server.
    • ping the gateway. It should be reachable. If not, there's a local problem.
    • run a traceroute with short TTL (actually, a TCP traceroute such as the one provided by hping is better) of a surely external address, 8.8.8.8 is okay.
    • you want to see that, after your gateway, some extra nodes are responding.

    For example in Windows XP at home I have:

     1    <1 ms    <1 ms    <1 ms  192.168.4.200   -- (constant) Home Linux box (gateway)
     2    <1 ms    <1 ms    <1 ms  192.168.0.1     -- (constant) ADSL modem
     3     *        *        *     *               -- WAN interface, always fails; expected
     4     *        6 ms     6 ms  151.6.64.30     -- (varies) ISP gateway
    

    Now try pinging DNS. It should be reachable. Even better, run a simple DNS check. In order to avoid DNS caches, I sometimes use some domain which will answer to all queries no matter what. So for example

    $ host randomasdfdsasdqwerty987667.godaddy.com
    randomasdfdsasdqwerty987667.godaddy.com has address 97.74.104.201
    

    while if the DNS server is unreliable, the same query might return the address of the captive portal for wifi

    $ host randomasdfdsasdqwerty987667.godaddy.com
    captiveportal.homenet has address 192.168.4.200
    

    or 127.0.0.1, or even an error.

    In case of DNS failures I may try a traceroute of the DNS IP address (or a different DNS such as OpenDNS's ones). That will not only tell me whether the problem is the DNS or the ISP, it will often allow me to work around the interruption.

    If everything goes OK at this point I know that the connection is in working order, in general; it may still fail for some sites. All I need now is for isup.me to be up :-), then checking

    http://www.isup.me/www.google.com
    http://www.isup.me/mail.google.com
    

    or a site such as Down Detector will keep me informed about the "Internet weather".

    Actually, on my home server there's a Squid cache and the error page contains the last data retrieved successfully from down-site statistics, so I may see something like

                    Google.com is not reachable
    
                    STORM ALERT: 12 out of 14 sites are unreachable!
    

    just as it happened this last Friday here in Italy.

  • Big Chris

    As a couple have said, you can ping, say, the Google primary DNS to obtain a response but do not rely on one address. The address (for a number of reasons) may be down for a period of time, during which your software will report "no connectivity", when, in fact, your network connectivity may not be experiencing any problems. You should always attempt to communicate with more than one address so you can rule out false negatives.

    I would write a function that pings an address once, if that fails move on to another (up to, say, three IPs) and the moment you get a couple of positive replies the function should notify your application/script that Internet is available and continue.

  • Mark Sowul

    You can do what microsoft does: check that

    http://www.msftncsi.com/ncsi.txt

    returns "Microsoft NCSI"

    You can also check that dns.msftncsi.com

    points to 131.107.255.255

    See http://technet.microsoft.com/en-us/library/cc766017.aspx

  • Zeph

    When I worked for an organization with a flakey internet connection, I had a script which tested several "always up" servers for connectivity: first the LAN router/switch, then the local file server, then the T1 router, then the ISP's DNS, then Google. I tested the latter two as numeric addresses and as domains, to check DNS problems vs ping per se. If any of the pings failed too often, I got an idea of where the problem in connecting to the internet was most likely to exist.

    For the numeric address for Google, I just used one I had gotten from nslookup previously - I never ran into a case where it was down. I suppose 8.8.8.8 would be simpler.

    Fairly often, when people called to say the "internet was down", it turned out that only DNS was down; we might call those different things, but from the viewpoint of my colleagues, the internet wasn't available in either case.

  • user24062

    I've been using 4.2.2.1 for more than over 10 years.. Before there was Googles' public DNS service. It seems to be a reliable DNS cache and ICMP responder.

  • vonbrand

    Try your DNS server, you'll need it anyway (and your ISP's outside connection might be down). It really depends on what you want. If you need to access s specific service, check it.


  • Related Question

    networking - LAN/WLAN/home network connection dropping intermittently
  • Muffinbubble

    I'm having an issue on our home network that is driving me mad.

    More often than not, when a user on our LAN is downloading and using most of the bandwidth my connection my PC or my laptop or my brothers laptop drops.

    It's not only when bandwidth is being used but it does seem to happen more often when this is the case.

    As this affects more than just my PC I know it can't be PC specific (I hope, anyway).

    The router WAS a Draytek Vigor 2820n and I blamed the router for the drops so I asked work for a new router and they were kind enough to buy me the newer model, the Draytek Vigor 2830n. Annoyingly, the problem still exists.

    I've tried several things here to get this working and I've listed them below. I'd appreciate any advice that may help me fix the issue.

    • Changed the router from a 2820n to a new 2830n, the problem persists.
    • Reset to factory settings.
    • Manually set an IP address and changed my PC name in case there were any conflicts with my previous wireless card.
    • As above, I tried a USB wireless dongle, a wireless card and am now using an ethernet plug - I still have the issue.
    • Flushed my DNS/cleared ARP cache table on router.
    • Punched monitor.
    • Changed my local DNS to use Google DNS.
    • Upgraded to the latest firmware (on both routers).
    • Screamed.
    • Disabled my wireless and used the ethernet plugs to run on a LAN.
    • Replaced router power cable
    • Changed wireless channel (several times!)

    Now my last point is interesting. My brother had the same problems as I was getting but he switched to an ethernet plug and according to him he hasn't experienced any further problems so I thought "Ah, OK. Must be interference" and get myself an ethernet plug. Nope, I still get disconnections.

    Also 90% of the time it's when first using the internet that it will drop and then intermittently after that.

    I think that covers it, if I think of any more things I've tried I'll add it to the list.

    Thanks, Ricky

    Edit: By "ethernet plugs" I think I actually mean "ethernet adapters".

    Edit 2: By editing the first time, I got disconnected when trying to save the edit. Good timing.

    Edit 3: The only thing I can think of is the login/interface on both routers is very similar. Perhaps it uses the same firmware, and that firmware has a bug. The next step might be to trial a totally different make of router? I have now set the router DNS servers to Google DNS, still no luck. Update: Removed this now.

    UPDATE: It definitely seems to happen more when a user is downloading on our LAN. If no-one is downloading we can browse fine. As soon as someone starts downloading (even about 10% of the entire bandwidth) it seems prone to disconnecting.

    Now, one thing I have thought is my ISP is Sky and I replaced their horrible router with our current Draytek. I did read when I done this you aren't supposed to change the Sky router as Sky can detect this and complain or something along them lines. I wonder if the ISP could be causing this?

    Update 2: Today I've had the exact same issues and I can confirm no-one is downloading at this time. 4 IP's are connected. I don't know if this is relevant either but it does also seem to me disconnect shortly after connecting back to the router after a short period of inactivity (e.g laptop to sleep for 30 mins > log in, browse literally a page or two and then bam > disconnected/hanging).

    Update 3: I have switched the router back from a Draytek to our original Sky router. From tests yesterday, on my laptop and another laptop (wireless) we did not get disconnected once. My PC upstairs (wired) didn't disconnect either but did hang here and then. It seems there is an improvement but I wouldn't say the issue is fixed until I trial it for a few more days. As ever, I will update!

    Update 4: Well, since switching back to the Sky router I've not been disconnected once. It's appearing that for some reason, both different models of the Draytek routers caused me grief, both with different firmware too. I don't know if this is because Sky can some how send 'kill packets' if they detect we aren't using their stock router or it's configured in some way to work with our line correctly, my networking isn't great. Providing I've had no disconnections following the next few days, I will end this question. I'll update in a few more days to see how things have gone.

    Update 5: Well, even when switching back to the original router we started getting problems. The problem IS definitely worse when maxing out the download or upload. After several tests and changing equipment etc I've come to the conclusion it's the ISP/exchange at fault. There are no other answers. After reading a few threads, it seems a common problem with Sky Broadband too, see here and this. Thanks for all your help.

    Ping results once disconnected (this shows a ping from the router, but I cannot get access to the interface on 192.168.1.1, it just hangs saying "connecting..."):

    C:\Users\Ricky\Desktop>ping google.com
    
    Pinging google.com [173.194.67.104] with 32 bytes of data:
    Reply from 173.194.67.104: bytes=32 time=461ms TTL=49
    Request timed out.
    Request timed out.
    Reply from 173.194.67.104: bytes=32 time=454ms TTL=49
    
    Ping statistics for 173.194.67.104:
        Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 454ms, Maximum = 461ms, Average = 457ms
    
    C:\Users\Ricky\Desktop>ping 192.168.1.1
    
    Pinging 192.168.1.1 with 32 bytes of data:
    Reply from 192.168.1.1: bytes=32 time=4ms TTL=255
    Reply from 192.168.1.1: bytes=32 time=3ms TTL=255
    Reply from 192.168.1.1: bytes=32 time=3ms TTL=255
    Reply from 192.168.1.1: bytes=32 time=3ms TTL=255
    
    Ping statistics for 192.168.1.1:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 3ms, Maximum = 4ms, Average = 3ms
    
    C:\Users\Ricky\Desktop>ping 8.8.8.8
    
    Pinging 8.8.8.8 with 32 bytes of data:
    Reply from 8.8.8.8: bytes=32 time=472ms TTL=54
    Reply from 8.8.8.8: bytes=32 time=267ms TTL=54
    Reply from 8.8.8.8: bytes=32 time=355ms TTL=54
    Reply from 8.8.8.8: bytes=32 time=464ms TTL=54
    
    Ping statistics for 8.8.8.8:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 267ms, Maximum = 472ms, Average = 389ms
    
    C:\Users\Ricky\Desktop>pause
    Press any key to continue . . .
    

  • Related Answers
  • Chris

    It might be worth doing a packet capture with wireshark or network monitor. You may see a flood of traffic, or a time out, which leads you to the cause.

  • soandos
    1. Try disabling one of the adapters.
    2. If that works then change HP team config from auto to 'Network Fault Tolerance only NFT'
  • Sarge

    Had a similar issue and found the culprit quite by accident. I was moving some equipment and discovered that my cable between my modem and ISP was damaged. Replaced the cable and all is well. Check your physical cables for problems and (ISP to modem, modem to router, router to PC, etc). Good luck

  • Manuel

    according to following link your router has QOS compatibility:

    http://www.draytek.co.uk/products/vigor2830.html

    Have you log in to your router configuration and make sure that QOS is enabled? Have you reset both your modem and router and see if that fixes it.

  • David Schwartz

    I think you're just seeing the normal symptoms of an overloaded downlink. You'll notice that your pings have no problem reaching the router, so it doesn't seem to be a LAN issue. The issue is probably whatever is overloading the downlink -- the machine that's causing the traffic that you're having to compete with.

  • Shane Wealti

    I have had problems where my router was incompatible with my broadband network interface and caused intermittent problems like that. Trying a router from a different manufacturer as you are doing is a good way to rule that out.

  • music2myear

    Judging by the number of results of a google search for "draytek router connection drop" it appears this is an issue with these routers both on the wired and wireless interfaces: https://www.google.com/search?q=draytek+router+connection+drop

    Can you upgrade these devices to an alternative firmware such as DDWRT or the like?

    Hmmmm. These appear to use a proprietary chipset that is not compatible with alternative firmwares.

  • Wezly

    Might sound silly but sometimes 'if you haven't already' changing the routers wireless channel can help as you may be getting interference from another router.

  • SteveD

    This is likely to be something to do with Sky looking for a valid MAC address of the router. Try changing the MAC address of the WAN link on the Draytek to thecsame as the Sky router.

  • Kant

    I had the exact same issue. I was connecting to the router using an hidden SSID. It turns out that disabling this option completely solved my problems...

    The OS X wireless diagnostic utility pointed out that some devices could encounter connectivity issues with hidden SSID, as the SSID is not broadcasting.

    I don't know whether you were using an hidden SSID, but hopefully this will be relevant/helpful for someone else.

  • Dave Rook

    I have a Vigor 2830vn- and most of the time it's fine. But some days, I get a lot of problems with dropouts. The syslog shows a series of MAC/IP associations and dis-associations, and session stops.

    Other days, it's fine. It does seem that weekends are worse - which makes me wonder if it's caused by a local capacity issue on the DSLAM. But even just logging into the router admin page can be flaky.