Author Topic: How to turn your dd-wrt router into a dual-wan load balancing router.  (Read 7288 times)

Offline CaptainWTF

  • Highly Active
  • ****
  • Posts: 1993
  • Serious Business
    Points:
    -1188
    • View Profile
Ok I got this off of the SBH forums. All credit goes to its author, I tried it and after installing startup and firewall scripts it bricked and I had to do a 30/30/30 and just redo it all but its nbd. you do lose 1 ethernet port in the process so if you need all 4 ports on your router. Not advised you do this. if you have multiple modems like me and want to combine the speeds of them. this is how to do it.

This is an advanced guide to setup two modems on a DD-WRT firmware based router through static ip modem configuration


Things you will need:

-Two modems coax connected and ready to go online.

-Linksys WRT54GL v1.1 on Firmware DD-WRT v24-sp2 (01/10/09) mini build
*this method might work on other firmwares but this is the one I'm running it on..

-A Computer.

-Dualwan_scripts.rar (attached at bottom)

-Pen and Paper

-Patience... Trust me its worth it!!



Primary Setup:


1. Plug modem one CAT5 Cable into WAN port on router. (leave off do not turn on)
2. Plug modem two CAT5 Cable into port four on the router. (leave off do not turn on)


Router Setup


1. Configure vlan2 physical ports.


a ) telnet into router through windows command prompt by going into START>>RUN>>CMD>>telnet 192.168.1.1>> Username: root Password: admin
Once logged into router copy/paste in the following line by line:


nvram set vlan0ports="1 2 3 5*"
nvram set vlan2ports="4 5"
nvram set vlan2hwname="et0"
nvram commit
reboot


b ) Logon to router's webgui through internet explorer or firefox and type 192.168.1.1 and go to [SETUP] tab, then [VLANs] tab. Uncheck port 4 from "vlan 0" and then place a check on port 4 on "vlan 2" Then hit [Apply Settings] then hit [Save].



2. Mac Address clone vlan2.


Here is where it gets fun... here we want to spoof the modem into thinking vlan2 is a computer and not a router. The reason for this is because some isps can detect whether or not you are sitting behind a router through your routers mac address and tend to either Cap or slow down your speeds to prevent overhead on their network. (Lame)


a) In webgui , in [SETUP] tab goto [MAC Address Clone] tab and choose enable then click on [Get Current PC MAC Address] button. Now on the last four digits you want to change it to something different (because we are going to repeat this step similar later on for vlan1). Remember MAC addresses are written from 0-9 and A-F.

Once you have changed the last four digits click [Apply Settings] then [Save]
*Be sure to write down that MAC address for later.




3. Setting up vlan2 as a WAN and retrieve IP/SUBNET information.



a ) While in webgui in the [SETUP] tab goto the [Networking] tab and scroll down to PORT SETUP. On WAN Port Assignment choose vlan2 then click [Apply Settings] then [Save].

b ) Goto the [Administration] tab and click on the [Reboot Router] Button


c ) Next turn on the modem that is connected to port 4 on the router (leave on).


d ) Go back to your telnet window and re login to your router.



e ) In the telnet prompt type the command: ifconfig wait for a list of information to show up and look for vlan2 in the list then write down all of the information (ip addresses) that appear in the second line which are: inet addr:, Bcast:, and Mask.



f ) Go back to the webgui and click on the [Status} tab then click on the [WAN] tab and write down the Gateway ip address listed there.

-Now we have what we need to set vlan2, next were going to prepare vlan1 and scripts for dual wan.








4. Setting up vlan1 Back to router as Primary WAN and spoofing MAC.


a ) in webgui go back to the [SETUP] tab then goto the [Networking] tab scroll back down to [Port Setup] then [WAN Port Assignment] and choose vlan1 then click [Apply Settings] then [Save]



b ) Now goto the [MAC Address Clone] tab and click on the [Get Current PC MAC Address] button then click [Apply Settings] and then [Save]



c ) Goto the [Administration] tab and click [Reboot Router]



d ) Turn on modem connected on WAN Port (leave on)




5. Editing/Installing NVRAM Startup script and NVRAM Firewall



a ) In a text editor open Startup_Script.txt from the dualwan_scripts.rar In here we are going to edit the first few couple of lines from the top with written down info.

Lines to edit:



"ifconfig vlan2 hw ether 00:00:00:00:00:00"
"WAN2_IPADDR=write inet adder here"
"WAN2_BROADCAST=write Bcast here"
"WAN2_GATEWAY=write Gateway here"
"WAN2_NETMASK=write Mask here"




