Showing posts with label open-wrt. Show all posts
Showing posts with label open-wrt. Show all posts

2015/01/02

DD-WRT on a Netgear WNR-2000v2

I stopped by a Goodwill store the other day on a whim. I happened upon a Netgear WNR-2000v2. A quick search on the phone showed it was DD-WRT compatible. And it was only 99 cents! Not really. It was $1.99. Which is pretty much free in my book. 

Once I got it home and plugged in, though, nada. Then I looked at the power supply. 9V 200mA. For a device that requires 12V 1A. Huh. So was that why it was at Goodwill? Sucks if someone just mixed up a plug. I wonder where the 9V device ended up? After the smoke got out. I was able to scavenge the exact power supply I needed from another $2, 4 port wired router I found a few months ago at another thrift shop. And that's how I got a $4 router. Perfect!

Anyway, there are some tricks with the flashing of the router. It took me a bunch of tries, and I managed to brick it a couple of times. Here is what ended up working along with some notes about what caused my problems.

Important links:



Based on the DD-WRT WNR-2000v2 wiki, the router has limited RAM, so you have to pay attention to the size of the firmware image you are installing. You will need images that are LESS THAN 3.4 MB. NOTE: The main DD-WRT WNR-2000v2 page has a link to a file that is too large for this router. You will brick it. It is easy enough to recover, but it's not necessarily for the faint of heart.

The wiki page has a corrected, yet older link for the .chk firmware required for the initial flash. You have to find the subsequent .bin image. I used the same build as the .chk for reliability with the initial flashing. The latest firmware from r18777 is here: 18774.chk and 18774.bin. The wiki states that 18777 is the last that won't brick the router.

The process for updating the firmware is as follows:
  1. Connect to the router with a network cable and make sure your computer is set up with the right network address.
  2. Update the router with the .chk version of the DD-WRT firmware using the standard web interface.
  3. Let the router sit for 5 minutes after it appears it to have finished.
  4. Do a 30-30-30 reset (hold the reset button for 30 seconds while the router is on, turn off the router for 30 seconds while still holding the reset button, power on the router and continue holding the reset button for 30 seconds).
  5. Power the router off and on (I always have to do this twice to get it to boot up, no matter the firmware).
  6. Set your computer's network address to 192.168.1.x (x needs to be some number higher than 1).
  7. Point your browser to 192.168.1.1
  8. You will need to set up an admin user (name and password).
  9. Configure your router.

If something goes wrong, and your router is bricked, follow the steps here and here to get it unbricked. I had to do this a few times. I haven't tried it on Windows, but it's a trivial process with Linux.

2014/09/17

Reverting openwrt to stock firmware

I'm still battling with what I want to do with my extra router (Netgear WNDR4000). Openwrt was not quite what I was hoping, and I know I need to learn a little more about networking to get it to bridge connections like I want. So I decided to go back to dd-wrt to get it set up again and then have access to the resulting config files as a basis.
The migration didn't go as well/smoothly as I had hoped. I got the firmware replaced following these steps:

From http://www.dd-wrt.com/wiki/index.php/Upgrade_from_openwrt
Upgrade From Openwrt
I had a linksys WRT54GS version 2 router that I wanted to upgrade from openwrt to dd-wrt. I could not find any documentation on how to do this. So I created this page just in case anyone else needed to do this. Replace your firware image referenced below with the correct image for you router.
    1. secure shell or telnet into the router running openwrt
    2. cd /tmp
    3. wget http://internet_path_to_your_firmware
    4. mtd -r write your_firmware
This sort of bricked my router. It would boot enough to ping, but nothing else was accessible. I managed to use atftp to load the stock Netgear firmware, and that worked. To do that I performed the following steps:

1. Download correct firmware from your router vendor for your router.
2. Run the following command from a Linux command prompt:
atftp --option "mode octet" --option "timeout 180" --verbose --trace --put --local-file router_firmware 192.168.1.1
3. Let it sit 5 or 10 minutes
4. Reboot

Then I was able to use the standard interface to load the dd-wrt initial conversion .chk file. After that, I upgraded to the mega firmware image for my router.

2014/09/11

Revert dd-wrt to other firmware on Netgear WNDR4000

I have been trying to convert my WNDR4000 router from dd-wrt to openwrt. I have been struggling with how to get this to work. I couldn't get the Netgear tftp instructions to function correctly (didn't seem to find the router). I finally stumbled on the following, which I used to get me to openwrt.

From: dd-wrt.com

Read: TFTP
http://www.dd-wrt.com/wiki/index.php/TFTP_flash
and look at the WNDR3300 wiki:
http://www.dd-wrt.com/wiki/index.php/Netgear_WNDR3300#Reverting_.2F_recovery_tftp_mode

The basic process is this:
1.) Download the latest Netgear Firmware ver.1.0.0.82 to your home folder
http://www.downloads.netgear.com/files/WNDR4000-V1.0.0.82_8.0.71.chk

2.) Set static IP on wired PC (ip:192.168.1.10 mask:255.255.255.0 gw:192.168.1.1)

3.) Do a 30/30/30 and set the password on http interface when finished

4.)
$ telnet -l root 192.168.1.1
# erase linux
# reboot

5.) On a linux desktop using atftp
$ atftp --option "mode octet" --option "timeout 180" --verbose --trace --put --local-file ~/WNDR4000-V1.0.0.82_8.0.71.chk 192.168.1.1

