You are currently browsing articles tagged dd-wrt.

I’m happy to say that I just got a repeater bridge setup using DD-wrt on both routers.  In the garage and in one bedroom the wireless signal from the main router doesn’t come in very well (or not at all).  this is particularly troubling since I plan to use some old phones as IP webcams to watch my beer ferment whenever I finish my fermentation chamber.

I read a lot of sites and watched several YouTube videos and failed many times.  Though I’m sure most sites were right I think the problem that I had was the encryption between the main router and the repeater router. Many blogs recommended getting the connection to work without without and then one that works setup the encryption.

I did a similar thing as many sites but with a one twist. Rather that have the repeater router connect to the main router over the real wireless lan (wl0), I setup a virtual lan on the main router. This allowed for a few nice things. First, I spent a really long time trying to get it setup directly to the wl0, jumping straight into an AES+TKIP link, and could never get it to work.  Secondly, once I went this route  I could mess with the setup without impacting the normal network with a few exceptions. This also allowed me to do the setup without turning the normal wireless into an unencrypted link.  Also, now my bridge link is hidden so I should really have any thing else using this link.

When I set this up I followed this YouTube video pretty extensively which for the changes of using a virtual lan on my main router the instructions are good.  When I got things connected I started with the AP_Bridge being visible and no encryption.  I then added the encryption and things worked.  I suppose I could have tried AES+TKIP, but I was happy with what I had working given that I spent a really long time prior to this.  Once that worked I hid the AP_Bridge.  To test things out I reset the Repeater_Bridge and it was able to connect just fine.    A quick check in the garage shows a strong signal from the repeater bridge and I should be set to go now.
Read the rest of this entry »

Tags: , , , , ,

Well shortly after posting about how I got my router loaded with DD-WRT and had all my USB drives working I discovered that my USB drives were no longer working.

After poking around a bit I found there were errors generated when the automount script was executing. In particular I was seeing:

root@BLT_ROUTER:/opt/etc# service automount status
cannot touch `/opt/etc/nomount': Input/output error
S35automount: Create /opt/etc/automount
cannot touch `/opt/etc/automount': Input/output error
I can not write /opt/etc/automount, abort

When I went to the directory I saw the following (most files removed to keep the list short)

root@BLT_ROUTER:/tmp# ls -al /opt/etc
total 1608
drwxr-xr-x 16 root root    4096 Dec 12 18:20 .
drwxr-xr-x 23 root root    4096 Nov 15 08:15 ..
drwxr-xr-x  3 root root    4096 May  5  2011 asterisk
??????????  ? ?    ?          ?            ? automount
??????????  ? ?    ?          ?            ? nomount
-rw-r--r--  1 root root   35782 May  5  2011 nzbget.conf
-rw-r--r--  1 root root     104 May  5  2011 p910nd
drwxr-xr-x  2 root root    4096 Feb 23  2012 php.d

A quick search found this forum post where it was suggested to Stop automount (service automount stop) and then delete the two files.

This worked to delete the files, but when I rebooted the router only the /opt share came up. I messed around with this for quite a while and realized that something wasn’t right with the USB drives. So I disconnected them from the router and rebooted the router. Next I unplugged the USB drives power cord (where I noticed that one of the drives was unplugged, probably from when I was adding setting up my media server). After a short while I plugged in the drives power cord and the USB cable back into the router.

After another reboot the automount script came up correctly, however it lost my custom mounting assignments. So I edited the /opt/etc/automount file in the same manner that I posted earlier. Next I did restarted the automount and samba services

service automount stop
service automount start
service samba stop
service samba start

Finally, I’m backup and running.

Tags: , ,

Here is a recap of an old project. following this straight through won’t be enough to redo what I’ve done, but the websites and hints that I followed are linked throughout this post.

