Maximizing Netgear WNDR4500v2 functionality with DD-WRT (USB, FTP, Samba, TFTP, Printer sharing)

Maximizing Netgear WNDR4500v2 functionality with DD-WRT (USB, FTP, Samba, TFTP, Printer sharing)

wndr4500The Negear WNDR4500v2 router is quite a beefy piece of hardware, boasting 128MB of RAM and 128MB of flash. It also has a 4-port Gigabit switch and Gigabit WAN, plus dual-band (2.4GHz and 5GHz) wireless, for up to 900Mbps combined connectivity.

The original firmware is also quite extensive, including plenty of features even for a maniac user like me. I would most likely not have replaced it from day 1 however if it had one more feature that I absolutely needed: TFTP/PXE/BootP options for the DHCP server.

So, after using DD-WRT on the trusty old WRT54GL for almost 4 years (which although still works like a charm no longer handles my connection speed), I decided to jump right back to DD-WRT (as I had most of the stuff already configured and migration should have been very smooth).

Firmware choice

After reading various topics and posts about the best DDWRT firmware edition to use on my new Netgear WNDR4500v2, I flashed the latest (at the time) K3-AC flavour of the DD-WRT firmware:

http://www.desipro.de/ddwrt/K3-AC/23770/

However, I pretty quickly found at that although rock-stable (for the 2-3 days I used it), this edition lacks the Samba/FTP functionality I desired.

So I switched to the main-branch (nicknamed brainslayer) DD-WRT, particularly:

ftp://ftp.dd-wrt.com/betas/2013/2014/03-13-2014-r23720/netgear-wndr4500v2/

  • chk file is for initial Netgear to DDWRT flash
  • bin file is for subsequent DDWRT to DDWRT flash

Enabling USB

Usb support is enabled from Services > USB. Printer support is only needed if you plan to connect a printer and share it to the network.

ddwrt-usb

I will be using a 32GB stick formatted in 3 partitions:

  • 768MB ext2 labelled ‘Optware’ – mounted as /opt
  • 512MB ext2 labelled ‘JFFS’ – mounted as /jffs (which is not enabled in the UI to prevent overlapping)
  • the rest ext2 labelled ‘Storage’ (for data storage)

The stick will be used for both file storage (accessible mostly via Samba to network clients) and FTP (to be used together with PXE and TFTP for image/boot files)

The first two partitions on the stick will be automatically mounted by DDWRT based on their labels, as seen here.

FTP and Samba

FTP and Samba are both configurable via the WebGUI, in Services > NAS. The options are pretty much self-explanatory.

ddwrt-ftpsamba-crop

Optware / OTRW2 / DD-Ware

Original Optware and OTRW2 do not work with K3.x based firmwares. BasMaf forked a compatible branch which he named DD-Ware:

http://basmaf.com/blog/otrw2_and_dd-wrt_kernel_3x/

I successfully installed DD-Ware using the install script at

http://dd-ware.googlecode.com/svn/install/install.sh

then installed my wanted packages using

opkg update
opkg install package-name

If the installed packages are no longer found after a reboot, add this

mount --bind /opt /mmc

to the startup script.

DD-Ware is needed for additional tools (like htop) and the later-used TFTP server.

TFTP and PXE boot support

The DHCP Server needs to be configured to send necessary PXE/network boot information to network clients.

This information will be provided at a later time as a tutorial of its own.

TFTP package is tftpd-hpa (available only via DD-Ware), and it can be started with

tftpd-hpa -l -s /tmp/mnt/sda3/storage/boot/

No other configuration is necessary. You can replace the sda3/storage/boot part with the actual path of the folder holding your TFTP structure. Add that line to DDWRT’s startup script so TFTP is immediately available after boot.

Printer Sharing

The router, having 2 USB ports, can also be sued to share a printer to the network so it is available to all computers at all times.

Start by connecting the printer and make sure it is detected with dmesg | grep usb

usb 1-1.2: new full-speed USB device number 4 using ehci-pci
usblp 1-1.2:1.0: usblp0: USB Bidirectional printer dev 4 if 0 alt 0 proto 2 vid 0x03F0 pid 0x7604

Out of the above output we figure out the printer port should be /dev/usb/lp0. Since this system file is no longer created automatically since kernel 2.6, we create it manually with

mknod -m 660 /dev/usb/lp0 c 180 0

After this, reboot the router. After the reboot, check that p910n (the print server) is running and sharing your printer:

# ps | grep p910
1574 root       780 S    {p910nd} p9100d -f /dev/lp0 0 -t 5
4074 root       780 S    {p910nd} p9100d

All that’s left is to install the printer on your client machine. Remember it can be found on the IP of your router, port 9100 and type RAW.

Conclusions

In the first days of testing (as an AP only) I noticed random lag issues and reboots. Monitoring it with htop while the issues occurred the cpu usage would go up to 100% for a couple of minutes (kernel time) before rebooting. At one time the resetbutton process was using the CPU 100%.

So I went through the settings and disabled all services that I don’t need at this very moment: SNMP, VPN (which I plan to re-activate at a later point), and UPnP. After this the random reboots (and spikes in CPU usage) went away. I still get random spikes in lag (from 1ms to 300-500ms of lag while pinging the router via wireless), but these spikes last a couple of minutes and then things return to normal (I have several devices connected via wireless at that particular moments, so it’s difficult to debug).

More conclusions after one month of use

I have later re-enabled SNMP (for monitoring with Munin) without adverse results. I also managed to pinpointed the source of wireless interferences to my wireless headphones (which apparently use the same 2.4Ghz band). The WNDR4500v2 is now my main router and handles all my network traffic for up to 5 PCs at once plus about 4 phones and 3 laptops via wireless simultaneously without hiccups.

The wireless issues due to the headphones still occur, but I figured out the are very position-dependent; moving around the room (or simply moving the router around) reduced them to about 5-10 seconds of lag every 30-60 minutes while the headphones are actually in use.

Sometime Samba forgets to start after a reboot. Adding the following commands to the startup script should take care of it:

cp /opt/etc/smb.conf /tmp/smb.conf   
/usr/sbin/smbd -D --configfile=/tmp/smb.conf
/usr/sbin/nmbd -D --configfile=/tmp/smb.conf

One thing I noticed is the WNDR4500v2 with DD-WRT has quite a long boot time (over a minute and a half) so do be patient when you’re rebooting it (don’t freak out that you bricked it). The original Netgear firmware was quite a lot faster.

Even later…

The following DDWRT revisions are personally tested and worked on my WNDR4500v2 at various times:

  • 23720 – did not notice any issues
  • 26490 – beside occasional failure to reload page after a settings apply, nothing ever malfunctioned
  • 29002 – freshly installed; will update status after a while

The only downside of using DD-WRT I’ve found so far is the lack of hardware NAT support (which limits my current gigabit connection to ~100Mbps)

8 Comments

  1. I have a Netgear N900 WNDR4500v3 ( http://support.netgear.com/product/WNDR4500v3 ) and it only accepts firmware in .img format, not .chk anymore, I am not able to upload dd-wrt firmware (I have tried with dd-wrt.v24-25697_NEWD-2_K3.x_mega-WNDR4500V2.chk , dd-wrt.v24-25974_NEWD-2_K3.x_mega-WNDR4500V2.chk and dd-wrt.v24-K3_AC_ARM_STD.chk ), just after selecting the file and pushing upload it returns an error of “incorrect file format”. Renaming them to .img file neither works.

    Damn it 🙂

    I also tried to upload it trough TFTP and neither works, it returns a timeout (I have done so many factory resets….)

    Manuel
    1. They might have changed protection/checksum/magic number.

      However I would not try to flash a different revision firmware to a router. Manufacturers usually change hardware inside the router when they change revisions, and in worst case scenario (when flashing does work) you brick the router.

      Zed
    1. Apparently Basmaf decided to remove that page. You can however perform the rest of the steps (the install script is still available).
      I did not test 2 USB drives, but I use a flash stick and a printer, so the USB part of things works fine in DDWRT on this router (at least in the firmware build I have).

      Zed

Leave a Reply