ASPENSMONSTER

May 12, 2011

Flashing the WRT54G v5 with dd-wrt

Filed under: Uncategorized — aspensmonster @ 3:11 am

Flattr this!

dd-wrt logo

I know this isn’t anything new. However, I figured I’d provide a unified guide to the process for anyone who finds himself the owner of a WRT54G in the year 2011. The resources are out there, but they tend to be scattered across different posts in different threads across different forums. The primary source is certainly thorough enough:

http://www.dd-wrt.com/wiki/index.php/Linksys_WRT54G_v5.0_%26_5.1_%26_6.0

but figuring out the various kinks to get it working with my network (Xbox 360 with a WGA54T v2.1 wireless bridge, routers behind routers, SBC Global / AT&T DSL, Speedstream 5100 DSL modem) proved more difficult to find.

 

0.) Definitions

  • Power Cycle – Remove the power cord from the device in question for 30 seconds, and then reconnect it.
  • Hard Reset – With the device on, hold the reset button down for 30 seconds. Continuing to hold the reset button, unplug the power cord from the device for 30 seconds (a powercycle, basically). Continuing to hold the reset button, plug the power cord back into the device and hold the reset button for 30 more seconds before letting go. In short, the reset button should be depressed the entire time.

1.) Preparing the required tools

You can download the required tools from this forum page :
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=58231

Local mirror (please only use if previous link is down) : Gv5Flash.zip

  1. Extract this zip to a location that you’ll remember come time to use the tools inside it (like the Desktop).
  2. Extract the vximgtoolsgui.zip file in the same folder.
  3. The final file structure ought to look like this:
    • Gv5Flash
      • vximgtoolgui
        • cfe.bin
        • common.dll
        • vximgtoolgui.exe
        • wrt_vx_imgtool.exe
      • dd-wrt.v24-12548_NEWD_micro.bin
      • tftp.exe
      • vxworks_prep_v03.bin
 

2.) Installing dd-wrt

UPDATE May 11 2011 : The firmware that is installed by downloading the above zip is old. It still works for flashing the router, but I highly advise you immediately flash to the latest firmware revisions once you successfully complete the process below with the older firmware. You can see section seven for upgrading to the latest firmware revisions.

Now for the fun stuff! You know, actually installing dd-wrt. This section is pretty much verbatim from this link: http://www.dd-wrt.com/wiki/index.php/Linksys_WRT54G_v5.0_%26_5.1_%26_6.0

CAUTION The Gv5Flash.zip file contains windows binaries. I’ve heard that they run fine in wine, but I decided to complete this process under a windows installation just to avoid any potential pitfalls going that route.
  1. Connect your machine to one of the LAN ports on the router. Disconnect all other routers and wireless devices, and turn off any firewalls. (I did most of this install with my DSL modem hooked into the WAN port, your mileage may vary.)
  2. Assign your computer a static IP address 192.168.1.7 with subnet mask 255.255.255.0 ( in windows, Control Panel >> Networking >> Manage Connections >> Right-click card + Properties >> Select TCP/IP v4 >> Click properties >> Assign static info)
  3. Perform a Hard Reset of the router.
  4. Start VXImgToolGui.exe . Make sure you’ve selected WRT54G, supply the MAC address (usually located on the bottom of the router) and save the image as My54gImage.bin inside the Gv5Flash folder.
  5. Perfom a Power Cycle of the router.
  6. Navigate to 192.168.1.1 in the browser. The login is username “root” and password “admin”. You should NOT be at a Management Mode page. If so, Power Cycle again.
  7. Go to Administration and Firmware upgrade and select the “vxworks_prep_v03.bin” file in your Gv5Flash folder and hit upgrade.
  8. Once the upgrade is complete, wait FIVE FULL MINUTES and then Power Cycle the router.
  9. Browse to 192.168.1.1 (if there’s a blank page, clear cache and try again). You’ll be in Management Mode. Select the My54gImage.bin file you created and hit Apply.
  10. Wait for the “Update Success” prompt and then wait FIVE FULL MINUTES before proceeding.
  11. Start up tftp.exe and do the following:
    1. Enter 192.168.1.1 for the address.
    2. Leave the password blank.
    3. Select the “12548 Newd_Micro.bin” firmware.
    4. Set retries to 99.
    5. Power Cycle the router.
    6. Wait 30 more seconds.
    7. Hit Upgrade.
  12. After you get the Success prompt, wait FIVE FULL MINUTES.
  13. Attempt to access the dd-wrt webgui at 192.168.1.1 . Once you can access, Power Cycle your router.
  14. Attempt to access the dd-wrt webgui at 192.168.1.1 again. Once you can access, Hard Reset your router.
  15. Attempt to access the dd-wrt webgui at 192.168.1.1 again. If you can access, reset your ethernet connection to automatic settings (as opposed to the static settings we gave earlier).

