drsound / fault_tolerant_router

A daemon, running in background on a Linux router or firewall, monitoring the state of multiple internet uplinks/providers and changing the routing accordingly. LAN/DMZ internet traffic is load balanced between the uplinks.
GNU General Public License v2.0
185 stars 20 forks source link

Does it work for 3g dongles #11

Closed saikumar25 closed 9 years ago

drsound commented 9 years ago

At current state, it works with any kind of uplink (DSL, 3G, Wi-Fi, fiber) if you can provide:

I've never used 3G dongles on Linux, so I'm not sure how interfaces are configured. I suppose they assign a public dynamic IP address to a dongle0 (?) interface. Fault tolerant router should work with it with minor modifications. Just send me the output of these commands so that I can be more precise:

saikumar25 commented 9 years ago

Hey thanks a lot for the swift reply , yes the 3G dongles have a public dynamic IP address . By the way , the output for ip addr is :- 1: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 3 link/ppp inet 100.104.204.166 peer 10.64.64.64/32 scope global ppp0 2: ppp1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 3 link/ppp inet 100.103.92.112 peer 10.64.64.65/32 scope global ppp1

ip route is :- 10.64.64.65 dev ppp1 proto kernel scope link src 100.103.92.112 10.64.64.64 dev ppp0 proto kernel scope link src 100.104.204.166 default via 10.64.64.64 dev ppp0

drsound commented 9 years ago

Ok, Fault Tolerant Router has has just one problem with your configuration: the fact your IP addresses are dynamic. But you may overcome this, follow me.

Let's start with a simple case, let's suppose 10.64.64.65, 10.64.64.64, 100.103.92.112 and 100.104.204.166 were static IP addresses. You should:

This would work, and you can actually try it, until your dynamic IP addresses don't change. I see two possible solutions:

Of course, if you want to have a working solution in a short time, I advise you to go with the first solution. Anyway I will open an enhancment issue for the second one.

saikumar25 commented 9 years ago

I tried what you have said and deleted the default route , and tried pinging , it says network unreachable . So , I have thought to first try implementing fault_tolerant_router with static ip addresses taking two WAN(Ethernet) interfaces . These are the steps I followed after connecting the linux router (CentOS) with two WAN uplinks :-

And then ran the fault_tolerant_router monitor , I get one error saying :- RTNETLINK ANSWERS : Numerical result of range , and the daemon keeps running .

I am a rookie and I do not understand the underlying code very deeply , so correct me if I am wrong . According to this website :- http://lartc.org/howto/lartc.rpdb.multiple-links.html -- Does fault_tolerant_router run iptables command ,if so there should be multiple table for each WAN interface, right ? and

192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.3 10.0.0.0/8 dev eth2 proto kernel scope link src 10.10.1.76 default nexthop via 10.10.1.1 dev eth2 weight 1 nexthop via 192.168.2.1 dev eth0 weight 1

(I DO NOT get this output when I run fault_tolerant_monitor , Could you please spoon feed me If you have time , to get this up ,from what I have read and understood fault_tolerant_router should provide load_balancing with WAN failover right ?, I guess If I could this working in this environment , I could get it working in the 3G Dongles environment as well , I could run a script which would edit the dynamically changing ip addresses and edit the configuration file accordingly ) .

Can I add , these commands in the generate_iptables.rb for splitting access and getting load-balancing :-

    *  ip route add 10.10.1.0/8 dev eth2 src 10.10.1.76 table T1
*  ip route add default via 10.10.1.1 table T1
* ip route add 192.168.2.0/24 dev eth0 src 192.168.2.3  table T2
* ip route add default via 192.168.2.1 table T2

These will add entries in main routing table :-

    * ip route add 10.10.1.0/8 dev 10.10.1.76
* ip route add 192.168.2.0/24 dev 192.168.2.3

Creating rules :- * ip rule add from 10.10.1.76 table T1 * ip rule add from 192.168.2.3 table T2

Then doing load-balancing through :- * ip route add default scope global nexthop via 10.10.1.1 dev eth0 weight 1 nexthop via 192.168.2.1 dev eth2 weight 1

drsound commented 9 years ago

PPP dynamic IP support is now in development branch, some testing is appreciated.

drsound commented 9 years ago

PPP dynamic IP support is now in master branch and a new gem (v1.1.0) is out. Please test is possible, because I have no real PPP uplink, so I could't do it extensively.