Install‎ > ‎OpenWRT‎ > ‎


I decided to describe here all hacks I did to my TP-Link WR1043ND. By the way I strongly believe, it is currently best SOHO router available (best price, best functions) for OpenWRT.

I installed OpenWRT by using original firmware webpages to flash this file: When flashing, check md5 checksum. Please note, that entire text relates to this release of OpenWRT.

USB HDD connection
I own Western Digotal 1TB hdd. WD Book series. Nice piece of hardware (as I bought it back in 2009 - USB2.0, 2xFireWire and Ext. SATA). I decided to use this as home storage for use with all my devices.

OK. First we need some packages:
root@OpenWrt:~# opkg install kmod-usb-storage - to get mass storage capability for our router
root@OpenWrt:~# opkg install kmod-fs-ext4 - to get our filesystem type supported. BTW, I recommend use ext4. You can also use FAT, FAT32, even NTFS (however linux drivers for NTFS are, let say... ok... NTFS is not open source and all Linux drivers are hacks and reverse engeniering, so better not use NTFS, especially if you want to keep precious data).

We can now test with mount command, if we are able to mount our USB disc somewhere. Alternatively I recommend to use blkid to list all what is avaiable:
root@OpenWrt:~# blkid
/dev/sda4: UUID="e3e38a66-7d58-4ffc-b7c3-e75e4ed0d71e"
/dev/sda3: UUID="6cfe70bf-fc7a-4e1c-9f6b-e2dbcfd09cff"
/dev/sda2: UUID="043b3612-2c10-4ae5-b69f-1a9dfccf5a59"
/dev/sda1: UUID="7ddcca2b-31ec-4ce3-9f55-3c4c7776a123"

To be able to mount our disc automatically, we need some scripts:
root@OpenWrt:/etc# opkg install block-mount
root@OpenWrt:/etc# opkg install block-hotplug
root@OpenWrt:/etc/init.d# ./fstab enable

Now we can tweak the file /etc/config/fstab to make things work:

config global automount
        option from_fstab 1
        option anon_mount 0

config global autoswap
        option from_fstab 1
        option anon_swap 0

config mount
        option target   /mnt/sda4
        option device   /dev/sda4
        option fstype   ext4
        option options  rw,sync
        option enabled  1
        option enabled_fsck 0

config swap
        option device   /dev/sda2
        option enabled  0

Extending RAM via file SWAP
It seems that default 32MB of RAM is enough for most of uses but... There are sometimes things that may occasionally need more RAM, like DLNA file indexing or disk checks. There are two ways: upgrade RAM via soldering and using SWAP. I decided to use file swap instead of partition swap. It is a bit slower but also more convenient. I also decided, that swap will be automatically mounted after plugging the right media to router USB port.

To create swap:
root@OpenWrt:/etc/init.d# dd if=/dev/zero of=/mnt/media/swap count=262144
root@OpenWrt:/etc/init.d# mkswap /mnt/media/swap
root@OpenWrt:/etc/init.d# swapon /mnt/media/swap

Adding some new user accounts.
It is sometimes convenient to have extra user accounts, i.e. for samba, ftp access or even ssh shell (or scp). So lets add two users, first with full shell access and second with bogus shell (bogus shell is still necessary for FTP access). So edit file /etc/passwd:

