Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

**WARNING** - Internet offline !!


Question

Posted (edited)

Morning...

I thought I'd try a catchy title to grab peoples attention :-) 

 

My internet dropped out during the night and as a result my alarm clock (HC2 + sonos-api + pushover+weather) didn't go off this morning because of a corner case in my code relating to 'no internet being available'

It was one of the first things I wrote about 2 years ago and is a reasonable easy fix

 

.....but it prompted me to drop a post here.

 

Many of our systems now use a lot of cloud or internet based elements (alexa, tune-in radio, weather, messages, etc)  and it needs to be able to function, at least in part without crashing, when the internet and all associated services are unavailable.

It may be worth checking your code to see that it is resilient and functional when internet services are not available

 

That's all for now 

 

Edited by AutoFrank
  • Like 1
  • Thanks 1

Recommended Posts

  • 0
Posted
23 hours ago, Sjekke said:

@Sankotronic Quick and dirty based on a ASUS AC88U router. (I'm at the office ;))

 

Please login or register to see this attachment.

 

Unless @Sankotronic can put his ISP HW into bridge mode this would imply doing NAT behind NAT. I would STRONGLY suggest NOT doing this.

When he can, there are quite some options, of which yours is one. Just not sure why you'd want to buy a EUR299 fancy looking router, which under the hood is crap(sorry, no offence): an ARM Cortex A9 with 512MB ram. Ok, actually not that bad, but the 299 is a rip off I think.. :-) 

 

Having that said, @Sankotronic check this:

Please login or register to see this link.

it is in German.. My German is a little rusty, but you might want to try and play with the mentioned 'PPPoE Pass-Through' option. This seems to be what you would need. If you have an old router lying around you would be able to test whether that works.. Or else, ask your ISP indeed if they can (well yes, they can..), are willing to, set your CPE to bridging mode. They should be able to push config to it.

 

  • 0
Posted

Maybe a bit off topic but:

I bought a cheap 3 channel GSM SIM switch from Ebay (

Please login or register to see this link.

)

and put the modem on channel 1, router on channel 2 and HC2 on channel 3.

Then I cold easy do a remote restart one or all of the units and this normally fix 99% of all internet connection problems when I am away.. :-)

  • 0
Posted
1 hour ago, MaTi said:

 

Unless @Sankotronic can put his ISP HW into bridge mode this would imply doing NAT behind NAT. I would STRONGLY suggest NOT doing this.

When he can, there are quite some options, of which yours is one. Just not sure why you'd want to buy a EUR299 fancy looking router, which under the hood is crap(sorry, no offence): an ARM Cortex A9 with 512MB ram. Ok, actually not that bad, but the 299 is a rip off I think.. :-) 

 

Having that said, @Sankotronic check this:

Please login or register to see this link.

it is in German.. My German is a little rusty, but you might want to try and play with the mentioned 'PPPoE Pass-Through' option. This seems to be what you would need. If you have an old router lying around you would be able to test whether that works.. Or else, ask your ISP indeed if they can (well yes, they can..), are willing to, set your CPE to bridging mode. They should be able to push config to it.

 

@MaTi

 

The router does everything I want and the performance is excellent. I don't need an extra switch, I can use my setup-box interactively and my NAS is connected via LAG. So saying it's crap based on the price tag is a wrong. BTW I got this router very cheap (free). If people are willing to pay 299€ for a router, it's not your concern (sorry no offence) :)

NAT can be disabled on this router, it's mentioned in the drawing.

 

And still ... it's just an idea to help @Sankotronic ... it's the goal of this forum.

 

I'm interested in your home setup at home @MaTi? Are you wiling to share this with us.

  • 0
Posted

Sorry for my silence here, I was busy with Battery alarm scene and some other things.

 

Thank you all for recommendations. I still need to see what are my options with our ISPs. I'm leaving home on Tuesday for 5 week work so this will have to wait for time when I'm back home.

 

Still my wish is to keep land line internet but also add 4G internet and use them in parallel. There is nice offer form one ISP. For around 22€ I can get 4G connection with 1Tb traffic at full possible speed and if I manage to spent 1Tb then they just lover speed to 1Mbit/s and only during day until the end of that month. With that offer use 4G connection only as a failover would be pity. Then it would be better if I use 4G and land line as failover because land line speed is not even near to 4G where I live.

 

I realize now that this will be a problem, but would this work if I can get my routers to work in bridge mode and connect them to "load balancer" as @petergebruers suggested? 

 

Thank you all for help!

  • 0
Posted
26 minutes ago, Sjekke said:

I'm interested in your home setup at home @MaTi? Are you wiling to share this with us.

 

Well, sure I am..

Just forgive me for the lack of fancy drawings though :-)

 

When my house was being built (2007) my then future-to-be neighbour turned out to be a friend I had already known for quite some years.

We both are into networking; so we figured we'd do something nice; using each other's internet connection as a backup. We also discussed with the other neighbours in our block (10 houses in total) whether they would allow us to drill through their creeping space and also upwards into their cupboard for 'future purposes', including a small explanation what this could be. We had a few hundred meters of cat cable to our avail, so it did not cost us anything, just time and energy. All agreed, so when we started we ended up with everyone having a utp cable coming into their cupboard and myself, having 9 UTP cables entering my cupboard.

 

