Asus RT-N13U

From DD-WRT Wiki

Revision as of 18:55, 6 November 2010 by Monode (Talk | contribs)
Jump to: navigation, search

The Asus RT-N13U rev 1 is now supported and the latest builds are quite stable.

Recently Asus released the revision B1 of the RT-N13U. The B1 revision has a different flash chip, and current images will NOT work on revision B1 of the device. There should be B1 clearly printed on the bottom of your device, if it is of revision B1.

Much thanks to those who got DD-WRT working on the RT-N13U!

Contents

Device Specifications

Power Supply = 12VDC 1,0A

Ethernet Ports = 1x WAN RJ-45 10/100 Base T, 4x LAN RJ-45 10/100 Base T

Antennas = 3x internal antennas

USB ports = 1x USB2.0

Wireless standards supported: 802.11b (max. 11 Mbit/s), 802.11g (max. 54 Mbit/s), 802.11n (max. 300 Mbit/s, 2.4 GHz only)

RAM = 32 MB (64 MB in rev B1)

Flash = 4 MB (8 MB in rev B1)

CPU = Ralink RT3052F clocked at 384 MHz

Flashing DD-WRT to a stock Asus RT-N13U

Firefox sometimes has problems with newer DD-WRT builds. It is recommended that you use either Internet Explorer or Chrome

This works ONLY on revision 1, NOT revision B1!!!

1. Get the latest firmware from the main page (Just search for RTN13U):

http://dd-wrt.com/site/support/router-database

You need the asus-to-ddwrt.trx file for initial flashing.

2. To prevent issues and delays while waiting for DHCP to assign an IP, just set a static IP.

IP: 192.168.1.2 through 192.168.1.254
Netmask: 255.255.255.0
Gateway: 192.168.1.1

It is also recommended that you disconnect all other connections, apart from the one you're working on. Also disable all network adapters, except the one that the RT-N13U is connected to, on the machine you're working on. This is to prevent issues with the Asus Firmware Restoration Utility.

3. Disconnect power adapter from the RT-N13U.

4. Push and hold the button located under the router labeled "restore". While continuing to hold the restore button, plug the power adapter back into the router. If the power LED starts to blink, you can let go of the restore button. The router is now in restore mode.

5. You can now use the Asus Firmware Restoration utility to flash the asus-to-ddwrt.trx image to the router. If you do not have the Asus Firmware Restoration utility, you can install it from the CD included with the router. The process should only take about a minute or two. The Firmware Restoration utility will complete and report that the router is being rebooted, you can now close the utility. Give the router a minute, pull the plug, wait a few seconds, and then reconnect the power.

6. You can now set your network adapter to automatically obtain its IP address again.

7. If the flash was successful, you should be able to access the Web GUI. Enter 192.168.1.1 into your browser, and set a username and password.

Automounting ext3/FAT/FAT32/NTFS