Samba - making my router NAS
We start with installing samba packages:
root@OpenWrt:/mnt# opkg install samba3
Installing samba3 (3.0.24-7) to root...
Installing libpthread ( to root...
Installing librt ( to root...
Configuring librt.
Configuring libpthread.
Configuring samba3.

To give access, we have to assign password to user accounts (that were previously defined in /etc/passwd file):
root@OpenWrt:~# smbpasswd bart *******

And finally enable samba at startup:
root@OpenWrt:/etc/init.d# ./samba enable

FTP - small and fast way to get to files
First we install FTP server package
root@OpenWrt:/etc/init.d# opkg install vsftpd
Installing vsftpd (2.3.2-1) to root...
Configuring vsftpd.

Last, but not least, enable it on startup:
root@OpenWrt:/etc/init.d# ./vsftpd enable

DLNA server - media server for XBOX 360 and Samsung LED TV
DLNA servers are not trivial things to do. I decided use tweaked version of minidlna package. The reason is simple. ffmpeg library distributed with OpenWRT is striped down a lot to make it small. But from the other side, small version makes it unable to work with video and audio files. But when I want to use non-stripped version, it becomes very large footprint file. So I decided to minidlna software on external filesystem. More, I decided that DLNA server will launch only AFTER external HDD with media will be installed.

Fist we habe to add new target for opkg:
root@OpenWrt:/mnt/media/OpenWrt# cat /etc/opkg.conf
src/gz packages
dest root /
dest ram /tmp
dest media /mnt/media/OpenWrt
lists_dir ext /var/opkg-lists
option overlay_root /overlay

And now we install tweaked minidlna. The packages to install aren't from official release, as we need full ffmpeg library for the server to be fully operational. So we need those files:
OK... we use opkg -d media URL, where URL is from above list. Please note that we should install from above list in reverse order to satisfy dependencies (from bottom to top).

After installation we endup with a directory structure in /mnt/media/OpenWrt. To allow out minidlna work we have to make symbolic links:
root@OpenWrt:~# ln -s /mnt/media/OpenWrt/etc/minidlna.conf /etc
root@OpenWrt:~# ln -s /mnt/media/OpenWrt/etc/init.d/minidlna  /etc/init.d
root@OpenWrt:~# ln -s /mnt/media/OpenWrt/usr/bin/minidlna /usr/bin
root@OpenWrt:~# ln -s /mnt/media/OpenWrt/usr/lib/lib* /usr/lib

IPv6 via SixxS tunnel
First we must install some packages for IPv6 stack:
root@OpenWrt:~# opkg install kmod-ipv6
Installing kmod-ipv6 ( to root...
Configuring kmod-ipv6.
root@OpenWrt:~# opkg install kmod-ip6tables
Installing kmod-ip6tables ( to root...
Configuring kmod-ip6tables.
root@OpenWrt:~# opkg install ip6tables
Installing ip6tables (1.4.6-2) to root...
Configuring ip6tables.
root@OpenWrt:~# opkg install ip
Installing ip (2.6.29-1-2) to root...
Configuring ip.

Then tunnelling interface:
root@OpenWrt:~# opkg install kmod-tun
Installing kmod-tun ( to root...
Configuring kmod-tun.

Also we need SixxS uttility to setup tunnel:
root@OpenWrt:~# opkg install aiccu
Installing aiccu (20070115-4) to root...
Installing ntpclient (2007_365-4) to root...
Installing kmod-sit ( to root...
Installing kmod-iptunnel4 ( to root...
Configuring ntpclient.
Configuring kmod-iptunnel4.
Configuring kmod-sit.
Configuring aiccu.

The necessary IPv6 tunnel stuff must be configured in file: /etc/config/aiccu:
config aiccu
        option username         '*******'
        option password         '*******'
        option protocol         'tic'
        option server           ''
        option interface        'sixxs'
        option tunnel_id        '******
        option requiretls       '0'
        option defaultroute     '1'
        option nat              '1'
        option heartbeat        '1'

Now we enable aiccu:
root@OpenWrt:/etc/init.d# ./aiccu enable

And test:
root@OpenWrt:/etc/init.d# ping6
PING (2001:960:800::2): 56 data bytes
64 bytes from 2001:960:800::2: seq=0 ttl=52 time=70.013 ms
64 bytes from 2001:960:800::2: seq=1 ttl=52 time=69.395 ms
--- ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 69.395/69.704/70.013 ms

We also need RADV daemon for route our subnet. So:
root@OpenWrt:~# opkg install radvd
Installing radvd (1.6-1) to root...
Configuring radvd.

Edit /etc/config/radbd:
config interface
        option interface        'lan'
        option AdvSendAdvert    1
        option AdvManagedFlag   0
        option AdvOtherConfigFlag 0
        option ignore           0

config prefix
        option interface        'lan'
        # If not specified, a non-link-local prefix of the interface is used
        option prefix           '2001:6a0:143::/64'
        option AdvOnLink        1
        option AdvAutonomous    1
        option AdvRouterAddr    0
        option ignore           0

config rdnss
        option interface        'lan'
        # If not specified, the link-local address of the interface is used
        option addr             ''
        option ignore           1

Do not forget to add IPv6 address to your lan interface (edit /etc/config/network):
option 'ip6addr'  '2001:6a0:143::1/64'

and finally enable radv:
root@OpenWrt:/etc/init.d# ./radvd enable

And finally (to let routing work...), uncomment the following line in /etc/sysctl.conf: