How to make extra Internet bandwidth in linux?

Hello.

Task

The number of scripts you want to translate to home raspberry pi 2, which will act as a web server. Nothing critical, just simple and interchangeable things. Access from the outside via DDNS, you only need me because of requests from other people to my scripts is expected.

However, I would like to make available this web server was if 100% of the time, then at least a good amount. Needless to say, a single home the Internet channel a little, because if you lose the connection and may further reset the router or even some manipulation, access Malinka from the outside will be closed.

As a back-channel considering 4g/3g in two ways - either the Internet access via wi-fi or a modem accessed via usb (a usb hub with a separate power is).

Questions.

1. How would You set up switching between connections in case of unavailability of the main canal?..

I suggest the following:
a) First option - when the connection is not torn, but the pages do not open - check after some period of time connection to the Internet. But after a period?.. And are there any existing tools for this?.. Web hosting companies clearly something respectable use.
b) the second Variant - if the connection to the house Internet (the main channel) is still broken, then how to configure the network settings Manager, so it automatically switched to alternative soedinenie?..

2. In the event of a disconnection (main or alternative), I have yet to fly SMSes that home network is not available. How such to implement on 4g/3g modem I have already read and know about. But is it possible for 4g/3g router?..
July 8th 19 at 11:17
4 answers
July 8th 19 at 11:19
The problem of accessibility by the number of channels is not solved.
For the web service, you need a normal front balancer.
Initially rested in A DNS record on behalf of the same dominosa go.
1 solution. DynDNS will change the entry depending on the working channel.
2 solution. Your own DNS server using Round Robin to balance the record.
DNS cache but user still can not escape, an active user will run into an error access to the site.

Next, the request goes to the webserver, and therefore the rules and the routing should be configured to give the packages to the channel from which you came, is solved by the marking of traffic. Thus can work simultaneously 2 and more channels.
Hmm, You're right...Missed the point. - Makayla.Bradtke commented on July 8th 19 at 11:22
July 8th 19 at 11:21
Faced with similar problems, and long struggled with wrt , then conjured his own crutches. Eventually spat and bought nekroticeskih router. Killed a bunch of birds with one stone. First inside routers Mikrotik can raise new path with wrt firmware second router works just like a clock, in the third powered by poe from the router 2 ip phone and Wi-Fi in the other room. The router itself planted on the UPS and now the problems with accessibility do not happen, all in their vlan'Ah, the speed even with a bunch of torrent falls, all easily configurable and was generally the first experience with the equipment Mikrotik and say that I am pleased is an understatement, though also worked with Cisco and a bunch of different cheap igniters and switches and routers.
In General read on this topic, I strongly believe that RouterOS or routers\routers nekroticheskie most under the problem of availability will do.
I had been looking at routers from this company! In a sense decide to take it or not take it, but after Your post it is very possible that will be solved. Painfully inspiring fine-tuning features... - Makayla.Bradtke commented on July 8th 19 at 11:24
Taking definitely worth it, the only thing that will tell. Perhaps we should buy the license on the router os as a separate operating system and collect mega slusb which combine home nas, path redundancy and path simple. In some cases when a lot of stuff around the house is easier, for example if there is a nas, where the separately spinning a home server with a small Utilitie, wifi scattered cheaper and more convenient to pack up your router and to roll it on the router OS.
For example there is a huge choice on the taste and color of the motherboard format mini itx with the right ports and power, for example with 4 ethernet pair com and powered by 12 volts. I really like those options are not tried but on habré and on the forums very often there are people who collect such things. - Makayla.Bradtke commented on July 8th 19 at 11:27
July 8th 19 at 11:23
1. Is the system not supposed to pick up?
As a variant - to write the script, which will in case of falling of the grid to another.

2. Watch this:
https://habrahabr.ru/post/133085/
https://xakep.ru/2015/04/07/195-sms/

or
when I went online with the modem - using a service type smsaero.ru/sms.ru because the Internet will already be

Especially other options do not see.
Let's say, the system is able to catch herself, but who she will point out (and most importantly - how?) which channel is primary and which one is alternative?.. This is also a question. Second, if the primary channel is not broken, but simply that is called, has ceased to open pages - it is also necessary to monitor and route traffic through the modem/router?.. And the third point - You gave me links to the modems, with them I roughly figured out, but until they solve the issue with the router, it seems to me preferable - however the router to send SMSes didn't read about this here and decided to pile up to ask. - Makayla.Bradtke commented on July 8th 19 at 11:26
: I could be wrong, but isn't the order of eth1, eth2 does not mean the main/not main.
2. The script every n minutes/seconds pings/tries to load the test page, and then take action.
3. Custom firmware + script through an external service for sending SMS. - Makayla.Bradtke commented on July 8th 19 at 11:29
July 8th 19 at 11:25
To write a bash script that pings an Internet address in case the answer is no to register a new route, route G b hereinafter. The script is loaded to cron and runs once a minute.

Find more questions by tags PHPRaspberry PiLinuxbashRaspbian