Dual WAN with one as standby backup - Revision history http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&action=history Revision history for this page on the wiki en MediaWiki 1.10.1 Fri, 29 Mar 2024 15:42:32 GMT Ian5142: Changed Category to Dual WAN http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=53937&oldid=prev <p>Changed Category to Dual WAN</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 17:57, 18 March 2018</td> </tr> <tr><td colspan="2" align="left"><strong>Line 132:</strong></td> <td colspan="2" align="left"><strong>Line 132:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">* [[Dual WAN with failover]]</td><td> </td><td style="background: #eee; font-size: smaller;">* [[Dual WAN with failover]]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">[[Category:<del style="color: red; font-weight: bold; text-decoration: none;">Advanced tutorials]] </del></td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:<ins style="color: red; font-weight: bold; text-decoration: none;">Dual WAN</ins>]]</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">[[Category:Wan</del>]]</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> </table> Sun, 18 Mar 2018 17:57:00 GMT Ian5142 http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Glenn: catchg Category:Wan http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=31624&oldid=prev <p>catchg <a href="/wiki/index.php/Category:Wan" title="Category:Wan">Category:Wan</a></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 12:58, 30 April 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 131:</strong></td> <td colspan="2" align="left"><strong>Line 131:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">* [[Dual-WAN for simple round-robin load equalization]]</td><td> </td><td style="background: #eee; font-size: smaller;">* [[Dual-WAN for simple round-robin load equalization]]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">* [[Dual WAN with failover]]</td><td> </td><td style="background: #eee; font-size: smaller;">* [[Dual WAN with failover]]</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Advanced tutorials]] </td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Advanced tutorials]] </td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">[[Category:<del style="color: red; font-weight: bold; text-decoration: none;">English documentation</del>]]</td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:<ins style="color: red; font-weight: bold; text-decoration: none;">Wan</ins>]]</td></tr> </table> Fri, 30 Apr 2010 12:58:47 GMT Glenn http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup K001: cosmetics: no level-1 heading; no underscores in internal links; formatting (pre, code); added /* See also /* http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=21645&oldid=prev <p>cosmetics: no level-1 heading; no underscores in internal links; formatting (pre, code); added /* See also /*</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 14:06, 17 August 2008</td> </tr> <tr><td colspan="2" align="left"><strong>Line 1:</strong></td> <td colspan="2" align="left"><strong>Line 1:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">article need of major revision - one with dual wan as backup another simple round equalization</td><td> </td><td style="background: #eee; font-size: smaller;">article need of major revision - one with dual wan as backup another simple round equalization</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">= Dual WAN with one as standby backup =</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">This tutorial explains how you can assign one (or more) of the LAN ports</td><td> </td><td style="background: #eee; font-size: smaller;">This tutorial explains how you can assign one (or more) of the LAN ports</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">as an extra WAN port. There is another tutorial </td><td> </td><td style="background: #eee; font-size: smaller;">as an extra WAN port. There is another tutorial </td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">[[Dual-<del style="color: red; font-weight: bold; text-decoration: none;">WAN_for_simple_round</del>-<del style="color: red; font-weight: bold; text-decoration: none;">robin_load_equalization</del>]] </td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Dual-<ins style="color: red; font-weight: bold; text-decoration: none;">WAN for simple round</ins>-<ins style="color: red; font-weight: bold; text-decoration: none;">robin load equalization</ins>]] </td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">which explains how you can load balance between the two WAN connections. </td><td> </td><td style="background: #eee; font-size: smaller;">which explains how you can load balance between the two WAN connections. </td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">In this case I did not want to load balance; but rather create a standby WAN </td><td> </td><td style="background: #eee; font-size: smaller;">In this case I did not want to load balance; but rather create a standby WAN </td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">connection.</td><td> </td><td style="background: #eee; font-size: smaller;">connection.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== Justification <del style="color: red; font-weight: bold; text-decoration: none;">=</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== Justification ==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">I needed to configure backup WAN as standby as it is not an unlimited</td><td> </td><td style="background: #eee; font-size: smaller;">I needed to configure backup WAN as standby as it is not an unlimited</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">connection. I pay for the backup connections by Giga-Bytes used. My primary</td><td> </td><td style="background: #eee; font-size: smaller;">connection. I pay for the backup connections by Giga-Bytes used. My primary</td></tr> <tr><td colspan="2" align="left"><strong>Line 15:</strong></td> <td colspan="2" align="left"><strong>Line 14:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">the primary one goes down.</td><td> </td><td style="background: #eee; font-size: smaller;">the primary one goes down.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== Assumptions <del style="color: red; font-weight: bold; text-decoration: none;">=</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== Assumptions ==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">I have assumed static IP addresses for both the WAN interfaces. Making them</td><td> </td><td style="background: #eee; font-size: smaller;">I have assumed static IP addresses for both the WAN interfaces. Making them</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">dynamic will require some changes (hint nvram set wan2_proto=dynamic)</td><td>+</td><td style="background: #cfc; font-size: smaller;">dynamic will require some changes (hint<ins style="color: red; font-weight: bold; text-decoration: none;">: &lt;code&gt;</ins>nvram set wan2_proto=dynamic<ins style="color: red; font-weight: bold; text-decoration: none;">&lt;/code&gt;</ins>)</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Also, I am assuming DNSMasq is used for DHCP and DNS. JFFS should be enabled</td><td> </td><td style="background: #eee; font-size: smaller;">Also, I am assuming DNSMasq is used for DHCP and DNS. JFFS should be enabled</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">if you want to save the WAN-connection switch scripts. Also, I am assuming that you</td><td> </td><td style="background: #eee; font-size: smaller;">if you want to save the WAN-connection switch scripts. Also, I am assuming that you</td></tr> <tr><td colspan="2" align="left"><strong>Line 24:</strong></td> <td colspan="2" align="left"><strong>Line 23:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">or web interface.</td><td> </td><td style="background: #eee; font-size: smaller;">or web interface.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== Create an extra VLAN <del style="color: red; font-weight: bold; text-decoration: none;">=</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== Create an extra VLAN ==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">First you need to create an extra VLAN. In this case we want to to remove</td><td> </td><td style="background: #eee; font-size: smaller;">First you need to create an extra VLAN. In this case we want to to remove</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">the port 4 from vlan0 and add it to the new vlan2</td><td> </td><td style="background: #eee; font-size: smaller;">the port 4 from vlan0 and add it to the new vlan2</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram set vlan0ports=&quot;1 2 3 5*&quot; <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram set vlan0ports=&quot;1 2 3 5*&quot;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram set vlan2ports=&quot;4 5&quot; <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram set vlan2ports=&quot;4 5&quot;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram set vlan2hwname=et0 <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram set vlan2hwname=et0</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram set wan2_ifnames=vlan2 <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram set wan2_ifnames=vlan2</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram set wan2_ifname=vlan2 <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram set wan2_ifname=vlan2</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram set wan2_mtu=1500 <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram set wan2_mtu=1500</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">nvram commit <del style="color: red; font-weight: bold; text-decoration: none;">&lt;br&gt;</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"> </ins>nvram commit</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">You can confirm or perform the setting using the dd-wrt web interface</td><td> </td><td style="background: #eee; font-size: smaller;">You can confirm or perform the setting using the dd-wrt web interface</td></tr> <tr><td colspan="2" align="left"><strong>Line 42:</strong></td> <td colspan="2" align="left"><strong>Line 41:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Now you have created an extra VLAN (vlan2).</td><td> </td><td style="background: #eee; font-size: smaller;">Now you have created an extra VLAN (vlan2).</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== Bring up the vlan2 <del style="color: red; font-weight: bold; text-decoration: none;">Interface =</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== Bring up the vlan2 <ins style="color: red; font-weight: bold; text-decoration: none;">interface </ins>==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">I found it easier to configure the interface using ifconfig in the startup script.</td><td> </td><td style="background: #eee; font-size: smaller;">I found it easier to configure the interface using ifconfig in the startup script.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Somehow nvram bindings for backup WAN interface IP address did not work. ifconfig</td><td> </td><td style="background: #eee; font-size: smaller;">Somehow nvram bindings for backup WAN interface IP address did not work. ifconfig</td></tr> <tr><td colspan="2" align="left"><strong>Line 63:</strong></td> <td colspan="2" align="left"><strong>Line 62:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">http://your_router_ip/Diagnostics.asp</td><td> </td><td style="background: #eee; font-size: smaller;">http://your_router_ip/Diagnostics.asp</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">Ofcourse </del>you will need a reboot for this to be effective </td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">Of course </ins>you will need a reboot for this to be effective<ins style="color: red; font-weight: bold; text-decoration: none;">.</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== Configure NAT on vlan2 <del style="color: red; font-weight: bold; text-decoration: none;">=</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== Configure NAT on vlan2 ==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">We want to make sure packets leaving vlan2 are NATed</td><td> </td><td style="background: #eee; font-size: smaller;">We want to make sure packets leaving vlan2 are NATed</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2" align="left"><strong>Line 73:</strong></td> <td colspan="2" align="left"><strong>Line 72:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"> '</td><td> </td><td style="background: #eee; font-size: smaller;"> '</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">&lt;/pre&gt;</td><td> </td><td style="background: #eee; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Again the same Diagnostics.asp page can be used on the web interface</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Again, the same Diagnostics.asp page can be used on the web interface.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== Create scripts to do the connection switch <del style="color: red; font-weight: bold; text-decoration: none;">=</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== Create scripts to do the connection switch ==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">We switch the internet connection by switching the default route and DNS servers.</td><td> </td><td style="background: #eee; font-size: smaller;">We switch the internet connection by switching the default route and DNS servers.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Here we will create two scripts in /jffs to switch from one WAN connection to the other.</td><td> </td><td style="background: #eee; font-size: smaller;">Here we will create two scripts in /jffs to switch from one WAN connection to the other.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Script to switch to wan1</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">=== </ins>Script to switch to wan1 <ins style="color: red; font-weight: bold; text-decoration: none;">===</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Put this in /jffs/activate.wan1<del style="color: red; font-weight: bold; text-decoration: none;">.</del></td><td>+</td><td style="background: #cfc; font-size: smaller;">Put this in <ins style="color: red; font-weight: bold; text-decoration: none;">&lt;code&gt;</ins>/jffs/activate.wan1<ins style="color: red; font-weight: bold; text-decoration: none;">&lt;/code&gt;:</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">&lt;pre&gt;</td><td> </td><td style="background: #eee; font-size: smaller;">&lt;pre&gt;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">#!/bin/ash</td><td> </td><td style="background: #eee; font-size: smaller;">#!/bin/ash</td></tr> <tr><td colspan="2" align="left"><strong>Line 94:</strong></td> <td colspan="2" align="left"><strong>Line 93:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">pr=&quot;$(ps | awk '/dnsmasq/ {print $1}')&quot;</td><td> </td><td style="background: #eee; font-size: smaller;">pr=&quot;$(ps | awk '/dnsmasq/ {print $1}')&quot;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">kill -9 $pr</td><td> </td><td style="background: #eee; font-size: smaller;">kill -9 $pr</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf&lt;/pre&gt;</td><td>+</td><td style="background: #cfc; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">&#160;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Used kill -9; because not sure why -1 (HUP) didnt work.</td><td> </td><td style="background: #eee; font-size: smaller;">Used kill -9; because not sure why -1 (HUP) didnt work.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Obviously 10.10.1.10 and 10.10.1.11 are DNS servers for WAN1 and 10.10.1.1 is the default gateway. Replace these values with your own settings for WAN1</td><td>+</td><td style="background: #cfc; font-size: smaller;">Obviously 10.10.1.10 and 10.10.1.11 are DNS servers for WAN1 and 10.10.1.1 is the default gateway. Replace these values with your own settings for WAN1<ins style="color: red; font-weight: bold; text-decoration: none;">.</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">And put this in /jffs/activate.wan2</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">=== Script to switch to wan2 ===</ins></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&#160;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">And put this in <ins style="color: red; font-weight: bold; text-decoration: none;">&lt;code&gt;</ins>/jffs/activate.wan2<ins style="color: red; font-weight: bold; text-decoration: none;">&lt;/code&gt;:</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">&lt;pre&gt;#!/bin/ash</td><td> </td><td style="background: #eee; font-size: smaller;">&lt;pre&gt;#!/bin/ash</td></tr> <tr><td colspan="2" align="left"><strong>Line 115:</strong></td> <td colspan="2" align="left"><strong>Line 116:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">&lt;/pre&gt;</td><td> </td><td style="background: #eee; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Obviously 10.10.2.10 and 10.10.2.11 are DNS servers for WAN2 and 10.10.2.1 is the default gateway. Replace these values with your own settings for WAN2</td><td>+</td><td style="background: #cfc; font-size: smaller;">Obviously 10.10.2.10 and 10.10.2.11 are DNS servers for WAN2 and 10.10.2.1 is the default gateway. Replace these values with your own settings for WAN2<ins style="color: red; font-weight: bold; text-decoration: none;">.</ins></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&#160;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">You can switch connection by running the respective script.</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">You can switch connection by running the respective script</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Connect the cable</td><td> </td><td style="background: #eee; font-size: smaller;">Connect the cable</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Connect the backup WAN cable to the ethernet port marked as &quot;4&quot; and reboot.</td><td> </td><td style="background: #eee; font-size: smaller;">Connect the backup WAN cable to the ethernet port marked as &quot;4&quot; and reboot.</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>== More to come <del style="color: red; font-weight: bold; text-decoration: none;">=</del>==</td><td>+</td><td style="background: #cfc; font-size: smaller;">== More to come ==</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;"> 1. </del>Automation of connection switching with email notification</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"># </ins>Automation of connection switching with email notification</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;"> 2. </del>Web interface to monitor and switch connection</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;"># </ins>Web interface to monitor and switch connection</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">== See also ==</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">* [[Dual-WAN for simple round-robin load equalization]]</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">* [[Dual WAN with failover]]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Advanced tutorials]] </td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:Advanced tutorials]] </td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:English documentation]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:English documentation]]</td></tr> </table> Sun, 17 Aug 2008 14:06:45 GMT K001 http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Underdpt: Dual WAN moved to Dual WAN with one as standby backup: Real Title. Old title ("Dual WAN") didn't gave sufficient information about was the article was for http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=21491&oldid=prev <p><a href="/wiki/index.php/Dual_WAN" title="Dual WAN">Dual WAN</a> moved to <a href="/wiki/index.php/Dual_WAN_with_one_as_standby_backup" title="Dual WAN with one as standby backup">Dual WAN with one as standby backup</a>: Real Title. Old title (&quot;Dual WAN&quot;) didn't gave sufficient information about was the article was for</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 12:14, 6 August 2008</td> </tr> </table> Wed, 06 Aug 2008 12:14:59 GMT Underdpt http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Underdpt: The last past was missing from a previous edit http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=21490&oldid=prev <p>The last past was missing from a previous edit</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 12:09, 6 August 2008</td> </tr> <tr><td colspan="2" align="left"><strong>Line 95:</strong></td> <td colspan="2" align="left"><strong>Line 95:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">kill -9 $pr</td><td> </td><td style="background: #eee; font-size: smaller;">kill -9 $pr</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf&lt;/pre&gt;</td><td> </td><td style="background: #eee; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf&lt;/pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Used kill -9; because not sure why -1 (HUP) didnt work.</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Obviously 10.10.1.10 and 10.10.1.11 are DNS servers for WAN1 and 10.10.1.1 is the default gateway. Replace these values with your own settings for WAN1</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">And put this in /jffs/activate.wan2</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;pre&gt;#!/bin/ash</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">nvram set wan_dns=&quot;10.10.2.10 10.10.2.11&quot;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">route delete default</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">route delete default</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">route add default gw 10.10.2.1 vlan2</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">echo &quot;nameserver 10.10.2.10&quot; &gt; /tmp/resolv.dnsmasq</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">echo &quot;nameserver 10.10.2.11&quot; &gt;&gt; /tmp/resolv.dnsmasq</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">pr=&quot;$(ps | grep dnsmasq | grep -v grep| awk '{print $1}')&quot;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">kill -9 $pr</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf &amp;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Obviously 10.10.2.10 and 10.10.2.11 are DNS servers for WAN2 and 10.10.2.1 is the default gateway. Replace these values with your own settings for WAN2</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">You can switch connection by running the respective script</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Connect the cable</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Connect the backup WAN cable to the ethernet port marked as &quot;4&quot; and reboot.</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">=== More to come ===</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> 1. Automation of connection switching with email notification</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> 2. Web interface to monitor and switch connection</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:Advanced tutorials]] </td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:English documentation]]</td></tr> </table> Wed, 06 Aug 2008 12:09:56 GMT Underdpt http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Dr. Ongo: /* Ctreate scripts to do the connection switch */ Unnecessary use of grep http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=19809&oldid=prev <p><span class="autocomment">Ctreate scripts to do the connection switch -</span> Unnecessary use of grep</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 13:38, 23 March 2008</td> </tr> <tr><td colspan="2" align="left"><strong>Line 76:</strong></td> <td colspan="2" align="left"><strong>Line 76:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">=== <del style="color: red; font-weight: bold; text-decoration: none;">Ctreate </del>scripts to do the connection switch ===</td><td>+</td><td style="background: #cfc; font-size: smaller;">=== <ins style="color: red; font-weight: bold; text-decoration: none;">Create </ins>scripts to do the connection switch ===</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">We switch the internet connection by switching the default route and DNS servers.</td><td> </td><td style="background: #eee; font-size: smaller;">We switch the internet connection by switching the default route and DNS servers.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Here we will create <del style="color: red; font-weight: bold; text-decoration: none;">2 </del>scripts in /jffs to switch from one WAN connection</td><td>+</td><td style="background: #cfc; font-size: smaller;">Here we will create <ins style="color: red; font-weight: bold; text-decoration: none;">two </ins>scripts in /jffs to switch from one WAN connection to the other<ins style="color: red; font-weight: bold; text-decoration: none;">.</ins></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">to the other</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">script </del>to switch to wan1</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">Script </ins>to switch to wan1</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">put </del>this in /jffs/activate.wan1</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">Put </ins>this in /jffs/activate.wan1<ins style="color: red; font-weight: bold; text-decoration: none;">.</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">&lt;pre&gt;</td><td> </td><td style="background: #eee; font-size: smaller;">&lt;pre&gt;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">#!/bin/ash</td><td> </td><td style="background: #eee; font-size: smaller;">#!/bin/ash</td></tr> <tr><td colspan="2" align="left"><strong>Line 93:</strong></td> <td colspan="2" align="left"><strong>Line 92:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">echo &quot;nameserver 10.10.1.10&quot; &gt; /tmp/resolv.dnsmasq</td><td> </td><td style="background: #eee; font-size: smaller;">echo &quot;nameserver 10.10.1.10&quot; &gt; /tmp/resolv.dnsmasq</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">echo &quot;nameserver 10.10.1.11&quot; &gt;&gt; /tmp/resolv.dnsmasq</td><td> </td><td style="background: #eee; font-size: smaller;">echo &quot;nameserver 10.10.1.11&quot; &gt;&gt; /tmp/resolv.dnsmasq</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">pr=&quot;$(ps <del style="color: red; font-weight: bold; text-decoration: none;">| grep dnsmasq | grep -v grep</del>| awk '{print $1}')&quot;</td><td>+</td><td style="background: #cfc; font-size: smaller;">pr=&quot;$(ps | awk '<ins style="color: red; font-weight: bold; text-decoration: none;">/dnsmasq/ </ins>{print $1}')&quot;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">kill -9 $pr</td><td> </td><td style="background: #eee; font-size: smaller;">kill -9 $pr</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf&lt;/pre&gt;</td><td> </td><td style="background: #eee; font-size: smaller;">dnsmasq --conf-file /tmp/dnsmasq.conf&lt;/pre&gt;</td></tr> </table> Sun, 23 Mar 2008 13:38:13 GMT Dr. Ongo http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup DcmNuv at 18:41, 12 April 2007 http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=15590&oldid=prev <p></p> <a href="http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&amp;diff=15590&amp;oldid=11927">(Difference between revisions)</a> Thu, 12 Apr 2007 18:41:16 GMT DcmNuv http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Whiteboy: /* Dual-WAN for simple round-robin load equalization */ http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=11927&oldid=prev <p><span class="autocomment">Dual-WAN for simple round-robin load equalization</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 01:46, 15 February 2007</td> </tr> <tr><td colspan="2" align="left"><strong>Line 128:</strong></td> <td colspan="2" align="left"><strong>Line 128:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">==</del>= Dual-WAN for simple round-robin load equalization<del style="color: red; font-weight: bold; text-decoration: none;">==</del>=</td><td>+</td><td style="background: #cfc; font-size: smaller;">= Dual-WAN for simple round-robin load equalization =</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">(copied from forum-posting by user aldoir [http://forum.bsr-clan.de/ftopic8012.html Dual-WAN forum posting]</td><td> </td><td style="background: #eee; font-size: smaller;">(copied from forum-posting by user aldoir [http://forum.bsr-clan.de/ftopic8012.html Dual-WAN forum posting]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> </table> Thu, 15 Feb 2007 01:46:46 GMT Whiteboy http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Whiteboy: /* More to come */ http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=10415&oldid=prev <p><span class="autocomment">More to come</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 01:46, 15 February 2007</td> </tr> <tr><td colspan="2" align="left"><strong>Line 126:</strong></td> <td colspan="2" align="left"><strong>Line 126:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"># Automation of connection switching with email notification</td><td> </td><td style="background: #eee; font-size: smaller;"># Automation of connection switching with email notification</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"># Web interface to monitor and switch connection</td><td> </td><td style="background: #eee; font-size: smaller;"># Web interface to monitor and switch connection</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">=== Dual-WAN for simple round-robin load equalization===</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">(copied from forum-posting by user aldoir [http://forum.bsr-clan.de/ftopic8012.html Dual-WAN forum posting]</td><td> </td><td style="background: #eee; font-size: smaller;">(copied from forum-posting by user aldoir [http://forum.bsr-clan.de/ftopic8012.html Dual-WAN forum posting]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> </table> Thu, 15 Feb 2007 01:46:33 GMT Whiteboy http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup Whiteboy at 01:45, 15 February 2007 http://wiki.dd-wrt.com/wiki/index.php?title=Dual_WAN_with_one_as_standby_backup&diff=10414&oldid=prev <p></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 01:45, 15 February 2007</td> </tr> <tr><td colspan="2" align="left"><strong>Line 1:</strong></td> <td colspan="2" align="left"><strong>Line 1:</strong></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">= Dual WAN with </del>one as <del style="color: red; font-weight: bold; text-decoration: none;">standby </del>backup <del style="color: red; font-weight: bold; text-decoration: none;">=</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">article need of major revision - </ins>one <ins style="color: red; font-weight: bold; text-decoration: none;">with dual wan </ins>as backup <ins style="color: red; font-weight: bold; text-decoration: none;">another simple round equalization</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">= Dual WAN with one as standby backup =</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">This tutorial explains how you can assign one (or more) of the LAN ports</td><td> </td><td style="background: #eee; font-size: smaller;">This tutorial explains how you can assign one (or more) of the LAN ports</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">as an extra WAN port. There is another tutorial </td><td> </td><td style="background: #eee; font-size: smaller;">as an extra WAN port. There is another tutorial </td></tr> <tr><td colspan="2" align="left"><strong>Line 125:</strong></td> <td colspan="2" align="left"><strong>Line 126:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"># Automation of connection switching with email notification</td><td> </td><td style="background: #eee; font-size: smaller;"># Automation of connection switching with email notification</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"># Web interface to monitor and switch connection</td><td> </td><td style="background: #eee; font-size: smaller;"># Web interface to monitor and switch connection</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">(copied from forum-posting by user aldoir [http://forum.bsr-clan.de/ftopic8012.html Dual-WAN forum posting]</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">You'll need to create a new VLAN, called vlan2.</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Enter in the web interface, Settings/VLANs. Set Port 4 to a new VLAN.</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Enter in the console, and do the following commands</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''commands to set VLANs'''</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">nvram set vlan0ports=&quot;1 2 3 5*&quot;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">nvram set vlan2ports=&quot;4 5&quot;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">nvram set vlan2hwname=et0</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">nvram commit</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Here are the scripts I used to startup the interface. You need to call them in rc_firewall</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''wan2.firewall'''</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">//edit - dont like this bit, it doesnt seem to be for DHCP connection and looks like its for a static IP connection</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#!/bin/sh</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">WAN2_IFNAME=vlan2</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">WAN2_IPADDR=10.0.0.2</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">WAN2_GATEWAY=10.0.0.1</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">WAN2_NETMASK=255.0.0.0</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">if [ &quot;$(nvram get wan2_ipaddr)&quot; != &quot;$WAN2_IPADDR&quot; ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> nvram set wan2_ifname=$WAN2_IFNAME </td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> nvram set wan2_ipaddr=$WAN2_IPADDR</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> nvram set wan2_gateway=$WAN2_GATEWAY</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> nvram set wan2_netmask=$WAN2_NETMASK</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> nvram commit</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ifconfig $(nvram get wan2_ifname) up $(nvram get wan2_ipaddr) netmask $(nvram get wan2_netmask)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''routes.firewall'''</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#!/bin/sh</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule flush</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule add lookup main prio 32766</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule add lookup default prio 32767</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule add from $(nvram get wan_ipaddr) table 100 prio 100</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule add fwmark 0x100 table 100 prio 101</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule add from $(nvram get wan2_ipaddr) table 200 prio 200</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip rule add fwmark 0x200 table 200 prio 201</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip route flush table 100</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip route flush table 200</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">for TABLE in 100 200</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">do</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ip route | grep link | while read ROUTE</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> do</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ip route add table $TABLE to $ROUTE</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> done</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">done</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip route add table 100 default via $(nvram get wan_gateway)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">ip route add table 200 default via $(nvram get wan2_gateway)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">'''firewall.firewall'''</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#!/bin/sh</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#DD-WRT firewall rules</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#BEGIN</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#apply simple forward rules</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">for RULE in $(nvram get forward_spec)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">do</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> FROM=`echo $RULE | cut -d '&gt;' -f 1`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> TO=`echo $RULE | cut -d '&gt;' -f 2`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> STATE=`echo $FROM | cut -d ':' -f 2`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> PROTO=`echo $FROM | cut -d ':' -f 3`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> SPORT=`echo $FROM | cut -d ':' -f 4`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> DEST=`echo $TO | cut -d ':' -f 1`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> DPORT=`echo $TO | cut -d ':' -f 2`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> if [ &quot;$STATE&quot; = &quot;on&quot; ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> if [ &quot;$PROTO&quot; = &quot;both&quot; ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #udp</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #iptables -A FORWARD -d $(nvram get wan2_ipaddr) -p udp --dport $SPORT -j ACCEPT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p udp -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #tcp</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #iptables -A FORWARD -d $(nvram get wan2_ipaddr) -p tcp --dport $SPORT -j ACCEPT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> else</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #iptables -A FORWARD -d $(nvram get wan2_ipaddr) -p $PROTO --dport $SPORT -j ACCEPT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p $PROTO -d $(nvram get wan2_ipaddr) --dport $SPORT -j DNAT --to $DEST:$DPORT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">done</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#apply range forward rules</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">for RULE in $(nvram get forward_port)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">do</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> FROM=`echo $RULE | cut -d '&gt;' -f 1`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> TO=`echo $RULE | cut -d '&gt;' -f 2`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> STATE=`echo $FROM | cut -d ':' -f 2`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> PROTO=`echo $FROM | cut -d ':' -f 3`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> SPORT=`echo $FROM | cut -d ':' -f 4`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> EPORT=`echo $FROM | cut -d ':' -f 5`</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> if [ &quot;$STATE&quot; = &quot;on&quot; ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> if [ &quot;$PROTO&quot; = &quot;both&quot; ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #udp</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #iptables -A FORWARD -d $(nvram get wan2_ipaddr) -p udp --dport $SPORT:$EPORT -j ACCEPT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p udp -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #tcp</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #iptables -A FORWARD -d $(nvram get wan2_ipaddr) -p tcp --dport $SPORT:$EPORT -j ACCEPT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> else</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> #iptables -A FORWARD -d $(nvram get wan2_ipaddr) -p $PROTO --dport $SPORT:$EPORT -j ACCEPT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p $PROTO -d $(nvram get wan2_ipaddr) --dport $SPORT:$EPORT -j DNAT --to $TO</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">done</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A PREROUTING -t nat -p icmp -d $(nvram get wan2_ipaddr) -j DNAT --to $(nvram get lan_ipaddr)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">if [ $(nvram get remote_management) -eq 1 ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -p tcp -d $(nvram get wan2_ipaddr) \</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> --dport $(nvram get http_wanport) -j DNAT --to $(nvram get lan_ipaddr):$(nvram get http_lanport)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">if [ $(nvram get dmz_enable) -eq 1 ]; then</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> DMZ_IP=$(nvram get lan_ipaddr | sed -r 's/[0-9]+$//')$(nvram get dmz_ipaddr)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -A PREROUTING -t nat -d $(nvram get wan2_ipaddr) -j DNAT --to $DMZ_IP</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">fi</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A PREROUTING -t nat --dest $(nvram get wan2_ipaddr) -j TRIGGER --trigger-type dnat</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A FORWARD -i $(nvram get wan2_ifname) -o $(nvram get lan_ifname) -j TRIGGER --trigger-type in</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A PREROUTING -t mangle -i $(nvram get wan2_ifname) -j IMQ --todev 0</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A PREROUTING -t mangle -i $(nvram get wan2_ifname) -j SVQOS_IN</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A POSTROUTING -t mangle -o $(nvram get wan2_ifname) -j SVQOS_OUT</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#DD-WRT END</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#Save the gateway in the connection mark for new incoming connections</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -A PREROUTING -i $(nvram get wan_ifname) -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x100</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -A PREROUTING -i $(nvram get wan2_ifname) -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x200</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"># Save the gateway in the connection mark for new outgoing connections</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -A POSTROUTING -o $(nvram get wan_ifname) -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x100</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -A POSTROUTING -o $(nvram get wan2_ifname) -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x200</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"># Use the correct gateway for reply packets from the LAN</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -A PREROUTING -i $(nvram get lan_ifname) -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"># Use the correct gateway for reply packets from local connections</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#mask known packets to its source address</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A POSTROUTING -t nat -m mark --mark 0x100 -j SNAT --to-source $(nvram get wan_ipaddr)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A POSTROUTING -t nat -m mark --mark 0x200 -j SNAT --to-source $(nvram get wan2_ipaddr)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#permit access to wan2</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -A POSTROUTING -t nat -j MASQUERADE -o $(nvram get wan2_ifname)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#restore-mark is done in PREROUTING. If restored again, will loose the outgoing marks</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">iptables -t mangle -D SVQOS_OUT -j CONNMARK --restore-mark 2&gt; /dev/null</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#iptables -t mangle -A PREROUTING -i $(nvram get lan_ifname) -m multiport -p tcp --dport 22,25,80,110,119,143,443,993,3389 -j MARK --set-mark 0x100</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#use WAN1 for common navigation, WAN2 for P2P traffic and others</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#iptables -t mangle -I PREROUTING -i $(nvram get lan_ifname) -s 192.168.1.100 -j MARK --set-mark 0x200</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">#iptables -t mangle -I PREROUTING -i $(nvram get lan_ifname) -s 192.168.1.100 -j LOG --log-prefix 'P2P: '</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">RP_PATH=/proc/sys/net/ipv4/conf</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">for IFACE in `ls $RP_PATH`; do</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> echo 0 &gt; $RP_PATH/$IFACE/rp_filter</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">done</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&lt;/pre&gt;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Once everything works, you should use the command ' ip route equalize' (search with Google for the syntax) to balance the load, or do a -j MARK --set-mark 0xN00 via iptables to redirect your traffig to WAN1 (0x100) or WAN2 (0x200)</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">If you need further assistance, post in forums or [http://www.dd-wrt.com/phpBB2/privmsg.php?mode=post&amp;u=567 PM]-me</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">The firewall scripts does not yet implement the full DD-WRT firewall, only the basic port/range forwarding.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">This is script works for both outgoing AND incoming connections (most scripts only treats outgoing), so you should be able to accept connections in both links simultaneous (eg. web in one and FTP in another).</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">[[Category:advanced HOWTO]]</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:Advanced tutorials]]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:English documentation]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:English documentation]]</td></tr> </table> Thu, 15 Feb 2007 01:45:24 GMT Whiteboy http://wiki.dd-wrt.com/wiki/index.php/Talk:Dual_WAN_with_one_as_standby_backup