1 (edited by quazardous 2017-04-04 08:18:30)

Topic: OpenWRT Multi Wan behind ISP Router + USB tethering

Hi,

My project is to build a router that will be behind my ISP box.

It will be the heart of my LAN.

I want to be able to plug my phone and share my 4G+ connexion when needed.

The router should be able to auto detect the 4G/WAN connexion and switch to it.

When plugged off, the router should switch back to the ISP box WAN.

Do you think it's achievable ?

EDIT: I've change the post title to reflect the current state see below

Here is the hardware:

-> NB6: Router/XDSL modem : SFR NB6V (French ISP)
- no bridge mode support
- has a DMZ option for port forwarding (better than double NAT ?)
- handles phone and TV

-> WRT: Linksys WRT 1200 AC @OpenWRT

-> OP3T: Phone with 4G+

target:

>> NB6(192.168.1.1)
> WIFI OFF
> DHCP on this subnet
> Gateway on this subnet

>> wan: NB6(192.168.1.1) -> [dmz/192.168.1.2] -> WRT[wan/static=192.168.1.2/gateway=192.168.1.1]
> Should work (not tested yet)

>> wan2: OP3T(IPX) -> [USB tethering] -> WRT[wan2/dhcp]
> able to ping google.com ping -I usb0

>> lan: WRT[lan/192.168.0.1/255.255.255.0]
> WIFI ON
> DHCP on this subnet
> will be the gateway on this subnet

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

I know how you can configure a 4G USB Dongle to be auto-detected and switched to using hotplug event to detect the USB Dongle and mwan3 (or similar) to route the traffic through it.
(I'm actually doing that right now with an Archer C7 and a Huawei E3372).

But you want to do it with your phone, meaning you want to share the 4G Internet of your Phone through tethering, in which I have absolutely no experience. I guess you have to plague yourself with drivers and stuff, so that OpenWRT can detect your phone.

[Even if this post does not directly help you, it opens another possibility when all else fails, namely taking the SIM out of your phone, putting it into a LTE Dongle and plugging that into the OpenWRT router.]

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

thx greek,

I think USB tethering is quite simple :
wiki.openwrt.org/doc/howto/usb.tethering

If you could share you recipes for WAN switching and USB detection ;p

Is it possible to route some traffic trough ethernet (ie to keep SSH connexions in priority with the ISP fix IP) ?

4 (edited by greek 2017-03-31 01:05:07)

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

So, for the recognition of the USB you would want to make an Hotplug Script that is executed when you connect your phone.
I would suggest reading (//wiki.openwrt.org/doc/techref/hotplug) wiki page. Basically you add scripts to the "/etc/hotplug.d/".
In my case when I connect the LTE Dongle, a new tty Interface is created. Therefore I have added a script inside /etc/hotplug.d/tty/ Folder.
Note that if you connect more than only your phone, you probably have to check if the connected USB is really your phone, because the scripts are executed on every event of the relevant Interface.

As for the routing, mwan3 is really exactly what you need. (wiki.openwrt.org/doc/howto/mwan3)
It basically implements policy based routing, which is quite powerful.
First you state him the WAN Interfaces (which it is actively monitoring through configurable ICMP ping Requests) and depending on your rules it routes through these Interfaces.
The rules can be Source Address, Destination Address, Traffic, etc based. So you could make a rule that all SSH based traffic is routed through a specific Interface. Since mwan3 actively monitors the Interface, it knows when the phone is connected and you could make a so-called fail-over rule, that when the Interface goes down the traffic is routed through the other Interface.

P.S.: As I see the tether configuration creates a new WAN Interface on the router, which means you can omit the USB Detection all together, since mwan3 will detect automatically if the Interface is up (If you have configured that Interface as a WAN).

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

Thx that helps a lot

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

hi guys !

I've bought a WRT 1200 AC ! great stuff for me (noob tongue)

unfortunately my ISP box does not support "bridge" mode (modem only ?).

So I ve managed to configure my network with the box as router (192.168.1.1) + gateway and my WRT as "sub" router (192.168.1.2).

ISP Routeur
- 192.168.1.1
- DHCP 20 to 49
- WIFI OFF

WRT (sub router)
interface :
LAN : static 192.168.1.2
- gateway 192.168.1.1
- bridge over eth1 and wlans
- DHCP 50 to 99

Have managed to successfully use my phone to ping google.com (I've added a WAN2 interface with usb0 as hardware interface).

but mwan3 says wan2 is disabled ...

and the fact I have specified the gateway is not a good point to balance my traffic to wan2...

I think I should use the ISP router as a WAN but I don't kown how ?

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

Hi !

Long time no see !

Having a second son is tough hmm

But somehow I've managed to install my lan behind my linksys router.

the router is connected to the ISP modem/router via its WAN port.

the router can be connected to Internet via a WAN4G interface (usb tethering).

I did all the config only using the OpenWRT GUI.

For the WAN4G interface I've just plugged my phone to the USB2 port and I've declared a new WAN4G interface using the usb0 device. I've put this interface in the wan zone of the firewall.

I've unplugged the ISP modem and... I was still online ;p

I did not use multiwan and now I'm wondering how openwrt choose between the 2 wans ???

Can you help me guys ?

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

If you don't have mwan it sends all traffic over whichever WAN has the lower "metric" in the routing table or whichever was connected last.  You really should use mwan.

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

@mk24 thx that was quick !

ok I'll give it a try

10 (edited by quazardous 2017-08-12 17:03:58)

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

another question is poping in my mind ...

about DNS settings :
for now I've set my OpenWRT router as gateway and DNS for LAN.
The ISP router is gateway and DNS for the WAN interface (with static IP)
The WAN4G interface is setup as DHCP so I guess the interface is given an appropriate DNS.

Is there any caveat regarding DNS and multi wan config ?

EDIT :

https://wiki.openwrt.org/doc/howto/mwan … figuration

-> using external well known DNS is recommanded

And if you were wondering how to force DNS for interface using DHCP:

Advanced settings -> uncheck Use DNS servers advertised by peer

11 (edited by mk24 2017-08-12 17:08:55)

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

The LAN users should be directed first to the router for DNS, since it will cache recently-used sites locally. 

When the router does not have a name cached, naturally it must go to a server on the WAN, and here becomes a potential problem when multiple WANs are in use.  Many ISPs host a DNS server which will not take requests from outside their network.  So if the router sends a request over WAN2 to the IP of WAN1's server, it will be ignored or rejected.  Thus using a public DNS which does not care about the requester's IP is recommended.  (This is only an issue when the WANs are from different networks.  Using for example two DSL lines from the same company wouldn't have this problem).

If you configure the DSL WAN connection statically, you need to specify the gateway and DNS in that WAN configuration.

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

thx I used google DNS.

I tried to configure the self interface as explained in the mwan3 howto

config interface 'self'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.255'
    option gateway '192.168.1.1'

I replaced 192.168.1.1 with 192.168.2.1

but after reboot I had no more Internet....

some pointers ?

Re: OpenWRT Multi Wan behind ISP Router + USB tethering

had to upgrade to LEDE

mwan3 was buggy under chaos calmer