Fozzie Bear
Posts: 6
Joined: Mon Feb 23, 2015 11:26 am

Raspberry Pi as dual Wan Router using 2 x USB Modems

Mon Sep 14, 2015 9:57 am

I would like to try and build a load balancing ADSL router from cheap off the shelf parts. This might be something others would be interested in as Dual Wan routers are quite expensive and most only have a single built in modem with the second WAN ethernet interface requiring an additional modem.
Is anyone aware of any projects or ready built Pi Distros which will achieve the above. I have seen Pi routers using 3G modems but I would like to utilise two Thomson Speedtouch or similar, connected to the USB ports on the Pi. If I can get it to work I would disassemble the Thomson's and mount everything in a single case.
Possibly DD-Wrt or OpenWrt have a suitable image but I thought I would ask in this Forum first to see if the Pi can actually handle the connection and throughput of a USB modem.
Many thanks
Fozzie

jbarbieri
Posts: 3
Joined: Wed Sep 23, 2015 5:57 pm

Re: Raspberry Pi as dual Wan Router using 2 x USB Modems

Wed Sep 23, 2015 6:07 pm

I don't have a RPI using dual USB modems, but I do have my RPI using a WLAN connection as one WAN, and a tagged wired connection as the second WAN. Then my LAN connection goes out to my LAN untagged.

Using the scripts I have, it sounds like you may be able to get them to work on with the USB modems as well, as all you have to do is change the LAN/WAN interface names.

A screenshot of my Cacti graphs for the RPI is below:

Image


If there is interest, I will certainly share what I did to get this to work.

--John

atux_null
Posts: 130
Joined: Thu Jun 21, 2012 1:58 pm

Re: Raspberry Pi as dual Wan Router using 2 x USB Modems

Thu Sep 24, 2015 8:54 am

i would like to use my RPI as dual wan router. i do have 2 wifi usb modems attached to the rpi.
could you share with us the way to do it, please?

jbarbieri
Posts: 3
Joined: Wed Sep 23, 2015 5:57 pm

Re: Raspberry Pi as dual Wan Router using 2 x USB Modems

Thu Sep 24, 2015 1:59 pm

These are the scripts I use for my setup: http://www.jbarbieri.net/rpi/dual_wan/

firewall > goes into /etc/init.d

forwards.firewall, firewall.firewall, gwping, routes.firewall, wan1.script, and wan2.script all go into root directory.


edit /etc/init.d/firewall, and change the dhclient lines to match your two WAN interfaces (EG: Mine are wlan0 and eth0.12; change to your two interfaces)

Code: Select all

update-rc.d firewall enable
in firewall.firewall and forwards.firewall, change laniface to match your lan interface.




Then all you have to do is make sure you LAN interface starts when the computer starts (in /etc/network/interfaces), and then run /etc/init.d/firewall start. That script will kill dhclient if running, launch with the new scripts for it, as well as flush the firewall and rebuild it, and the proper routing tables.

For any kind of port forwarding, you can make the changes in forwards.firewall, and re-run the firewall.firewall script (which calls forwards.firewall). The reason why you launch the first script is that the first script flushes the firewall out.

Good luck!

atux_null
Posts: 130
Joined: Thu Jun 21, 2012 1:58 pm

Re: Raspberry Pi as dual Wan Router using 2 x USB Modems

Wed Oct 07, 2015 8:36 am

thanks a lot for the reply.
i have tried to have the eth0 as my LAN.
i have 2 usb wifi sticks that i would like to assign as wan interfaces.
May i ask for your /etc/network/interfaces please?
i am getting something wrong with the routes and default gateways.

atux_null
Posts: 130
Joined: Thu Jun 21, 2012 1:58 pm

Re: Raspberry Pi as dual Wan Router using 2 x USB Modems

Tue Mar 08, 2016 12:46 pm

hello, is it possible to have the info so i could set it up, please?

arevindh
Posts: 1
Joined: Sat Nov 01, 2014 11:32 am
Location: Kerala
Contact: Website Yahoo Messenger

Re: Raspberry Pi as dual Wan Router using 2 x USB Modems

Thu May 19, 2016 2:39 pm

Yes I am using it , with custom build of OpenWrt . I just edited few files to allow use of a cheap USB Ethernet card and configured MWAN3 .

You can find the guide here http://blog.arevindh.com/2016/05/19/loa ... pberry-pi/

Return to “Networking and servers”