b ) Change all the 0s to the MAC address you wrote down for vlan2


c ) Copy all the ip addresses you wrote down into their locations as per text and right after the = sign


d ) Save Startup_script.txt and then select all or [Ctrl+A] the text



e ) Goto webgui and click on the [Administration] tab then click on the [Commands] tab



f ) In the Command Shell Box Paste all text from Startup_script.txt into the box then click on [Save Startup] Button



g ) Open Routes_Firewall.txt and select all or [Ctrl+A] text.



h ) Go back to webgui and paste text from Routes_Firewall.txt into the Command Shell Box then click the [Save Firewall] button. Then click on [Management] tab and click [Reboot Router]






At this point you should be up and running on Dual Wan!! Enjoy!! :D

-What took me two days to figure out on my own should hopefully take you an hour or so to setup. ;)





To test:


Telnet into router and type the command: ifconfig

-If you followed everything correctly You should now see vlan1 and vlan2 in that list both with their own sets of addresses

Also type the command: ip route

-you should see two lines at the bottom that say:

nexthop via xx.xxx.xx.1 dev vlan1 weight 1
nexthop via xx.xxx.xx.1 dev vlan2 weight 1


Now try out speedtest.net and see what happens or use any download manager and check your speeds they should increase!!


http://www.mediafire.com/?0izp74ldvsrcwkw

Scripts. ^^^^
« Last Edit: July 20, 2011, 02:24:55 PM by [IAM] CaptainWTF »
"Tell the firewall to fuck off"
"Don't be an asshat. No one likes asshats. A cap is alright. A hat is nice. having an ass is compulsory. Combining an ass and a hat? Not a good idea, take it off."






___
Corsair 800D
EVGA Z68 SLI motherboard
Intel i5 2500k
8gb G.Skill Ripjaw memory @ 667mhz
EVGA GTX 560 Ti video card @ 900mhz W/ Arctic Cooling Accelero Xtreme Plus II
Samsung 830 series 128gb SSD
Corsair HX850 850w Modular PSU
APC BR1500G 865w UPS

Offline [IAM] Thats Enough

  • [IAM] Member
  • MIA
  • *****
  • Posts: 4918
  • Serious Business
    Points:
    80
  • I play with waves.
    • View Profile
    • LinkedIn Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #1 on: April 19, 2011, 11:43:42 AM »
Why do you have two modems?

Offline CaptainWTF

  • Highly Active
  • ****
  • Posts: 1993
  • Serious Business
    Points:
    -1188
    • View Profile
Because one isnt fast enough to download all of this porn :) haha JK. because I have two. I only use the other when I go to my grandmas really.
"Tell the firewall to fuck off"
"Don't be an asshat. No one likes asshats. A cap is alright. A hat is nice. having an ass is compulsory. Combining an ass and a hat? Not a good idea, take it off."






___
Corsair 800D
EVGA Z68 SLI motherboard
Intel i5 2500k
8gb G.Skill Ripjaw memory @ 667mhz
EVGA GTX 560 Ti video card @ 900mhz W/ Arctic Cooling Accelero Xtreme Plus II
Samsung 830 series 128gb SSD
Corsair HX850 850w Modular PSU
APC BR1500G 865w UPS

Offline totko123

  • MIA
  • *
  • Posts: 1
  • Serious Business
    Points:
    0
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #3 on: September 08, 2011, 08:08:19 AM »
Hey very nice solution. I tried it but i have some troubles. It is working only one from two WANs. I'm using WRT54GL  with dd-wrt 10/10/09 .
I have one cable modem from 1st ISP wich giving me IP,MASK, DNS using DHCP  and another ISP with LAN wich is fixed IP/MASK/DNS. Actually i preferre to use a second ISP as basic and 1st as backup.  Of cource to use the both balanced is better. For vlan 1 I put ISP with DHCP and for vlan2 i'm using a script from you.
For both ISPs the MAC address is the same.
Form router isnt comming internet when WAN Port Assignment is vlan1. It is assigning ip address from DHCP but there isnt internet.
When I put WAN Port Assignment to vlan2 there is internet but there isnt internet from 1st ISP from cable modem.
 when testing ip route
second ISP ip address /24 dev vlan2  proto kernel  scope link  src second ISP ip address
192.168.1.0/24 dev br0  proto kernel  scope link  src 192.168.1.1
169.254.0.0/16 dev br0  proto kernel  scope link  src 169.254.255.1
127.0.0.0/8 dev lo  scope link
default equalize
        nexthop via second ISP ip address   dev vlan2 weight 1
        nexthop via second ISP ip address   dev vlan2 weight 1