3.) Configuring PPPoE DSL with Speedstream 5100

This was one of the trickier aspects of getting dd-wrt working. My previous wireless router did not require me to make any changes whatsoever with my DSL modem. Not the case here. However, once the DSL modem is set up correctly, getting PPPoE running is a snap.

  1. Disconnect the router from the computer and plug the DSL modem directly into the computer.
  2. Connect to the modem. On my Speedstream 5100 it is at address 192.168.0.1 .
  3. Click on setup (I think) and set it to bridge mode.
  4. It may ask you for an access code. It is a ten digit code typically printed on the bottom of the modem.
  5. Reboot the modem.
  6. Connect the computer back to the router, and plug the ethernet out port on the modem into the WAN port on the WRT54G router.
  7. Enter the dd-wrt webgui.
  8. Under setup, switch from DHCP to PPP connection.
  9. Provide your credentials and save.
  10. Power cycle both the router and the modem.

At this point, the modem should be bridging between the ISP and your router and you should have internet access. I didn’t need to modify any of the other settings. I would leave them all at default unless otherwise necessary.

 

4.) Configuring Wireless Xbox 360

I use an old (original Xbox era) wireless gaming bridge, WGA54G v2.1 . Apart from not supporting the WPA2 protocol, it still does its job just fine.

Notes regarding WEP encryption and authentication

I encountered errors with WEP. I originally had my wireless network using WEP encryption (yes, I know it’s insecure) and for the life of me, I could not get the Xbox 360, WGA54G, and dd-wrt WRT54G to successfully connect to each other. The best that would happen is the Xbox 360 would recognize the wireless network, but would not authenticate.

I suspect this is because on my old wireless router, I had the option of using a 128-bit alpha-numeric passphrase, which still had to be 13 characters long, but wasn’t limited to 0-9 and A-F. I’m guessing that dd-wrt doesn’t support this functionality and that this is why the Xbox 360 wasn’t able to authenticate. I tried getting my G1 smartphone to authenticate against WEP and it too wouldn’t budge when I tried the alphanumeric key. So I’m pretty confident this was the problem. Gave me an excuse to upgrade to WPA in any case. If you absolutely must use WEP, then I’m guessing you will have to use the hex keys.

Configuring the WGA54G v2.1

However, using WPA meant I would need to reconfigure the WGA54G. I couldn’t find the disc with the software to do this and tried looking online for the software. I couldn’t find it anywhere. The best I could find was a guide from Linksys stating to access the device directly via a browser, something that I could not accomplish. Several hours later, I found the disc. If you too cannot access the device directly and cannot find your disc, I present it to you in the form of a .iso :

wga54gv2-1.iso

The instructions from this point on are simple:

  1. Connect the WGA54G directly to the computer.
  2. Load the CD into your computer (or mount the above image)
  3. Follow the prompts to use the device as a bridge (NOT head-to-head gaming) and use WPA encryption. Specify the SSID and password.
  4. It will ask you if you want to use a static ip or dhcp. It doesn’t matter. We’ll be sidestepping this with a static lease to the Xbox 360 MAC address.
  5. Find the Xbox 360’s MAC address. Xbox 360 >> System >> Network Settings >> Edit Settings >> Additional Settings >> Advanced Settings >> Wired MAC address.
  6. Use those^ settings in the Network Settings area of the Xbox 360.

