Posts Tagged ‘Router’

installing X-Wrt

June 8, 2008

The approach of OpenWrt(especially compared to DD-Wrt) is more like offering a basic system which can be highly customized, which is the approach I prefer. The standard web interface has limited functionality. X-Wrt is a seperate project that tries to provide a nice user interface, which nearly makes it unnecessary to use the shell, you can configure many things, install/remove packages,  traverse the file system, and you are able to e.g. analyze traffic trough same fancy graphs. And it is pretty easy to install, too. Making the shell obsolete is not my intention tough, as there are many things that can be done with the shell way easier than with some nice looking GUI.

There are different ways to install X-Wrt, I choose the one over ssh.

Connect to your router (note: routerIP being the IP of your router, e.g. 192.168.1.1 ):

ssh root@routerIP

After that add a new source to your /etc/ipkg.conf:

echo “src X-Wrt http://download2.berlios.de/pub/xwrt/packages” >> /etc/ipkg.conf

Now use ipkg to install the X-Wrt package:

ipkg install http://ftp.berlios.de/pub/xwrt/webif_latest_stable.ipk

This pretty much was it. After a reboot of your router, the Webif² should be display in your browser.(type in your router’s IP in the address bar of course)

the http daemon of OpenWrt doesn’t support a https connection. The root passwort will therefore be transmitted in plain text, which isn’t a clever idea when accessing your router over wlan.

A straightforward solution is:

ssh -L 5000:localhost:80 root@192.168.1.1

192.168.1.1 being the router’s IP.

Now type in the browsers bar: localhost:5000

All information is now tunneled through ssh. Windows users can use Putty for this behavior.

Now go and enjoy your new graphs!

Links:

http://wiki.x-wrt.org/index.php/Installation_Guide#X-Wrt_as_ipkg_install_.28via_SSH.29

SD Card on OpenWrt

June 8, 2008

I recently switched to OpenWrt, as I had some problems with DD-Wrt and more important I just wanted to try it out. The change was pretty seamless, as most nvram variables are shared and therefore I didn’t even have to change much for the router to work correctly. If you don’t plan to go back to DD-WRT this script cleans up your nvram variables.(deleting those that aren’t used by OpenWrt)

Now you need to download the MMC Card module:

cd /lib/modules/2.4.30

wget http://programmingstuff.free.fr/files/openwrt/whiterussian/mmc/1_3_4/gpio2/mmc.o

See comments for an alternative link, if the one above doesn’t work.

Your card should be formated with ext2. The drivers for the ext2 filesystem are needed, too. They can be installed via a ipkg package:

ipkg update
ipkg install kmod-ext2

insmod ext2

Now you can test if the card works:

echo “0x9c” > /proc/diag/gpiomask
insmod mmc

mount /dev/mmc/disc0/part1 /mmc

Note: The gpiomask fits to the modification I described in the post below, adapt it corrosponding to your modification.

When I used DD-WRT my card was mounted under /mmc. Installing software in that mount-point caused same problems, hence I decided to mount the SD-Card to the root directory in OpenWRT. This enhances your available memory very seamlessly. Furthermore it would be possibly to have differend SD-cards containing different configurations of OpenWRT. If no card is attached the system will start in the normal behavior. First the needed files will be copied to the card:

mkdir /tmp/root
mount -o bind /rom /tmp/root
mount -o bind / /tmp/root
cp /tmp/root/* /mmc -a

/sbin/init is a link to the busy box init. This will be replaced with our own init script which will do the work for mounting the card to / and after that execute the init of busy box.

rm /sbin/init

This is the new init script(copy paste it to /sbin/init), after that make i executable(chmod +x /sbin/init)

#!/bin/sh
echo “0x9c” > /proc/diag/gpiomask
insmod mmc
insmod ext2
boot_dev=”/dev/mmc/disc0/part1″

sleep 15s
mount “$boot_dev” /mmc
[ -x /mmc/sbin/init ] && {
mount -o move /proc /mmc/proc && \
pivot_root /mmc /mmc/mmc && {
mount -o move /mmc/dev /dev
mount -o move /mmc/tmp /tmp
mount -o move /mmc/jffs2 /jffs2 2>&-
mount -o move /mmc/sys /sys 2>&-
}
}
exec /bin/busybox init

Now reboot. run

df

to test  if it works correctly. If the router doens’t boot or something doesn’t work as intended you can remove the card an everything should be just like before.