there is not a row for vlan2
I will be happy if you suggest me where is mistake in my case.
best regards

Offline CaptainWTF

  • Highly Active
  • ****
  • Posts: 1993
  • Serious Business
    Points:
    -1188
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #4 on: September 08, 2011, 04:43:30 PM »
169.254.0.0/16 dev br0  proto kernel  scope link  src 169.254.255.1

its having issues with contacting the DCHP server basically thats a relatively common issue. I haven't a clue where your issue is particularly neither.

Quoted from packetlife.net
"Occasionally you may encounter a host which has somehow assigned itself an IP address in the 169.254.0.0/16 range. This is a particularly common symptom of Windows machines which have been configured for DHCP but for whatever reason are unable to contact a DHCP server. When a host fails to dynamically acquire an address, it can optionally assign itself a link-local IPv4 address in accordance with RFC 3927. Microsoft's term for this is Automatic Private Internet Protocol Addressing (APIPA).

The purpose of these self-assigned link-local addresses is to facilitate communication with other hosts within the subnet even in the absence of external address configuration (via manual input or DHCP). Unlike in IPv6, implementation of IPv4 link-local addresses is recommended only in the absence of a normal, routable address. Hosts pseudo-randomly generate the last two octets of the address to mitigate address conflicts. Because of the broadcast nature of some local networking protocols (for example, Microsoft's NetBIOS), hosts may be able to detect one another even without any preexisting knowledge of the address scheme.

However, in practice, these auto-configured addresses tend to do more harm than good, particularly in SOHO networks. Receiving an IP outside of the expected subnet carries more potential for confusion and frustration for end users than does receiving no IP at all."
"Tell the firewall to fuck off"
"Don't be an asshat. No one likes asshats. A cap is alright. A hat is nice. having an ass is compulsory. Combining an ass and a hat? Not a good idea, take it off."






___
Corsair 800D
EVGA Z68 SLI motherboard
Intel i5 2500k
8gb G.Skill Ripjaw memory @ 667mhz
EVGA GTX 560 Ti video card @ 900mhz W/ Arctic Cooling Accelero Xtreme Plus II
Samsung 830 series 128gb SSD
Corsair HX850 850w Modular PSU
APC BR1500G 865w UPS

Offline suxz

  • MIA
  • *
  • Posts: 1
  • Serious Business
    Points:
    0
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #5 on: April 01, 2012, 02:11:55 AM »
Hello,

Your information is really helpful but before trying I want to have your suggestion regarding the hardware that does this Script/Solution will work on Asus RT-N16 with DD-WRT v24-sp2 technically it should work but i still wanted to have a expert opinions  :)

Thanks in advance.


Offline [IAM] iba

  • [IAM] Member
  • Inactive
  • *****
  • Posts: 543
  • Serious Business
    Points:
    9236
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #6 on: April 01, 2012, 09:16:34 AM »
"but i still wanted to have a expert opinions"

:rofl:

You need to go to the forums where they develop DD-WRT and ask there. CaptainWTF just copy and pasted stuff from other forums here.

Offline CaptainWTF

  • Highly Active
  • ****
  • Posts: 1993
  • Serious Business
    Points:
    -1188
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #7 on: April 01, 2012, 09:27:41 AM »
Yeah I know. I pretty much copied and pasted this from the forums and then I get like people messaging me on these forums asking for help its like. iuno how to help you bro. I tried it. and it kinda worked.

if you wanna do load balancing build a PFsense box. which I totally could do now with my e350 apu setup i have jus sittin around.
"Tell the firewall to fuck off"
"Don't be an asshat. No one likes asshats. A cap is alright. A hat is nice. having an ass is compulsory. Combining an ass and a hat? Not a good idea, take it off."






___
Corsair 800D
EVGA Z68 SLI motherboard
Intel i5 2500k
8gb G.Skill Ripjaw memory @ 667mhz
EVGA GTX 560 Ti video card @ 900mhz W/ Arctic Cooling Accelero Xtreme Plus II
Samsung 830 series 128gb SSD
Corsair HX850 850w Modular PSU
APC BR1500G 865w UPS

Offline [IAM] Error 418

  • [IAM] Member
  • Forum Amateur
  • *****
  • Posts: 218
  • Serious Business
    Points:
    69
  • disperdam te!
    • View Profile
    • Error 418
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #8 on: April 01, 2012, 10:37:34 AM »
To test:


Telnet into router and type the command: ifconfig

-If you followed everything correctly You should now see vlan1 and vlan2 in that list both with their own sets of addresses

Also type the command: ip route

-you should see two lines at the bottom that say:

nexthop via xx.xxx.xx.1 dev vlan1 weight 1
nexthop via xx.xxx.xx.1 dev vlan2 weight 1


Now try out speedtest.net and see what happens or use any download manager and check your speeds they should increase!

I think ifconfig should be ipconfig, windows doesn't have an ifconfig.

you may also need to do ipconfig /all
Error 418 Signature" width="500" height="176

Offline [IAM] Kc2000

  • [IAM] Member
  • Highly Active
  • *****
  • Posts: 494
  • Serious Business
    Points:
    2
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #9 on: April 01, 2012, 05:39:30 PM »
To test:


Telnet into router and type the command: ifconfig

-If you followed everything correctly You should now see vlan1 and vlan2 in that list both with their own sets of addresses

Also type the command: ip route

-you should see two lines at the bottom that say:

nexthop via xx.xxx.xx.1 dev vlan1 weight 1
nexthop via xx.xxx.xx.1 dev vlan2 weight 1


Now try out speedtest.net and see what happens or use any download manager and check your speeds they should increase!

I think ifconfig should be ipconfig, windows doesn't have an ifconfig.

you may also need to do ipconfig /all


It is ifconfig. The test tells you to telnet into the router, not into Windows.


Offline [IAM] squishy

  • [IAM] Member
  • Forum Addict
  • *****
  • Posts: 647
  • Serious Business
    Points:
    69
  • I void warranties
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #10 on: April 02, 2012, 10:06:20 AM »
yes, try ipconfig...hopefully the guys at dd-wrt have written a script that laughs at you for using windows.
(15:36:10) Magnet: u only say WoW sucks when 1. u suck ass 2. u have terrible gear 3. u suck ass
_____________________________________________________________________________________

Offline [IAM] Error 418

  • [IAM] Member
  • Forum Amateur
  • *****
  • Posts: 218
  • Serious Business
    Points:
    69
  • disperdam te!
    • View Profile
    • Error 418
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #11 on: April 02, 2012, 04:45:32 PM »
my bad.... http://www.wlug.org.nz/ifconfig%288%29
your are correct.


GIFSoup
« Last Edit: April 02, 2012, 04:55:57 PM by [IAM] Error 418 »
Error 418 Signature" width="500" height="176

Offline addinul

  • MIA
  • *
  • Posts: 2
  • Serious Business
    Points:
    0
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #12 on: April 05, 2012, 01:51:23 AM »
why i dont make it,,,
can you explain step by step againt and screen shoot about the load balancing

thanks

because i dont understand

Offline chitownmafia

  • Inactive
  • *
  • Posts: 3
  • Serious Business
    Points:
    0
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #13 on: April 15, 2012, 01:46:11 PM »
Dude... If your having issues save your self the time and get the right hardware first. Currently Im running my Dual Wan from a Linksys E2000, after endless hardware configurations I finally got my dual wan working properly. The only difference in my configuration is that instead if using two cable modems I am using 2 wireless client bridges and I have DHCP working on both wan ports on my load balancer. Here is my youtube video of my setup "youtube.com/watch?v=xTMiAAw0kHo" , maybe you can get a better understanding by watching. If you need anything let me know I can point you in the right direction. 

Offline CaptainWTF

  • Highly Active
  • ****
  • Posts: 1993
  • Serious Business
    Points:
    -1188
    • View Profile
Re: How to turn your dd-wrt router into a dual-wan load balancing router.
« Reply #14 on: April 15, 2012, 04:40:32 PM »
This thread should be deleted.

I dont think anyone here has interest in this anyways.
"Tell the firewall to fuck off"
"Don't be an asshat. No one likes asshats. A cap is alright. A hat is nice. having an ass is compulsory. Combining an ass and a hat? Not a good idea, take it off."






___
Corsair 800D
EVGA Z68 SLI motherboard
Intel i5 2500k
8gb G.Skill Ripjaw memory @ 667mhz
EVGA GTX 560 Ti video card @ 900mhz W/ Arctic Cooling Accelero Xtreme Plus II
Samsung 830 series 128gb SSD
Corsair HX850 850w Modular PSU
APC BR1500G 865w UPS