DD-WRT Bridging for Dummies

I have about, oh, I don’t know, 6, maybe 7 various small wireless routers (WRT54GS, WRT54GL, Buffalo WHR125G, Asus WL-520gc, WRT54G2) that are supported by the DD-WRT alternative firmware suite. I love these things because I can set them free to do more than what they were originally built to do.

That said, I hate the documentation available via the DD-WRT community site. It is a demonstration of what’s wrong with wikis: articles that get longer and longer with “I did this and it did/did not work, I did something else and got there, no that won’t work) and all sorts of different instructions that at best should be different articles specifying their special case, rather than append hell. The forums can have helpful suggestions, but since they are quite active, it tends to be hard to find the bits you’re looking for.

So, for my own sake as well as some others, I have a short little bit I want to contribute about my experience making these devices become bridges for wired equipment. Some of you at this point are saying “bridges to nowhere for electricity? What?”

Say you have a device, like a desktop computer or a TiVo, which has a wired Ethernet port. But nowhere near this device is a port to connect it to your router/hub/switch device to give it connectivity. You could probably find something to make this connect to wireless directly, but often these things are more expensive than they need to be or hard to find. But you have a DD-WRT compatible router available? In that case, you can set this up to take the Ethernet from the device and make this connect to your already established wireless network. This type of device in networking terms is called a bridge.

So, let’s get to business. You need to flash your router to a stable version of DD-WRT. Their automated little web app can tell you what you should likely download, and hopefully you have one of the simpler devices. I’m not going to go into specifics on version or steps because frankly, they are all different, and they’ll be more after this article is published. No need confusing this issue with the task at hand. Just get it working and back to the defaults and come back here.

Still here? Okay, fine. The following procedure has worked for me for all the versions of DD-WRT I have used, and is simple, and very repeatable.


  1. Connect to router with a computing device of your choice, via Ethernet (NOT WIRELESS)
  2. Log into router, change username and password as it may request.
  3. Go to Status -> Wireless, and at the bottom find Site Survey.
  4. Run the survey, and when you find your wireless network, hit Join
  5. Router should now have you at the Wireless -> Basic settings. If not already set, switch wireless mode to Client Bridge
  6. DO NOT PRESS “APPLY SETTINGS!!! Hit “Save Settings”
  7. Go to Wireless -> Wireless Security, and add WPA2 key, if necessary (and I hope you have made it necessary…)
  8. DO NOT PRESS “APPLY SETTINGS!!! Hit “Save Settings”
  9. Go to Setup -> Basic Settings, and set an IP address appropriate for your wireless network but NOT handed out via DHCP
  10. Set any other setting, like, the NTP server address so your router can have correct time
  11. DO NOT PRESS “APPLY SETTINGS!!! Hit “Save Settings”
  12. Go back to Administration -> Management, scroll to Remote Access, and turn on Web GUI. A box will open below that to allow you to change the port if you wish (and would be easier if you made it 80, instead of the 8080 default)
  13. Now, if you want to, you can hit “Apply Settings”. The router will reboot, and should join your network.

What you’ve done is joined your wireless network (and proven your router can see it), and then made it addressable and accessible to the rest of your network. By turning on “Remote management”, you haven’t opened the device to be managed from the Internet, but from inside your already present network (the wireless link is the “outside” interface on your bridge). With its address and port number, you can now get on any device with a browser on your network and pull up the settings for that router just as you would for the one running your network now.

If your computing device is still connected by wire to the bridge, you should eventually see an IP address handed out by your original router, and be able to connect to whatever you connect to on the Internet. The same will be true for any devices you plug into the 4 network ports (NOT the WAN port, unless you changed that to operate as part of your network inside the DD-WRT software). Plug in your formerly disconnected device, and enjoy.

Back to the Beginning

Well, that was pleasant.