I bought a Belkin PlayMax 600HD router from Best Buy because I read in some review that I could do port forwarding (needed to setup my own server at home).  Well after a lot of time in the settings and several emails to Belkin it turns out that this feature isn’t built in.  So after a friend told me about dd-wrt I decided to give it a shot after reading a lot of forums to see if my router would work.  This forum post on dd-wrt.com is about my router.

For the most part I followed the instructions from teh dd-wrt site: http://www.dd-wrt.com/wiki/index.php/Installation

Start by doing a 30/30/30 reset. The text below is copied from the dd-wrt website.

Hard Reset (aka 30/30/30 reset):

The following procedure will clear out the NVRAM and set dd-wrt back to default values:

  • With the unit powered on, press and hold the reset button on back of unit for 30 seconds
  • Without releasing the reset button, unplug the unit and hold reset for another 30 seconds
  • Plug the unit back in STILL holding the reset button a final 30 seconds (please note that this step can put Asus devices into recovery mode…see note below!)

This procedure should be done BEFORE and AFTER every firmware upgrade/downgrade.

Do not use configuration restore if you change firmware builds (different svn build numbers).

I got my files from ftp://ftp.dd-wrt.com/others/eko/V24-K26/

  • dd-wrt.v24-15508_NEWD-2_K2.6_mini.bin
  • dd-wrt.v24-18946_NEWD-2_K2.6_mega.bin

My Router is advised to only use the TFTP: http://www.dd-wrt.com/wiki/index.php/TFTP_flash

First I flashed the 15508 mini and then a 30/30/30 reset.  Even though I’m advised to use TFTP I used the webpage GUI  to flash the 18946 mega and followed up with a 30/30/30 reset.  I’ve found that Firefox has issues with webpage GUI and have reverted to Internet Explorer for all setting changes and flash updates.   I actually tried several different version and sizes for my router and sometimes had issues with enabling SSH or other weird things.  I even had a problem with the 18946 mega for a while, but after a lot of time trying different things I believe that I simply didn’t get a good flash from either not doing a 30/30/30 reset properly or something else.  But in the end the 18946 mega works for me.

In the system settings I now see:

Router Name: BLT_ROUTER
Router Model: Belkin F7D4301 / F7D8301 v1
Firmware Version: DD-WRT v24-sp2 (04/07/12) mega – build 18946M NEWD-2 K2.6 Eko

There is a ton of configuring to do that I’m not going to get into because I either don’t remember what I set or I’m concerned about leaking potential security details.  Things that I’ve added are Wake up on Lan (WOL) for my media server, SSH is a must to get into the file system from within the network, port forwarding (see below) and sharing the two USB drive connections over the network (see below)

Port Forwarding

I had a heck of a time getting port forwarding to work for computers within the LAN.  Here is a post I placed on the dd-wrt forum about this topic:


Here are several websites that I referenced read and found useful along the way

In the end I added the following to the firewall section in the Administration->Commands section

insmod ipt_mark
insmod xt_mark
iptables -t mangle -A PREROUTING -i ! `get_wanface` -d `nvram get wan_ipaddr` -j MARK --set-mark 0xd001
iptables -t mangle -A PREROUTING -j CONNMARK --save-mark
iptables -t nat -A POSTROUTING -m mark --mark 0xd001 -j MASQUERADE

I’ll have to say I’m not entire sure I understand what is happening, but it works so I’m not complaining.  Now I’m able to see this website both internal and external to my network.

NAS USB Drives

I have two 1TB USB drives attached to my router the following are the steps that I took which mostly comes from following this sites instructions which also uses the dd-wrt sites instructions of Optware, the Right Way.


Format the hard drives
(I did this at another time and didn’t record my steps)
Enable USB at Services->USB
and enable the following parameters:
Core USB Support
USB Storage Support
Automatic Drive Mount
Disk Mount Option = /opt

Save then do a reboot

Check Services->USB to see the Optware and Swap loaded

