Modify

Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#6494 closed enhancement (fixed)

Dual-WAN Agent

Reported by: Craig M. Coffee <cmcoffee@…> Owned by: nunojpg
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version:
Keywords: Cc:

Description

This script provides a simple means of implementing a Dual-WAN solution, with the ability to use qos-scripts as well as miniupnpd upon the secondary wan.

It also offer automatic failover and dynamic link balancing.

Attachments (14)

dualwan_0.1a_i386.ipk (4.2 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
Dual-WAN Package
luci-app-dualwan.tgz (2.3 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
Luci web menu for simple Dual-WAN Configuration
luci-app-dualwan_0.1a_i386.ipk (2.7 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
Package of Luci Dual-Wan Module
dualwan_0.1a_i386.2.ipk (4.3 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
dualwan_0.1a_i386.3.ipk (4.2 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
Sorry, third attempt, ip has been added to dependencies, and miniupnpd and qos turned off by default in config file.
dualwan_0.1a_all.ipk (4.2 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
luci-app-dualwan_0.1a_all.ipk (2.8 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
dualwan_0.1a.ipk (4.3 KB) - added by Craig M. Coffee <cmcoffee@…> 8 years ago.
Fixed missing dependinces: iptables-mod-conntrack, iptables-mod-conntrack-extra
dualwan_0.1f.ipk (4.8 KB) - added by SouthPawn 8 years ago.
Updated version
luci-app-dualwan_0.1f.ipk (2.7 KB) - added by SouthPawn 8 years ago.
Updated Version
dualwan_0.1h.ipk (4.8 KB) - added by SouthPawn 8 years ago.
Most Recent Version
luci-app-dualwan_0.1h.ipk (2.8 KB) - added by SouthPawn 8 years ago.
Most Recent Version of Luci Configuration Module
dualwan_0.1j.ipk (5.0 KB) - added by SouthPawn 8 years ago.
Major Improvement, Now more DHCP/PPP Friendly
luci-app-dualwan_0.1j.ipk (2.8 KB) - added by SouthPawn 8 years ago.
Latest Update

Download all attachments as: .zip

Change History (33)

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Dual-WAN Package

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Luci web menu for simple Dual-WAN Configuration

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Package of Luci Dual-Wan Module

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

comment:1 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Appologies, dualwan_0.1a_i386.2.ipk is the latest.

Thanks

comment:2 Changed 8 years ago by anonymous

great:)

At first look you missed dependence "ip", and I don't see why you would restrict it to i386.

Also I couldn't have it to work. I get user.notice root: * Dual-WAN Error! No second gateway available, cached or otherwise. (Will retry in 1 minute.)

comment:3 Changed 8 years ago by nunojpg@…

Jan 1 00:03:47 OpenWrt user.notice root: * Dual-WAN Error: qos-scripts not enabled/installed, aborting Secondary WAN qos-scripts settings.
Jan 1 00:03:47 OpenWrt user.notice root:
* Dual-WAN Error: miniupnpd not enabled/installed, aborting Secondary WAN miniupnpd settings.
Jan 1 00:03:47 OpenWrt user.notice root: * Dual-WAN Error: No Traffic Queues have been created for eth0.2

Does it need this packages? If so this Dependences are also missing. If not it shouldn't be an error.

ping_gateways() {
CHECKGW1=ping -c 1 -W 5 $GW1 | grep round-trip | awk -F "/" '{print $4}'
sleep 1
CHECKGW2=ping -c 1 -W 5 $GW2 | grep round-trip | awk -F "/" '{print $4}'
sleep 1
}

I'm getting an error because ping is being called with $GW2="".

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Sorry, third attempt, ip has been added to dependencies, and miniupnpd and qos turned off by default in config file.

comment:4 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

This script assumes there is a second default route, as in two default routes in the default routing table. It then looks at which network is configured as the secondary wan link, and then adds a routing table, sets routes in the routing table, sets up ip rules accordingly, along with iptables to route traffic to the secondary.

comment:5 Changed 8 years ago by nunojpg@…

Sorry, I found this tiny issues, but I don't know much about iproute2/iptables.

I have two internet connections, wan and wan2.
What else configurations beside your script would I need to do to achieve fail-over/balancing? Do I need to create tables entrys?

comment:6 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

The script itself should be able to get you to a working dual-wan configuration,

  1. Make sure you install the latest, dualwan_0.1a_i386.3.ipk.
  2. Make sure both WAN and the secondary have gateways set. Either by statically assigning or via DHCP.
  3. Make appropriate changes to /etc/config/dualwan.
  4. Initiate it via /etc/init.d/dualwan start

Let me know if it still doesn't work.

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

comment:7 Changed 8 years ago by anonymous

It still doesn't work:)

I have both connections with DHCP(both are working individually), named wan and wan2.

root@OpenWrt:/# ifconfig
br-lan Link encap:Ethernet HWaddr 00:1F:C6:D6:C1:AF

inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:186 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8653 (8.4 KiB) TX bytes:27015 (26.3 KiB)

eth0 Link encap:Ethernet HWaddr 00:1F:C6:D6:C1:AF

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:234 errors:0 dropped:0 overruns:0 frame:0
TX packets:169 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18620 (18.1 KiB) TX bytes:34486 (33.6 KiB)
Interrupt:4

eth0.0 Link encap:Ethernet HWaddr 00:1F:C6:D6:C1:AF

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:186 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9397 (9.1 KiB) TX bytes:27495 (26.8 KiB)

eth0.1 Link encap:Ethernet HWaddr 00:1F:C6:D6:C1:AF

inet addr:192.168.1.143 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:766 (766.0 B) TX bytes:1275 (1.2 KiB)

eth0.2 Link encap:Ethernet HWaddr 00:1F:C6:D6:C1:AF

inet addr:192.168.2.143 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4345 (4.2 KiB) TX bytes:4865 (4.7 KiB)

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:454 errors:0 dropped:0 overruns:0 frame:0
TX packets:454 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:39492 (38.5 KiB) TX bytes:39492 (38.5 KiB)

CHECKGW2=ping -c 1 -W 5 $GW2 | grep round-trip | awk -F "/" '{print $4}' sleep 1

This line is still getting called with $GW2=.
Do I need to set it beside DHCP?

Regards

comment:8 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

This is actually an issue being caused by the dhcp client script.

It's clearing all other default routes, even ones statically set on other interfaces, which it shouldn't do.

/usr/share/udhcpc/default.script, line 57,

eval $(route -n | awk '

/0.0.0.0\W{9}('$valid_gw')\W/ {next}
/
0.0.0.0/ {print "route del -net "$1" gw "$2" ";"}

')

which should be:

eval $(route -n | grep "$interface" | awk '

/0.0.0.0\W{9}('$valid_gw')\W/ {next}
/
0.0.0.0/ {print "route del -net "$1" gw "$2" dev ";"}

')

As this will not clear other default routes configured.

comment:9 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Essentially, just changing

eval $(route -n | awk '

to

eval $(route -n | grep "$interface" | awk '

will keep the dhcp script from clearing the other routes.

comment:10 Changed 8 years ago by nunojpg@…

with your recommend changes I only get the following errors on boot:

Jan 1 00:00:39 OpenWrt user.info sysinit: iptables v1.4.4: unknown option `--restore-mark'
Jan 1 00:00:39 OpenWrt user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.
Jan 1 00:00:39 OpenWrt user.info sysinit: iptables v1.4.4: Couldn't load match `mark':File not found
Jan 1 00:00:39 OpenWrt user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.
Jan 1 00:00:39 OpenWrt user.info sysinit: iptables v1.4.4: Couldn't load match `mark':File not found
Jan 1 00:00:39 OpenWrt user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.

Also it don't work, if I disconnect WAN, I can't ping anymore. Failover on WAN2 still not working...

comment:11 Changed 8 years ago by anonymous

user.info sysinit: iptables v1.4.4: unknown option `--restore-mark'
user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.
user.info sysinit: iptables v1.4.4: Couldn't load match `mark':File not found
user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.
user.info sysinit: iptables v1.4.4: Couldn't load match `mark':File not found
user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.

comment:12 Changed 8 years ago by anonymous

user.info sysinit: iptables v1.4.4: unknown option `--restore-mark'
user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.
user.info sysinit: iptables v1.4.4: Couldn't load match `mark':File not found
user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.
user.info sysinit: iptables v1.4.4: Couldn't load match `mark':File not found
user.info sysinit: Try `iptables -h' or 'iptables --help' for more information.

Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Fixed missing dependinces: iptables-mod-conntrack, iptables-mod-conntrack-extra

comment:13 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Sorry, was missing dependencies, iptables-mod-conntrack, iptables-mod-conntrack-extra.

comment:14 Changed 8 years ago by nunojpg@…

Still not working for me. And sometimes it crash the router. I'm with brcm47xx(2.6) - Asus WL500GPV2.

I think this package will be really great.
You can start by opening a ticket with /usr/share/udhcpc/default.script bug, so it can be corrected in source.

In the meantime I guess you can solve the issues with your code(if any!).

Please tell me if I can help :)

comment:15 Changed 8 years ago by Craig M. Coffee <cmcoffee@…>

Sounds great, let's get this working. =)

For one, make sure you have the last one I uploaded running. (I know I've uploaded many at this point.)

https://dev.openwrt.org/attachment/ticket/6494/dualwan_0.1a.ipk

Also, if you'd like, join me on the forums and we'll get this working.
https://forum.openwrt.org/viewtopic.php?id=23199

comment:16 Changed 8 years ago by nunojpg@…

I used the one before that, I guess you only changed the missing dependences.

https://dev.openwrt.org/attachment/ticket/6494/dualwan_0.1a_all.ipk

I will now follow the thread on the forum.

Changed 8 years ago by SouthPawn

Updated version

Changed 8 years ago by SouthPawn

Updated Version

comment:17 Changed 8 years ago by nunojpg

  • Owner changed from developers to nunojpg
  • Status changed from new to assigned

Changed 8 years ago by SouthPawn

Most Recent Version

Changed 8 years ago by SouthPawn

Most Recent Version of Luci Configuration Module

Changed 8 years ago by SouthPawn

Major Improvement, Now more DHCP/PPP Friendly

Changed 8 years ago by SouthPawn

Latest Update

comment:18 Changed 8 years ago by nunojpg

  • Resolution set to fixed
  • Status changed from accepted to closed

Replaced by "multiwan"
Commited on 2010-04-16 - [20925] jow [packages] add multiwan, a simple to use multi wan configuration agent

comment:19 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.