Setting up Port Forwarding for the Xbox 360

I’m not sure if these are entirely necessary or not –I added them while I was still trying to get WEP to work– but it can’t hurt to enable them. The port forwarding section is located at the WebGUI >> NAT/QoS >> Port Forwarding .

 
Application Port From Protocol IP Address Port To Enabled
xbox360 3074 Both $your_xbox_static_ip 3074 Checked
xbox360 88 Both $your_xbox_static_ip 88 Checked
xbox360 53 Both $your_xbox_static_ip 53 Checked
xbox360 80 TCP $your_xbox_static_ip 80 Checked

Be sure to hit the “Apply Settings” button at the bottom once the table is filed in. Failing to do so will not save the table and you will have to redo the table. Also, by $your_xbox_static_ip I mean whatever IP address (192.168.1.*) you assigned for the DHCP static lease for the Xbox 360.

 

5.) Port Forwarding for torrents, minecraft, steam, etc

I would again recommend a static lease for the machine that will be using the service. You could utilize UPnP, but I prefer the linear approach that leaves control over the network in my hands. Once you have a static IP leased for the box in question, set up the following port forwards for torrenting and steam.

NAT/QoS >> Port Forwarding >> Add

The minecraft port forward is only necessary if you are running a minecraft server (which I am). I have never needed to add port forwards just to use the client and connect to other servers.

 
Application Port From Protocol IP Address Port To Enabled
minecraft 25565 Both $your_minecraft_server_static_leased_ip 25565 Checked
torrent $your_incoming_listening_port Both $your_machine_with_torrents $your_incoming_listening_port Checked

NAT/QoS >> Port Range Forwarding >> Add

Application Start end Protocol IP Address Enabled
steam 27000 27015 UDP $static_ip_of_client Checked
steam 27020 27039 TCP $static_ip_of_client Checked

If you have multiple devices on your network that need to use the same service, then you could establish the above settings under port triggering instead. This will only work if the machines in question are not querying the same services (same port) simultaneously. If there are multiple devices that must all access the same service (same port) simultaneously then you are limited to either UPnP or port staggering. By port staggering I mean, for example with torrenting, giving each torrenting machine it’s own listening port. For other services (like steam gaming) it may or may not be possible to force the client to use a particular port (like 27015-27030 for counter-strike, for example).

Update May 11 2011 : Open steam >> Library >> Right-click the game you want to play simultaneously >> Properties >> Set Launch Options and add “-p 27001″ (or any other port between 27000 and 27015) . You will then need to assign a port forward for this particular port for the IP of the machine in question.

 

6.) Final Stable Configuration and Conclusions

I consider stable to mean optimally functional while simultaneously under all of the following conditions:

  • Maximum download and upload speed
  • Torrents (up to 500 simultaneous connections)
  • Netflix Streaming (via wireless Xbox 360)
  • 2 other wireless clients browsing the web (youtube, etc)
  • At least one other wired client browsing
  • Extensive QoS listing
  • Extensive Port Forwarding listing
  • 3 DHCP Mac-based static leases

If the router cannot handle this kind of behaviour, then that means it’s time to either overclock or upgrade to a better router. Sadly, the WRT54G v5 cannot take all of those at once. This particular board just can’t handle torrent traffic, even with simultaneous connections as low as 70 and 80. It cannot handle torrent traffic even when that is the sole source of network activity (one machine >> WRT54G >> Modem >> Internet) and yes, one machine >> Modem >> Internet performed just fine with connections in the 100-200 range. However, removing torrents from the equation permits all of the other functionality to operate simultaneously.

Conclusions

If there is one thing keeping dd-wrt from a perfect score on this particular router, it’s the QoS. It’s horrendous. Simply having QoS turned on, even without any rulesets, causes the router to become inaccessible both via web interface and telnet. It still serves content but at a stunted pace. Perhaps it’s just the WRT54G v5 hardware (I will be putting dd-wrt on a WRT54G-TM next) but I’ve heard otherwise. I’ll be making another blog post about flashing the WRT54G-TM and if QoS is poor there too, then it will turn into a guide to put Tomato on the WRT54G-TM instead (Tomato is another open-source firmware that is prized for its interface and impressive QoS abilities).

As well, I’ve heard that the WRT54G v5 is a complete piece of shit when it comes to torrenting. Given my experience, I’m inclined to agree. Enabling torrenting for even a few minutes renders the dd-wrt web interface and telnet inaccessible, as well as the wireless access point. Wired data and torrents will still run though (for a few hours at least usually before requiring a power cycle). The link recommends the WRT54GL instead. It appears that even dd-wrt agrees, as noted in this wiki article regarding “neutered” WRT54G routers.

All in all, I would not recommend this router. I enjoyed the learning experience, and it does run fine without torrents, but it really is too neutered to trust with anything substantial. However, I would recommend dd-wrt, crappy QoS not withstanding.

 

7.) Upgrading to latest firmware (build 14896)

The instructions above work very well for getting an old version of dd-wrt on the WRT54G v5. However, I would recommend running the latest available build to avoid any nasty bugs. I encountered a bug wherein the router would be configured to have a WPA secured access point, but would instead broadcast as WEP, rendering the access point visible but inaccessible to any nearby devices. Turns out it was a bug that was fixed in a later revision of the firmware.

In any case, visit the dd-wrt.com website and search the router database for “WRT54G”. Select the v5, and then from the drop-down choose the latest available build (14896). It is a .bin file. Download this file.

  1. Be sure to write down any configuration settings you have (you cannot migrate settings from one firmware version to another).
  2. Perform a hard reset of the router.
  3. Log into the webgui and navigate to Administration >> Firmware Upgrade
  4. Choose to restore to defaults after flashing
  5. Browse for the .bin file you got from dd-wrt and then click Upgrade.
  6. After a few minutes, a new prompt should pop up saying that the upgrade was successful. WAIT FIVE MINUTES before clicking continue.
  7. Perform another hard reset
  8. If you can log in, then the firmware was upgraded successfully.

Personally, I didn’t heed the recommendation to perform a hard reset prior to upgrading. When I clicked the Upgrade button, I let it sit there for a good 20 minutes with no results. I then power cycled the router and was able to log back in. The firmware appeared to have been upgraded. I performed a hard reset and then logged in again. The firmware change persisted. I then added all my settings back in.

2 Comments »

  1. Excelent resource. I flashed my router’s firmware, flawlessly thanks to you and the dd-wrt wiki.

    Thank you. I have been delaying this flashing for about 3 years now. I made it a weekend’s project and so far so good. Gave new life to my router. I used Ubuntu and the tools that you mentioned work fine in wine.

    Comment by Hugo Garro — June 18, 2014 @ 2:09 pm

  2. Dear Monster:
    Thank you for your precise and wonderful guide. In the step number 12 (Start up tftp.exe and such, I wasn’t in the mood to start a Micro$oft Window$ virtual machine, and decided to follow the to install and use the atftp tftp client.


    # sudo aptitude install atftp
    # atftp --option "mode octet" --option "timeout 60" --verbose --trace -p -l dd-wrt.v24_micro_generic.bin 192.168.1.1

    I wrote this down because there might be some other GNU/Linux users around who might find it useful too :)

    Thank you again for your post!

    Comment by Fefu — November 13, 2014 @ 11:34 pm


RSS feed for comments on this post.

Leave a Reply

Your email address will not be published. Required fields are marked *

19,541 Spambots Blocked by Simple Comments

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>