The following tutorial is provided primarily by Gouryella (taken from http://www.dd-wrt.com/phpBB2/viewtopic.php?p=454647#454647), also by calvin18 and others of the community.

The RT-N13U has only 4 MB flash, which is almost full with DD-WRT installed. Ext3 needs an extra 200 KB of storage, and the driver is not present in the DD-WRT firmware yet [BrS].

I wrote a smart script that downloads the ext3 driver and mounts the 1st partition to /opt during boot (after WAN is up)


1. Just paste the following into the text box in Administration -> Commands and click Save Startup when complete: [NOTE: Script supports ext3 as shown. To mount FAT/32 or NTFS partitions, unsharp the 8 lines in the FAT/32 section or the 2 lines under NTFS respectively. Be sure one 'mount' line exists for each partition, drive or flash card to be accessed. {Existing 'mount' line can be copied/pasted and edited: /dev spec and mount point. Possible mount points are /mmc, /jffs, /mnt, and /opt. (Use /opt for Optware)} To free up RAM, unsharp last # line. (Sharped lines do nothing, so may be omitted.)]

mkdir /tmp/etc/config/
#=== For ext3 ===
echo "wget http://www.home.karneval.cz/10102207/jbd.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
echo "wget http://www.home.karneval.cz/10102207/mbcache.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
echo "wget http://www.home.karneval.cz/10102207/ext3.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
echo "insmod /tmp/root/jbd.ko" >> /tmp/etc/config/ext3.wanup
echo "insmod /tmp/root/mbcache.ko" >> /tmp/etc/config/ext3.wanup
echo "insmod /tmp/root/ext3.ko" >> /tmp/etc/config/ext3.wanup
#=== For FAT/FAT32 ===
#echo "wget http://www.home.karneval.cz/10102207/fat.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
#echo "wget http://www.home.karneval.cz/10102207/vfat.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
#echo "wget http://www.home.karneval.cz/10102207/nls_iso8859-1.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
#echo "wget http://www.home.karneval.cz/10102207/nls_cp437.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
#echo "insmod /tmp/root/fat.ko" >> /tmp/etc/config/ext3.wanup
#echo "insmod /tmp/root/vfat.ko" >> /tmp/etc/config/ext3.wanup
#echo "insmod /tmp/root/nls_iso8859-1.ko" >> /tmp/etc/config/ext3.wanup
#echo "insmod /tmp/root/nls_cp437.ko" >> /tmp/etc/config/ext3.wanup
#=== For NTFS ===
#echo "wget http://www.stanford.edu/~kelvl/ntfs.ko -P /tmp/root/" >> /tmp/etc/config/ext3.wanup
#echo "insmod /tmp/root/ntfs.ko" >> /tmp/etc/config/ext3.wanup
#=== To free RAM when done, unsharp next line
#echo "rm /tmp/root/*.ko" >> /tmp/etc/config/ext3.wanup
echo "mount /dev/scsi/host0/bus0/target0/lun0/part1 -o noatime,nodiratime /opt" >> /tmp/etc/config/ext3.wanup
chmod +x /tmp/etc/config/ext3.wanup
echo "nobody:*:65000:65000:nobody:/mnt:/bin/false" >> /etc/passwd

Enable the following under Services -> USB:

Core USB Support
USB 2.0 Support
USB Storage Support
Automatic Drive Mount

2. Reboot router with an ext3 formatted USB drive plugged in

If the drive was successfully mounted (which may take some time), uncomment the last echo to save +-500 KB RAM. Uncomment other lines for fat/fat32 support.

Debugging:

dmesg
lsmod
ls /tmp/root
cat /tmp/etc/config/ext3.wanup
ls /tmp/etc/config/

Installing Optware Light

The following tutorial is provided by Gouryella (taken from http://www.dd-wrt.com/phpBB2/viewtopic.php?p=454647#454647)


1. Installing Optware (only to an ext3 partition; /opt MUST be empty)

wget http://www.home.karneval.cz/10102207/optware-install.sh -O - | tr -d '\r' > /tmp/optware-install.sh
sh /tmp/optware-install.sh
ipkg update
ipkg upgrade
wget http://www.home.karneval.cz/10102207/sort -P /opt/bin
chmod +x /opt/bin/sort
ipkg install htop iperf libuclibc++ nano samba2 tftp-hpa vsftpd
killall xinetd
rm /opt/etc/samba/smb.conf
rm /opt/etc/vsftpd.conf
rm /opt/etc/xinetd.d/tftp
rm /opt/etc/init.d/S80samba
wget http://www.home.karneval.cz/10102207/smb.conf -P /opt/etc/samba/
wget http://www.home.karneval.cz/10102207/vsftpd.conf -P /opt/etc/
wget http://www.home.karneval.cz/10102207/netbios-ssn -P /opt/etc/xinetd.d
wget http://www.home.karneval.cz/10102207/netbios-ns -P /opt/etc/xinetd.d
wget http://www.home.karneval.cz/10102207/tftp -P /opt/etc/xinetd.d
wget http://www.home.karneval.cz/10102207/vsftpd -P /opt/etc/xinetd.d
wget http://www.home.karneval.cz/10102207/S98iperf -P /opt/etc/init.d
wget http://www.home.karneval.cz/10102207/S99trans -P /opt/etc/init.d
chmod +x /opt/etc/init.d/S98iperf
sh /opt/etc/init.d/S10xinetd
chmod 777 /opt

You now should be able to access /opt/ through ftp://192.168.1.1 or through samba \\192.168.1.1, 192.168.1.1:901 swat.

Note: Change the gateway in optware-install.sh, if you have different IP range.


2. My choices for basic testing:

htop - 0.8.3-1 - An interactive process viewer.
iperf - 2.0.4-1 - A tool for measuring TCP and UDP bandwidth performance.
nano - 2.2.4-1 - A pico like editor
samba2 - 2.2.12-2 - Lightweight Samba suite provides file and print services to SMB/CIFS clients.
tftp-hpa - 5.0-1 - A tftp package (for pxe booting)
vsftpd - 2.2.2-1 - ftp daemon with an emphasis on speed and security
xinetd - 2.3.14-9 - Highly configurable, modular and secure inetd

2.1 Samba Nameserver nmbd needs to have interface defined to work properly, Edit smb.conf

nano /opt/etc/samba/smb.conf

and add following code in to [global] section of the samba configuration file smb.conf

interfaces = 192.168.1.1/255.255.255.0 


3. Test results:

USB flash vsftpd speed:

dither 1-2,5MB/s write (checked also USB 2.5" HDD 3.5MB/s constant)
6MB/s read

USB flash samba2 speed:

1MB/s write
4MB/s read

iperf:

67,6Mbit/s CPU usage near max

Transmission daemon running:

http://www.home.karneval.cz/10102207/rt-n13u.png

Installing a Transmission-daemon onto Asus RT-N13U

I have just successfully installed and running this Transmission Torrent thingy

and thanks to "Gouryella" for showing us the light

adopted with slight Modification from [[1]] kudos to anonymous code-angels--Capper 22:07, 25 August 2010 (CEST)

1. Make the following folders

cd /opt
mkdir -p /opt/data/torrents/.config              # -p to make directories at the same time

The plan is to have everything torrent go to the folder /opt/data/torrents

2. Install Optware Transmission

/opt/bin/ipkg-opt -verbose_wget install transmission
Note: I like to see the progress of the downloading process, so I know the right thing is happening. This is done with the -verbose_wget parameter.


3. Started and stopped Transmission to get the basic work folders

/opt/bin/transmission-daemon -g /opt/data/torrents/.config/transmission-daemon
killall transmission-daemon

With the command above you get the basic folder structure of:

/opt/data/torrents/.config/
/opt/data/torrents/.config/transmission-daemon
/opt/data/torrents/.config/transmission-daemon/settings.json  #file
/opt/data/torrents/.config/transmission-daemon/blocklists 
/opt/data/torrents/.config/transmission-daemon/resume          
/opt/data/torrents/.config/transmission-daemon/torrents


4. Edit settings.json

nano /opt/data/torrents/.config/transmission-daemon/settings.json

5. Delete contents of settings.json and copy-paste following code into it.

     {
     "blocklist-enabled": 1,
     "download-dir": "\/opt\/data\/torrents",
     "download-limit": 100,
     "download-limit-enabled": 1,
     "encryption": 2,
     "max-peers-global": 35,
     "peer-port": 25000,
     "pex-enabled": 1,
     "port-forwarding-enabled": 1,
     "rpc-authentication-required": 0,
     "rpc-password": "",
     "rpc-port": 9091,
     "rpc-username": "",
     "rpc-whitelist": "192.168.1.*",
     "upload-limit": 200,
     "upload-limit-enabled": 1
     }

The file settings.json can also be downloaded from here (the wget command is one line):

 wget http://www.3iii.dk/linux/optware/settings.json -O /opt/data/torrents/.config/transmission-daemon/settings.json 

but change to "download-dir": "\/opt\/data\/torrents", from "download-dir": "\/mnt\/data\/torrents",

6. Open listening port for WAN access

Go to your DD-WRT control panel and add the following to Administration - Commands - Firewall

iptables -t nat -I PREROUTING -p tcp -d $(nvram get wan_ipaddr) --dport 25000 -j DNAT --to 192.168.1.1:25000 
iptables -I INPUT -p tcp -d 192.168.1.1 --dport 25000 -j logaccept

You may change the value 25000 to whatever port you specified in the settings.json file for the value "peer-port"

7. Restart transmission

/opt/bin/transmission-daemon -g /opt/data/torrents/.config/transmission-daemon


8. Accessing Transmission web interface

Now you get web access to the Transmission page by going to http://192.168.1.1:9091. That is, if your routers IP is 192.168.1.1


9. Autorun Transmission-daemon every time router reboot

I would not like to go to command shell and type to start the Daemon. so here is the autostart for couch potatoes like me.

cd /opt/etc/init.d
rm S99trans

This will remove old S99trans initializing file you might have in the directory . We will now create an autorun script for our Transmission-Daemon

nano S99trans

now type-in following lines in it

sleep 120
/opt/bin/transmission-daemon -g /opt/data/torrents/.config/transmission-daemon

Save it by presseing CTRL+O followed by CTRL+X , now we will Make it executable by...

chmod +x /opt/etc/init.d/S99trans

You are done. Enjoy downloadig sans PC.

10. How to get transmission to download torrent files?

     - In a web browser go to your favourite torrent site/tracker and download a "<myfile>.torrent" file
     - In a web browser go to 192.168.1.1:9091 to enter the Transmission web page.
     - click "open"
     - click the text field (or "select" button)
     - point out the "<myfile>.torrent"
     - click "upload"

     and the torrent'ed file should start downloading shortly.


The downloaded file will turn up in the /opt/data/torrents folder.

The full space of the file will be reserved from the start, so in a FTP, WinSCP or Explorer via Samba it may seem like the file is all there immediately, but it is not! It is fully downloaded when the line turns green in the Transmission web interface at 192.168.1.1:9091.

You can see details about any of the torrent files by clicking the Inspector button on the right in the Transmission web interface.


11. Another interface option

You might also want to check out a front-end (remote-GUI) for the rpc version of transmission.

transmission-remote-gui is an application written in Free Pascal to remotely manage Transmission See: http://code.google.com/p/transmisson-remote-gui

transmission-remote-dotnet is a .NET application written in C# to remotely manage Transmission. See: http://code.google.com/p/transmission-remote-dotnet/

"Try the latest one (beta is welcomed over here)"

Installing a Network Printer onto Asus RT-N13U

As of v24-PreSp2 (first versions to work on Asus RT-N13U) jffs was removed due to the lack of space available. However, Brainslayer put the support of network printing onto the firmware, enabling use of a network printer. Special Thanks for TimeKiller for figuring out most of the solution.

1. First enable USB support

Enable the following under Services -> USB:

Core USB Support
USB 1.1 Support (UHCI)
USB 1.1 Support (OHCI)
USB 2.0 Support
USB Printer Support

2. Startup Settings

Go to Administrations -> Commands, and add this:

sleep 4
mkdir -m 755 -p /dev/usb
mknod -m 660 /dev/usb/lp0 c 180 0
/usr/sbin/p910nd -f /dev/usb/lp0 1 

Save on the Startup.

3. Reboot and Install Drivers

Reboot the router, then install drivers through tcp/ip (9101)

For Windows 7:

Go to Devices and Printers
Then, press Add a Printer
Got to Network Printers
Skip the detection, as Windows will not find anything
Go to "Add a printer using a tcp/ip address or hostname"
Device type: Autodetect
Hostname and ip address: your router's ip (default 192.168.1.1)
Port Name: Anything (puts your router's ip by default)
After it says it could not detect a printer, select custom, then Advanced
Make sure the protocol is RAW and change the Port Number is 9101
Install your drivers and finish.

You should print a test page to see if it works.

4. Troubleshooting If the test page does not come, try these settings instead:

Go to Administrations -> Commands, and add this:

sleep 4
chmod +rwx /usr/sbin/p910nd 
mkdir -m 755 -p /dev/usb
mknod -m 660 /dev/usb/lp0 c 180 0
chmod +rwx /dev/usb/lp0
/usr/sbin/p910nd -b -f /dev/usb/lp0 0 

Save again on the Startup. Reboot then follow the steps above but instead of port 9101, put in 9100. You should print a test page again to see if it works. If it doesn't work, you somehow did not follow the instructions correctly.