6.) Wait 5-10 min & the router is ok
Reboot router, Clear browser cache and return Static IP on computer to DHCP.

7.)
$ telnet -l root 192.168.1.1
#passwd


Step 7. enables the ssh daemon and allows package installation.

2014/09/02

PirateBox on a TP-Link TL-MR3020


 

I bought one of these little routers a few months ago for around $25 or so. My initial plan was to get something that I could run off of USB power in the car so that the kids could connect with their devices and annoy each other on long trips. I was also intrigued with its compatibility with open-wrt.

I had it floating around for a number of months, and it had made a few trips with us. It served its purpose, but it was pretty uninspiring. I don't like uninspiring. So a couple of weeks ago, I started reading up on converting it to open-wrt. Turns out, that step is pretty easy. I just followed the directions on the web site linked above and pretty much just flashed it like a normal firmware update.

It turns out that open-wrt can be pretty dull, too, if you don't have a goal. Enter PirateBox. They probably describe it best:
PirateBox is a DIY anonymous offline file-sharing and communications system built with free software and inexpensive off-the-shelf hardware.
 My idea was to provide the original desired functionality along with the ability to provide music and movies for the kids as well. It looks like I've got it all running, and this is how I did it.

One point I would like to bring up before we begin, I started with a standard open-wrt image on my router. The website's DIY page assumes that you start with the TP-Link firmware or an existing PirateBox install. I would recommend this. I got it straightened out, but it took some poking around and some luck in my original research.

For PirateBox, you will need the TL-MR3020 router and a USB stick. Some of the file system will reside on the USB stick permanently, so pick a stick that is big enough to allow for that and any files you want to serve/store.

I started the PirateBox conversion by downloading the two files that they provide via the website (install_piratebox.zip and *squashfs-factory.bin). Their recommendation for a fresh installation is to set the slider switch to the 3G option (I assume to get the USB port active). You extract the install_piratebox.zip file and copy the INSTALL folder to a USB drive. Remove the USB drive from your computer and plug it into the router and power it on. Connect your laptop to the router and update the firmware (via the normal administration tools) to the firmware file you downloaded from the PirateBox site. This will mount the USB on reboot and install PirateBox, just like the direction say.

I can't say how well this works because I didn't think to plan this far in advance when I started this whole thing. I had to follow the upgrade directions, but I had an issue because I had open-wrt installed already without the USB mounting modules required (and packaged with the PirateBox firmware). The premise for the upgrade is to copy the firmware file to the router via USB drive and copy it over the existing firmware. Upon rebooting, the USB drive will be seen, the zip file will be decompressed, and PirateBox will be installed.

My problem was that I couldn't mount my USB drive with the stock open-wrt firmware. In order to do this, I used some info I got from this site. That site is for setting up the router as a Pineapple box (for man-in-the-middle attacks). What was really important for me was the following piece:
Install the following packages :

opkg update
opkg install kmod-usb-storage
opkg install kmod-fs-ext4
opkg install block-mount
I didn't need the ext4 module since I used FAT32, but the block mount seems to solve the small issue I was having with seeing my USB drive on the router.

So I connected the router via Ethernet cable to my internet router so that I could install the required modules. Once I could mount the USB drive, I copied the PirateBox firmware onto the router with the following command:
cd /mnt/usb
mtd write -r openwrt firmware
Then I rebooted with:
reboot
I then waited the 20 to 45 minutes that are recommended (in my case, I went to bed). After that, I was able to telnet into 192.168.1.1 (note that, telnet, not SSH). In order to do this, I had to actually install telnet on my laptop. Anyway, once I got into the machine, I set the password via:
passwd
This allowed me used SSH again. After that, I followed the steps in the Post-Installation section to activate the Kareha board, setup the time, and start the miniDLNA server. This is what allows you to stream music and movies via a DLNA client.

The one issue that I had was getting the time set up. The TL-MR3020 doesn't have a time clock, so it defaults to 01/01/1970. Since it is designed to run as a stand alone network, there isn't access to an NTP server, either. There are directions in the PirateBox forum for this. At least for this current firmware. In essence, this is what you do (from the above link):


The step about the timesave.sh script is a script for fixing this. The issue is only, that the timesave.sh as a syntax error and the routine within the openwrt package has a bug too -- in 1.0.0

I prepared the fix for 1.0.1 which is currently in beta testing.

To fix it manually:

edit /opt/piratebox/bin/timesave.sh

find
if [ `get_datetime` -lt `cat $TIMESAVE` ] ;
and replace with
if [ `get_datetime` -lt `cat $TIMESAVE` ] ; then
(missing then)

Then edit /etc/rc.local

change
/opt/piratebox/conf/piratebox.conf /opt/piratebox/bin/timesave.sh recover
with
/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  recover
Additionally run:
/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  install

BUT, that is no exchange for areal Real-Time-Clock. This is not available on such cheap systems.
At that point, I shut down my router, mounted the USB stick on my laptop and copied a bunch of music and movies onto it. This is much faster than trying to upload them. For the DLNA server, you will need playlists for your music. I haven't bothered with this. A simple script can be run to parse a folder/folder structure to get songs available and create playlist files.

This was a really straight-forward install. I was impressed with how easy this was. The guys working on this project have done a great job, and the only issues I had were my own doing.