Disk Info
--- /dev/discs/disc0/disc 
Block device, size 931.5 GiB (1000204886016 bytes) 
DOS/MBR partition map 
Partition 1: 930.5 GiB (999128297984 bytes, 1951422457 sectors from 2055) 
Type 0x07 (HPFS/NTFS) 
NTFS file system 
Volume size 930.5 GiB (999128297472 bytes, 1951422456 sectors) 
Partition 2: 1 GiB (1073741824 bytes, 2097152 sectors from 1951424512) 
Type 0x0F (Win95 Ext'd (LBA)) 
Partition 5: 767 MiB (804257792 bytes, 1570816 sectors from 1951424512+2048) 
Type 0x83 (Linux) 
Ext2 file system 
Volume name "/Optware" 
UUID 0A911958-F81C-51AA-E421-3C2F22FBB048 (Reserved) 
Volume size 767 MiB (804257792 bytes, 196352 blocks of 4 KiB) 
Partition 6: 255 MiB (267386880 bytes, 522240 sectors from 1952997376+2048) 
Type 0x82 (Linux swap / Solaris) 
Linux swap, version 2, subversion 1, 4 KiB pages, little-endian 
Swap size 255.0 MiB (267378688 bytes, 65278 pages of 4 KiB) 
Status: Mounted on /opt 
Status: Not mounted 
Status: Not mounted 
Status: Not mounted

Next SSH into the router and verify the /opt partition is mounted

root@BLT_ROUTER:~# mount

rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
ramfs on /tmp type ramfs (rw)
devpts on /dev/pts type devpts (rw)
devpts on /proc/bus/usb type usbfs (rw)
/dev/discs/disc0/part5 on /opt type ext2 (rw,noatime)

Check for router connection to the internet

root@BLT_ROUTER:~# ping google.com

PING google.com ( 56 data bytes
64 bytes from icmp_seq=0 ttl=55 time=17.870 ms
64 bytes from icmp_seq=1 ttl=55 time=17.222 ms
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 17.222/17.546/17.870/0.324 ms

Next download the optware prep script

root@BLT_ROUTER:~# wget -O /tmp/prep_optware http://wd.mirmana.com/prep_optware

--2012-11-11 21:53:33--  http://wd.mirmana.com/prep_optware
Resolving wd.mirmana.com...
Connecting to wd.mirmana.com||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25381 (25K) [application/octet-stream]
Saving to: `/tmp/prep_optware'

100%[========================================================================================================================================>] 25,381      48.4K/s   in 0.5s

2012-11-11 21:53:34 (48.4 KB/s) - `/tmp/prep_optware' saved [25381/25381]

Now run the prep optware script. I choose Y for all questions

root@BLT_ROUTER:~# sh /tmp/prep_optware

Then I did a reboot

root@BLT_ROUTER:~# reboot

Check free space on optware partition

root@BLT_ROUTER:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                6.3M  6.3M     0 100% /
/dev/root             6.3M  6.3M     0 100% /
/dev/discs/disc0/part5 755M 360M 359M 51% /opt

Now install Samba 3.5 (or anything greater than Samba 2) so that it works on Windows 7. I followed this for the most part

First, create backups of original files

root@BLT_ROUTER:/opt/etc/samba#    cp /opt/etc/samba/smb.conf /opt/etc/samba/smb.conf.copy
root@BLT_ROUTER:/opt/etc/samba#  cp /opt/etc/init.d/S80samba /opt/etc/init.d/S80samba.copy

Then turn off the existing Samba service

service samba stop
service samba off

and then install Samba (I added Samba 3.5

ipkg-opt remove samba2 
ipkg-opt install samba35
ipkg-opt install samba35-swat

After doing this I saw an error:
After removing file and starting noticed and error

grep: can't load library 'libpcre.so.1'

I simply ran updates/upgrades to fix the problem

Update OTWR
ipkg update
ipkg upgrade

Other in some forums had posted the following symbolic link fix, but my update above seemed to do the trick:

ln -s /opt/lib/libpcre.so.1 /opt/lib/libpcre.so.0

With Samba 3.5 now isntalled it is time to get it configured for the USB drives. First check partitions to determine which name to setup the mounts to.

root@BLT_ROUTER:~# more /proc/partitions
major minor  #blocks  name

  31     0        192 mtdblock0
  31     1       7936 mtdblock1
  31     2       6405 mtdblock2
  31     3         64 mtdblock3
  31     4        128 mtdblock4
   8     0  976762584 sda
 8 1 975711228 sda1
   8     2          1 sda2
   8     5     785408 sda5
   8     6     261120 sda6
   8    16  976762584 sdb
  8 17 975699964 sdb1
   8    18          1 sdb2
   8    21     921600 sdb5
   8    22     136192 sdb6

SDA1 and SDB1 are my external 1TB USB drives. Plug in each one one at a time to determine which block size belongs to which harddrive. The following is just another view of the above.

root@BLT_ROUTER:/mnt# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4d0b4b49

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      121471   975711228+   7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2          121471      121602     1048576    f  W95 Ext'd (LBA)
Partition 2 does not end on cylinder boundary.
/dev/sda5          121471      121569      785408   83  Linux
/dev/sda6          121569      121602      261120   82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x11c21da9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121470   975699964+   7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2          121470      121602     1059840    f  W95 Ext'd (LBA)
Partition 2 does not end on cylinder boundary.
/dev/sdb5          121470      121585      921600   83  Linux
/dev/sdb6          121585      121602      136192   82  Linux swap / Solaris
root@BLT_ROUTER:/tmp# blkid
/dev/sda1: UUID="D4DC4E64DC4E414A" LABEL="1TB ExtnDrive" TYPE="ntfs"
/dev/sda5: LABEL="/Optware" UUID="0a911958-f81c-51aa-e421-3c2f22fbb048" TYPE="ext2"
/dev/sda6: LABEL="Swap" UUID="5d705f77-397f-868e-cf52-545be358059c" TYPE="swap"
/dev/sdb1: UUID="FC0C24480C23FBF0" LABEL="BackupDrive" TYPE="ntfs"
/dev/sdb5: LABEL="Optware" UUID="9515a4ae-351b-f102-a517-a196dcb45fa8" TYPE="ext2"
/dev/sdb6: LABEL="Swap" UUID="1bb9e834-1bf9-d98b-0a1f-d8bac631f5c5" TYPE="swap"

Next, edit /opt/etc/automount to set the USB drives mount point to the desired location, as I didn’t care for the default too much. Leave /opt as is. I changed my USB drive partitions to /tmp/mnt and /tmp/mnt2

root@BLT_ROUTER:/opt/etc# more automount
/opt 0a911958-f81c-51aa-e421-3c2f22fbb048 ext2
/tmp/mnt D4DC4E64DC4E414A fuseblk
/tmp/mnt2 FC0C24480C23FBF0 fuseblk
/tmp/d 9515a4ae-351b-f102-a517-a196dcb45fa8 ext2

Next configure the samba configuration files to include the USB drives.  Make sure the workgroup is the same as your windows computers (default is WORKGROUP)

I changed the hosts allow and interfaces lines, though I don’t recall why now

hosts allow =
interfaces =

Enable WINS Support

wins support = yes

Then in the share definitions section I added the text below to assign the Windows share name to the desired path. All the other default shares are commented out.

path = /mnt
valid users = www-data nobody root
public = yes
guest ok = yes
read only = no
writable = yes
printable = no
force user = root
create mask = 0765

path = /tmp/mnt2
valid users = www-data nobody root
public = yes
guest = ok
read only = no
writable = yes
printable = no
force user = root
create mask = 0765

   valid users = %S
   read only = no
   browseable = no

path =/opt
force user = root
read only = no
guest ok = yes

Save the config file and restart Samba

service samba stop

Everything should be up and going.

Tags: , , , , , ,