Sunday, February 8, 2015

Using a Netgear WNDR3400 as an OpenWRT Wireless Print Server (Part 1)

This is part of a series of blog posts.

Note: I have a WNDR3400 v1 so that's all I care about.

Welcome to the wonderful world of woefully inadequate documentation. It seems like everybody wants/likes to talk to their devices via serial ports but I think that's kind of dumb. I don't want to have to build or connect custom hardware bits. I just ssh to it at 192.168.1.1 like a boss.

Overview of Part 1
Basically we are going to take a stock router from out of the box to a device on your network (skipping all the parts that are documented to death) and able to ping. We'll keep the 4 LAN ports untouched (so you can still use them to directly access 192.168.1.1) and tell the

First, you hopefully have read enough about OpenWRT and the like to get a general idea what you are doing. That's great. Unfortunately a lot of what you have read is out of date if you are working on an older piece of hardware.

Second, open up your router because you are going to be flashing the firmware often. I think I've ended up flashing mine at least 10 times. The easiest way to get new firmware on the box is to short a pin and TFTP the new file at your leisure (no worrying about timing or memory).
There are a lot of posts about how dangerous this may potentially be, but I haven't had any problems. It's super easy and the router has almost zero value so I'm not afraid of destroying it.

Third, ignore the OpenWRT Wiki page about this router. You shouldn't have any reason to use the trunk/snapshot version. It'll only cause you headaches if you are tinkering while they release a new snapshot (unless you really like upgrading your kernel). The Wiki has links to 404s of old snapshots as the "recommended firmware" so that should be a good indication that you shouldn't trust it. Go ahead and download the most recent stable version. It is currently Barrier Breaker.
Fourth, flash your router with the firmware and telnet into it so you can set a password and ssh into it from now on. This is documented to death and you said you read some of the docs right?

Fifth, connect your router to your wifi. The OpenWRT Wiki page about setting up a Bridged Client is pretty much spot on and includes somethings you won't have to do. I'm glad they haven't completely given up on keeping their docs updated.
So just follow Step 1 of that Bridged Client article for now. I like to `vi /etc/config/wireless` and set things up like that but you can go your own way. I decided to enable and use `radio1` for this because it supports b/g so it more closely matches what my network already runs.

It is vitally important that you set the correct channel for your WiFi network. I managed to accidentally skip that and spent a few days trying to figure out what went wrong. Also, that `option network wan` bit is important because it's where we tell the device that the new access to the network is via wireless.

Sixth, reboot your router. You should now see a fun blue light blink occasionally on boot. That means your antennae is trying to work. I won't stay lit so don't worry too much.

Seventh,  disable some services you won't be needing. Yeah, you could disable quite a few services but the only ones that could get in your way are the firewall and DHCP servers.
/etc/init.d/firewall stop
/etc/init.d/firewall disable
/etc/init.d/dnsmasq stop
/etc/init.d/dnsmasq disable
Eighth, fully enable wireless access. Remember how we said that the radio was going to work on wan? Now go ahead and edit your network file with `vi /etc/config/network` and delete anything in the wan config and replace it with pieces to make it a fully static IP.
option proto 'static'
option ipaddr '192.168.81.2'
option netmask '255.255.255.0'
option dns '192.168.81.1'
option gateway '192.168.81.1'
My router is x.1 and all my other boxes pick up IPs starting in the x.100 range so I keep the lower numbers for devices that should be static. I want to easily access this device so I made it x.2. I didn't want to set this up grabbing a dynamic IP because it would make it impossible to find on my network if it doesn't have any avahi stuff setup.

Ninth, unplug any network cables and reboot your router. You should now be able to ping it and ssh to it as a device on your network. It is free!

No comments:

Post a Comment