With my direct neighbour I share alot. Basically everything is accessible for him except of getting DHCP traffic through and my local home automation vlan. He has set it up the same. This way our local clients will always get a dhcp lease from the local dhcpd. In order to do this, I needed something capable of doing L3 switching. Moreover I wanted enough ports (48), gigabit and POE. This resulted in me buying a 2nd hand Cisco Catalyst 3750G-48PS. Later I connected the other 8 houses in our street, using ACLs on my Catalyst all other neighbours cannot access anything within my local network but one of my four interfaces on my NAS, dedicated for this. One other if is used for my guest/home automation vlans and two others are in LAG for my local usage.

 

Then for my internet connectivity I could have used my Catalyst as it can do routing, but I wanted some extra functionalities so I installed an extra box; an APU2C4 from pc-engines running pfsense. This has 3 gbit interfaces, one which I use for my LAN, one for my WAN (connected to my ISP's CPE which is in L2 bridge mode) and one connected to my neighbour, which I use as failover, should my internet go down for whatever reason. I am on fiber, he is on vdsl. We chose different techniques on purpose for the failover idea. My pfsense box furthermore runs Snort!, squid, darkstat and a small plugin called 'country block'. If you are curious what they do, ask me or ask Google.. :-) Moreover it has site-to-site VPNs with 2 friends of mine who do not happen to live next door ( ;) ), so we can stream media from each others NAS to our Kodi players etc (no further local access). All our internet connections are 500/500mbit or 1/1gbit, with a throughput over VPN of ~180mbit (gotta love aes-ni support).. So fast enough to stream media and do offsite backups at night. It also maintains an openvpn connection to a commercial vpn provider, through which I route all traffic from the guest vlan. My guest wifi is pretty open (captive portal). I don't think anyone uses it for bad things, but I don't need my external IP exposed to the world for whatever crap they might be doing on it (torrents maybe etc). I also used to let my TV use this tunnel to a US endpoint for getting US Netflix content.. But Netflix blocked these VPN endpoints last year :-(

 

I use four ubiquiti AC HD's for wifi in and around my house; broadcasting two SSIDs.. One for my local usage and one for guests. The guests are isolated from each other and from the rest of the network.

Then, I have two Intel NUC's running, which run vmware ESX with ~10 virtual servers running some server applications and some virtual machines I use for testing etc (sandbox). Oh and since last month a 3rd, smaller NUC running ROCK for my local Roon setup.

 

 

 

 

  • 0
Posted (edited)
On 9/26/2017 at 12:34 PM, petergebruers said:

@AutoFrank I think it is brave of you to admit such errors exists in your scripts. It makes you a responsible person. By telling this, you warn users and help them write better code.

 

Something that is related to this... If you write code to catch such a problem, and you do not test it thoroughly, your exception handling could make things worse.

 

For instance, your code might run a tight loop, trying to fix the problem, write to the log files, whatever... Causing high CPU load, resource problems and generally make things worse. I think I give good general advice when I say: "always include a LOT of sleep() in your error handler and think twice not to spam users with thousands of error messages per hour".

@petergebruers @AutoFrank

You're absolutely right, to write the code to test internet connectivity could be a nightmare.

I have found that to use HC2 online status is more efficient to identify internet connection. No need any loops, sleeps or error handlers, just one line of code and you have the status.

 

Edited by cag014
  • 0
  • Inquirer
  • Posted
    11 minutes ago, cag014 said:

    HC2 online status is more efficient

     

    Thanks @cag014

    How do you get the online status ?

    • 0
    Posted (edited)

    api.get("/settings/info")["online"]

     

     

    if (api.get("/settings/info")["online"] == false) then 

    -- internet is down. write your code

    end

    Edited by cag014
    • 0
  • Inquirer
  • Posted
    1 minute ago, cag014 said:

    api.get("/settings/info")["online"]

     

     

    if (api.get("/settings/info")["online"] == false) then 

    -- internet is down. write your code

    end

    thanks @cag014

    I had a quick look and missed it...

     

    • 0
    Posted
    On 30.10.2017 at 1:03 PM, cag014 said:

    api.get("/settings/info")["online"]

     

    @cag014, @AutoFrank, unfortunately it doesn't work :(

    It checks only cable connection between HC2 and router. If you disconnect the WAN cable from router then online status will be still == true. So the best way is to use AutoFrank's LAN Monitor.

    • 0
    Posted (edited)
    6 hours ago, szmyk said:

     

    @cag014, @AutoFrank, unfortunately it doesn't work :(

    It checks only cable connection between HC2 and router. If you disconnect the WAN cable from router then online status will be still == true. So the best way is to use AutoFrank's LAN Monitor.

    Works for me very well. When disconnecting the WAN  cable, takes only few  seconds to HC2 to identify it.

    When you connect the WAN cable back to router, takes about 2 minutes when the online status back to true.

    It might be that the cause of that is the router. When you disconnect the WAN cable from router:

    1. How long takes to your router to identify that the internet is down? Usually some red light should be ON.

    2. How long takes to any other device (like PC) to find that internet is disconnected?

     

    Edited by cag014
    • 0
    Posted

    After disconnecting WAN cable I was waiting 2 minutes and after that time there was still online status at HC2.

    I was checking it by invoking this url:
    http://hc2_ip/api/settings/info

     

    You must be right that it may depend on router. My is D-Link DIR-655.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...