So, as some of you are aware, during July 5-6, my site got hacked and became a pro-Islamic web page with bad text and bad scripting.  But I’m back, and I’ve mostly restored the look of my somewhat neglected page.  The content, however, is not as likely to be restored in full, but not because wannabe hacker and little man “MASH3L ALLiL” destroyed anything, or because I couldn’t get a backup (I did get one), but because it is long time that I separated the functions of the blog in the first place. Part of my writing hang up was trying to be multiple things at once on the same blog, and I can be that, but it’ll be much clearer for me to break it up. In addition, having all of these domains pointing to ONE site means it takes one hit for my online presence to be shot to hell. So, I’m breaking it into three.

And hey, “MASH3L ALLiL”! I hope your one day of conquering was worth your time. Oh and I hope you are enjoying the flood of appreciative emails. I know, not likely your real account, but I am spreading the love with plenty of links to some of the nastiest porn on the internet, you moron.

Oh, and I’ll be sure to send money to those opposing the various jihads the radical Islamists are promoting. And I’ll also see about spreading the freedom of speech in Iran and such, just because it will piss you off more.

Keep spreading the love, You have to look deeper for the meaning, but you are close.

Making USB Boot Keys

Okay, so one of the things I have been doing for a long time has been keeping a set of USB keys with me that could help me out of bad situations with computers. For the longest time, I did this using the tools available to me via the SYSLINUX project and Ultimate Boot CD.
Why Ultimate Boot CD? Because it had most of the utilities I would want in an emergency already in a collection, so I didn”t have to assemble much beyond it. I did not make the UBCD work from the USB drive, though, I simply reused the images they had on the disk.
And why SYSLINUX? At the time, I was also running several network servers on a campus, and I needed to have tools available over the network. Since PXELINUX is a derivation from the SYSLINUX Project, the configurations I developed for one would typically work with little modifications to the other, and, I could keep the interface the same for the other folks who might be using them.
How did this work?

  1. Format a USB drive to FAT16/FAT32, depending on what is appropriate for size (I typically go FAT32 when I cross the 1GB threshold)Note: accomplishing this step is the real determinant of your success. A lot of people find success with HP”s USB Key Utility, which works in Windows. I”ve had the most reliable success using Linux (even just a Live-CD) and cfdisk. The key things that need to be done are to have a primary FAT/FAT32 partition, and have it marked as bootable. Then, obviously, the disk needs to be formatted. Disk Management in Windows will only let you format.
  2. Download/install the syslinux utilities. There is a set for Windows (look for win32), and you just have to have them on your machine to use them. For Linux boxes, often your package manager can get you these files.
  3. run syslinux against the drive:
    • Windows: syslinux.exe X: (where X is the drive letter associated with the USB key)
    • Linux: syslinux /dev/DEVICE (where DEVICE is the name of your USB key)
  4. Copy desired disk images to USB drive. Generally, you should NOT have to open these images and copy the files inside over, simply copying them to the drive is good enough.
  5. Copy MEMDISK from the SYSLINUX distribution to the USB drive. This utility allows you to boot floppy and hard drive images. It will not allow you to boot CD images.
  6. Create a syslinux.cfg on the root of the USB that invokes the images you copied
    Example:


    default
    local
    timeout 600
    prompt 0

    These first couple of lines set the default options, as in, which label to boot at time out, a timeout of 600 seconds, without a prompt.


    label local
    localboot

    Next comes the localboot option, which simply causes the machine to poll the next boot device for an OS.


    label rescue32
    kernel /sysrescd/rescuecd
    append initrd=/sysrescd/initram.igz

    The third section define a linux kernel (in this case, a 32bit copy of the SystemRescueCD kernel), and an initial ramdisk to use as the filesystem as it boots.


    LABEL dos
    KERNEL syslinux/memdisk
    APPEND initrd=knoppix/balder.img

    Finally, the fourth section invokes a FreeDOS disk image via MEMDISK, where the boot code and kernel are loaded from the image as if it was an attached disk. The labels are the text you type in at the prompt to select the OS desired.

