PDA

Bekijk de volledige versie : Script for switching between WAN connections (in case of failure)



fukushimaku
09-04-2011, 11:57
Hello,

two years I used a Koppel firmware, but because
some limitations (old kernel 2.4.20, some issues
with 3G modems, ftdi drivers, usb webcam drivers),
I switched to OpenWrt and then DD-WRT.

At last I am using the renewed Oleg's firmware
from http://code.google.com/p/wl500g/.
(WL500gp-1.9.2.7-d-r2624.trx; Kernel 2.4.37.11)

I like it and has some improvements.
It recognize easily 3G modems as ZTE MF637,
connects to Internet through it; also the
firmware has System Utilization (in GUI),
a nice feature.

I liked the Koppel's firmware, GUI:
---USB Connection and Backup Connection---
* Setup [enable backup connection],
* IP address [Primary, Secondary IP for ping tests],
* Time [time in minutes for ping testing cycle],
* Primary [wired, WAN], Backup [radio, GPRS/EDGE/UMTS],
mean: if the primary connection failed, the backup
connection takes over.

I have a question: does someone are using this renewed
Oleg's firmware and has a script that switch automatically
the connections in case of failure (and switch back to
wired connection when it's available again) ?
I've noticed that with this version (in GUI)
I can only manually switch the connections
[IP Config - WAN & LAN: Automatic IP, Static IP,
PPPoE, PPPTP, L2TP, BigPond, WiMAX, USB Modem]
and has no special page in the tree e.g. backup connection.

That's all, thank you for any ideas.

Tamadite
09-04-2011, 21:51
Hello,
I have a question: does someone are using this renewed
Oleg's firmware and has a script that switch automatically
the connections in case of failure (and switch back to
wired connection when it's available again) ?
I've noticed that with this version (in GUI)
I can only manually switch the connections
[IP Config - WAN & LAN: Automatic IP, Static IP,
PPPoE, PPPTP, L2TP, BigPond, WiMAX, USB Modem]
and has no special page in the tree e.g. backup connection.

That's all, thank you for any ideas.

That sounds very interesting. I guess that with a cron or fork process pinging the primary interface and then altering the routing table can be an option. My concern is about the firewall. Would this imply having two set of firewall rules one for every interface?

fukushimaku
09-04-2011, 22:21
That sounds very interesting. I guess that with a cron or fork process pinging the primary interface and then altering the routing table can be an option. My concern is about the firewall. Would this imply having two set of firewall rules one for every interface?

This evening, after I opened this thread I saw this:

http://wl500g.info/showthread.php?t=18004&page=32

(sorry, last time I pasted a different link here)

and I think also would be a problem if let's say I switch to another wan adapter and I offer services over wan as tftp
serving a cisco router in upstream [with r/w rights to save it's configurations] and/or run onto asus router syslog-ng,
snmpd and snmptrapd.

If I am in trouble with iptables I can double the lines for each wan adapter (openvpn) like:

iptables -t nat -I PREROUTING -i vlan1 -p udp --dport 1194 -j DNAT --to-destination `nvram get wan0_ipaddr`:1194

iptables -t nat -I PREROUTING -i vlan1 -p udp --dport 1194 -j DNAT --to-destination `nvram get wan_modem_ipaddr`:1194

BTW: I've noticed that this renewed Oleg firmware has different names
for wan addapters than Koppel's as: wan is now wan0,
modem's is wan0_modem, wimax's is wan0_wimax and so on...
just check it all with nvram show | sort >nvram.txt
The other part is switching "on the fly" the 3G modem from storage
to modem (I'm not so experienced with it)...

Tamadite
10-04-2011, 07:07
By bridging both interfaces WAN-eth and WAN-3G and then binding all services to it can be a solution. In other words firewall, FTP, WEB servers, etc. will be using the bridged WAN interface.

fukushimaku
10-04-2011, 07:25
By bridging both interfaces WAN-eth and WAN-3G and then binding all services to it can be a solution. In other words firewall, FTP, WEB servers, etc. will be using the bridged WAN interface.

well, switching-between-wan-adapters & storage-to-modem scripts are now my concern... about xinetd [tftp], probably an `only_from = ...` will solve it.

ftp, http (served by router) are disabled / and/or through openvpn...