Warning: strpos() [function.strpos]: needle is not a string or an integer in /home/customer/www/home.beardeddonkey.com/public_html/comments.php on line 34
hOme.beardedDonkey - OpenWRT on a Netgear WGT634U Wireless Router
OpenWRT on a Netgear WGT634U Wireless Router 

Updated! Feb 26th, 2010

After sniping a Netgear WGT634U wireless router on eBay I couldn't wait to install OpenWRT on it and start setting it up on my home network. Of course, when I got it and installed OpenWRT I immediately ruin the network settings like I always do when I try to configure any Linux box. That's usually not a problem because when the network on said Linux box isn't working you just turn its monitor on and grab its keyboard and fix them. Can't do that on the WGT634U because the only user interface to the device is via the network!

So then I had to work out how to reflash the device via the serial connection it offers. After a fair bit of digging around online I managed to find some handy forum posts and a USB to RS232 adaptor on eBay for dirt cheap that should fix this problem. So here I will document what I had to do to reflash the router to get it accessible again!

20110226 - Today I finally got access into my Netgear WGT634U (referred to hereafter as "router") after getting into it, then getting locked back out of it.
The short story is:
I didn't have to flash it to get it working and I didn't have to use the CFE terminal that I read a lot about when waiting for the USB to serial adaptor (referred to hereafter as "adaptor") to arrive.
The semi-long story:
I wired and plugged in the adaptor connecting the PC to the router. I initially used a live version of a Linux distro with minicom on it to get in via the serial (USB) port. I played around with the /etc/config/network (after learning how to use the basics of frickin vi) and got the network going again. Then I played with the configuration in the LuCI web interface and stuffed my network again. I then resorted to the openwrt forum and after a week or two of not trying due to frustration, I managed to get the network going again by putting a minimal configuration in, and switching the ethernet port used on the router. I then updated to Backfire 10.03.1-rc4 firware and am now sitting pretty until I get some advice on how to set the network up the way that I want it.
So now I can get into some of the detailed step-by-step solutions I did which may help someone (or myself) in the future.

The USB to RS232 Serial Adaptor

The Problem: The router needed something to connect it to the PC. I had broken the network configuration of the router, so my PC couldn't talk to it over ethernet cable. You can't plug a monitor and a keyboard into the router like you can on a PC when you break its network config.
The Solution: USB to RS232 Serial Adaptor
This little device is pretty much a "USB to serial cable" for those that don't care about the technical aspects (like me). This adaptor worked fine for me to access the router. Instead of it being a cable, it looks like a little electronic board that your plug into a USB port on your computer and then you plug the 4 wires into the electronic board and the router on the pins provided. You can find these for sale on ebay, shipping out from Hong Kong or somewhere in Asia. It cost me about $4.50 AUD to buy and ship one to my letter box and being a married man with a child - I like that. I like that a lot.

Wiring the Adaptor to the Router

The Problem: Didn't know jack squat about this.
The Solution: Jumped in and had a go, used some logical thinking and worked it out myself.

The adaptor comes with 4 little wires. Mine were coloured red, black, yellow, green. If you get one the colours may vary but it doesn't matter. As long as you hook the correct pin on the adaptor to the correct pin on the router it will work. So I decided the colours would be:
Black = GND
Green = Power (3.3V)
Red = RX
Yellow = TX