This was my preferred setup at one institution as I had full control of our network boot environment as well, and since that used PXELINUX (related to SYSLINUX), the configuration files would almost always work with both systems and I could provide the same look and feel.
You will note the use of forward slashes “/” in the configuration, even though the filesystem is FAT based (which usually uses backslashes “\\”. SYSLINUX knows what to do regardless, and can process files in directories as you see here.
But, at this time, I use something else for my boot needs: GRUB.

Why I switched to GRUB

First and foremost: USB flash storage is getting quite large, and frankly, if I don”t have to carry a drive for boots and a drive for file storage, but have these integrated together, then my pockets become less cluttered.
In addition, I can use references to partition UIDs for my boot options so that I can keep my data files on one partition of the drive and my boot files on another, keeping the boot options “hidden” and keeping Windows happy: Windows LOVES to ask if you would like to format a USB drive if the first partition is not FAT/FAT32/NTFS. NO! Bad Windows! Don”t help me destroy my data.
Finally, SYSLINUX restricted my ability to boot to correctly defined parts of a configuration file. GRUB allows me to 1) correct incorrectly defined parts and 2) create my own boot options with a command line.
Flexibility is the name of the game here.
Okay, so how to set this up. Note, I ONLY do this on Linux, because I”m doing a lot of things here.

  1. Partition your USB drive, using fdisk/cfdisk/sfdisk so that the FIRST primary partition is FAT32 (type 0b, likely what you want since FAT16 is good up to 2GB). As I said, this keeps Windows from being format happy. Make this as big as you think you”ll want to have for your data needs. Make this bootable EVEN IF you do not keep your boot stuff here.
  2. Create other partitions as desired. In my case, I wanted the bootable items to be editable on any system I might have around, so, I created this as FAT16 (type 06, I wanted about 2GB). I also created an ext2 (type 83) partition for later use as a pure linux installation that i could keep on my person for my particular needs/rescue operations for my laptop.
  3. Format your partitions as necessary, include label options so that you have nice names for these when you use them wherever you may:
    • mke2fs -L MYLINUXPART /dev/DEVICEPARTID
    • dosfslabel /dev/DEVICEPARTIDofFAT32 MYDATAFILES
  4. Jot down the UUIDs for each partition:vol_id /dev/PARTITIONID #repeat as necessary
  5. Install GRUB onto the drive, with the files on the second partition:grub # enter grub shellroot (hd1,1) # my USB was recognized as disk 2 & I wanted partition 2. GRUB counts from zero.setup (hd1) # install GRUB on disk 2 (my USB). Note no partition mentioned.quit # exit GRUB shell
  6. Copy bootable files/disk images to the partition for your boot stuff. Also, copy over the MEMDISK utility from SYSLINUX because it can still help you out :-)
  7. Edit/Create /boot/grub/menu.lst on the boot file partition.Example:default 0timeout 60title Rebootreboottitle System Rescue 32 bit uuid 857D-BA75 kernel /sysrescd/rescuecd append initrd=/sysrescd/initram.igz setkmap=us root=/dev/ram0title FreeDOS Balder uuid 857D-BA75 kernel /syslinux/memdisk append initrd=/bootdisk/freedos.img Default boot entry is the first one (GRUB counts from zero!). Time out at 60 seconds. The first entry obviously reboots the machine. The second finds the partition on the system with UUID 857D-BA75 (which would be the second on my USB drive), and then loads the SystemRescueCD 32 bit kernel and initram.igz from that partition (with some additional options). Finally, the last entry uses MEMDISK to load out FreeDOS entry, same as before.

Booting from this drive will always find the correct partition for the files (if you took care to copy the UUID correctly), and you can even create options that look for other UUIDs (like, other USB partitions, or, your already installed OS if you want to pass it special options and your bootloader on your system is messed up). Also, unlike SYSLINUX, you don”t have to type in the title/label line; GRUB generates a arrow key navigable menu to select your OS.