You can decide whatever you like, but I went with black for ground (because black is always ground) green for power (because power makes things 'go') red for RX (because 'r'ed and 'r'eceiving) yellow for TX (because that's what was left). See image (click to enlarge).

Notice that the adaptor offers a 5V pin and a 3V pin. Do not use the 5V pin, only use the 3V pin. If your adaptor only has a 5V pin, I do not advise using it for this router model.

Plugging the wires into the router is the same as the adaptor with the exception that you switch over the RX and TX wires. Therefore: RX on adaptor goes to TX on router, and TX on adaptor goes to RX on router.

In the left picture I am showing the full electronic board of the router. Notice the position of the wires plugged onto the pins in relation to the other components of the router. The router's lights are positioned at the bottom of the photo. In the right picture is a close up of the wiring of the pins. Notice that the red and yellow wires are reversed on the router's pins in comparison to the order on the adaptor's pins. Click either image to enlarge.

So this is the first step done! We now have a USB to serial connection physically made between my PC and the router.

Accessing the Router from the PC over Serial Connection

The Problem: Creating a connection to the router from the PC over a USB port through some wires. Didn't really know how to do this.
The Solution: After some Googling and reading, I found out I can use a terminal program called minicom that is usually found in Linux distributions to make a connection to the router. I am running Windows 7 so I figured the best solution was a Linux Live CD. Not all small Linux distributions have minicom in them, so I found either Knoppix or Slax had minicom. Slax is really cool, as you can add packages you want to it from the website before you download the installation. Then you can install it to USB or CD and boot it live. Initially I was using Linux but eventually worked out how to do this in Windows too. So I will show how to do it using either.

Using minicom under Linux

This method is documented a fair bit online in relation to getting into the router but I found that most online documentation assumes you are either using the COM serial port on the back of the PC or that you already know how to find out which USB port your adaptor is using. So assuming you know nothing about finding out which USB port the adaptor is plugged into I will explain how to find this out.

Finding the USB port the adaptor is using
1. Wire the adaptor to the router as explained above.
2. Plug the USB end of the adaptor into a USB slot on your PC.
3. Plug the power into the router. You should notice an LED on the adaptor light up bright.
4. Go to a shell terminal and type:
ls /dev/ttyU*
then press enter. Under Knoppix and Slax, you should be shown a list of the USB devices connected to the PC. If you use a USB keyboard or mouse there may be multiple devices. To determine which one is the adaptor, unplug it, issue the command above and see the devices. Plug the adaptor in, issue the command again and find the new device name. This one is the adaptor.
Configuring minicom Settings and Connecting to the Router
1. Type:
minicom -s
then press enter. Minicom will start with a menu. Press up/down arrows to navigate the menu, press enter to accept. Follow key codes in menus to control things.
2. Find the menu for port settings and set them like this page but use the USB device you found using ls /dev/ttyU*
3. Exit the menu (not minicom entirely) and the connection should initialize. If you don't see anything come up in the terminal press Ctrl + C and it should echo back something like "Press enter to activate this terminal".
4. Press enter and you should be presented with a linux shell prompt. You are now accessing the router via the serial connection. Use it like a normal Linux terminal.

Using Putty Under Windows

Eventually I got sick of using my PC in the garage and wanted to use the laptop so I could access the internet at the same time. So I tried out putty and saw it had options for serial connections. Putty wanted to know which port to use to access the serial connection. Usually this is "COM something", but again we are using USB.

Installing the Driver for the Adaptor Under Windows
I use Windows 7 so when I plugged the adaptor into the laptop and it didn't identify it, Windows looked online and found the driver for me. I'm sure it would've come with a CD with the driver, but seeing as you are here you are probably like me and flung the CD when you got the adaptor. So you can download it from either of the following places:
Prolific.com.tw - Official website for drivers, working link at time of writing
beardeddonkey.com - This website
Determining the COM Port the Adaptor Uses
Now after you install the driver, when you plug in the adaptor it will find the device and a balloon notification should pop up from the system tray saying the device has been installed, and it should say which COM port it is on (under Windows 7 at least). Mine was on COM8. I am unsure if XP or Vista will do the same and I'm not sure how to find the COM it uses if it doesn't show you in the notofication. Please email me if you do this under XP and know the answer. I will add it here for reference.
Using Putty to Connect to the Router
1. Download putty and run the executable.
2. Select Serial as the connection type, set the COM number for the port the adaptor is on (mine was COM8 so I entered "COM8" without double quotes) for the Serial line, set the Speed to 115200.
3. Ensure the adaptor is plugged into the USB port, the wires are connected correctly to the router (as described above) and the power is plugged into the router.
4. Click Open and the connection should initialize. If no error dialogs pop up everything should be working. If you don't see anything come up in the terminal press Ctrl + C and it should echo back something like "Press enter to activate this terminal".
5. Press enter and you should be presented with a linux shell prompt. You are now accessing the router via the serial connection. Use it like a normal Linux terminal.

Fixing the Networking

Once I had a connection over serial I could get to the configuration files on the router. In OpenWRT the network config file is located at /etc/config/network. The next problem I ran into was that there were no text editors on the router that I was familar with. The only one I could find was vi.

Editing Files in vi - The Bare Basics

I had to learn the basics to edit a file with vi. The quick rundown is this: vi has different "modes" when you start it, you can't edit the file you're looking at. You have to press the I key to go to "insertion" mode. Then you can start altering the file contents. You will notice you can't remove empty lines. Leave that for now and edit what you need to. Press Escape to exit insertion mode. Now you can remove empty (or non-empty) lines by putting the cursor on the line to be removed and pressing the D key twice. To save the file, type: :w and press enter. To exit vi, type: :q and press enter.

Editing /etc/config/network

Now that we can edit files, we can change the settings in /etc/config/network.
1. Edit /etc/config/network:
vi /etc/config/network

2. I edited the file back to a basic ethernet interface:
config 'interface' 'lan'
option 'ifname' 'eth0'
option 'proto' 'static'
option 'ipaddr' ''
option 'netmask' ''

config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' ''
option 'netmask' ''
Note that I used the IP your IP requirements will probably differ so make sure you set the IP you want!
3. Save the file and reboot the router. I just unplugged the power and plugged it back in.
Now that the ethernet interface is fixed, I found that if I couldn't access the router or ping it I had to change the port the cable was plugged into on the router. I needed to use the WAN port in my case.
Once I had access to the router, I could use the web interface by putting its IP into my browser. I updated my firmware to the latest version. I then found that I couldn't access the router again over ethernet. I changed the port the cable was plugged into again. This time I used the 4th port (the one closest to the power socket) and it worked. I don't know why this happened.

More to come!

Now that I have got the router working again I intend to make it a wireless bridge for my PC in my garage so I can access the internet from down there. I also want to hook up a USB hard drive to the router and use it as my main media storage device. I also want to try and use it to download media instead of having to run a PC or laptop. The power requirements of this device is very low and it is more economic and environmentally friendly to do so.

Watch the Home Page for new blog entries on my OpenWRT woes and victories.

Comments are not available for this entry.