All in one NAS

Getting the "All in One" working (rev 1.3 – 5/15/06)

This is a translation of a Kurobox contest originally posted as a Word Document here: http://www.kurobox.com/forums/viewtopic.php?t=956 It has some great ideas in it, so I placed it up here for posterity sake. Ramuk 07:28, 3 June 2008 (BST) I believe the original was made up by Kuroguy

Introduction
The All in One setup turns your Kuro into a complete SOHO network solution. It adds typical office server type functionality and allows me to retire at least two other devices; a D-link wireless router that crashes about once a week which, is only used to access the Kuro when I roam on my notebook computer and a Network Everywhere router that can’t seem to accept entries into the port forwarding table. That’ll teach me to buy Buffalo and Revolution gear only. All of the extra parts used in this project were salvaged from my computer graveyard. This includes the wired and wireless network devices as well as the additional USB connectors and resistors used to expand the USB capability of the Kurobox. This article will describe the capabilities of the All in One as well as the hardware modifications which were required to pull the whole thing off. One particularly difficult part of this project was getting the wireless portion to work. Linux support for USB wireless devices is lacking at best. It is by sheer luck that I had a wireless USB dongle that would work with the PPC architecture. This project underscores the need for additional expansion capability (other than USB) in future generations of the Kurobox.

I would not have set out to develop this device had I not had the spare parts lying around, as the cost for the required hardware would have exceeded the cost of a standard off the shelf wireless home router (by Buffalo, of course). Still, it is an interesting exercise to prove the capabilities of the Kurobox and the Gentoo operating system.

The All in One adds the following Functionality to the Kurobox:Wireless Access - For connecting to the Kuro remotely

Wireless Access Point – access your whole network through the All in One.

WAN Router/gateway - For sharing my internet connection with all devices on the network (including wirelessly)

Web Server - Uses Apache/MySQL/PHP for serving active web pages

Mail Server - Every office needs one of these.

FTP Server - It seemed to go with the collection. After all, most of the commercial devices have one these days

DCHP Server - For easy setup of client machines on your intranet; I prefer static IP addresses for my clients.

Samba Server - Every network needs Windows file serving.

Media Server - Serve audio and video files to your Linktheater and across the internet to other computers.

=Directions=

Hardware Description
For our purposes eth0 is the intranet network interface (the internal Ethernet), eth1 is the WAN interface (the wired USB Ethernet), and wlan0 is the USB wireless interface. We will setup iptables for eth1 to keep intruders from accessing the entire intranet.

We are using a ZyXEL G-220 wireless G network adapter Which is based on the ZD1211 chipset. I found this device in a box of extra parts I had. The G-220 is plugged into a second rear USB port via a short USB extension cable. This allows me to raise the device for better reception and transmission. I have also populated the front USB port. The standard Kuro does not come with the connector for the front USB, which provides a spare easily accessible USB port for mounting other devices such as flash memory or hard drives for backup purposes via a USB to IDE converter. There always seems to be an abundance of extra drives around here.

The only current USB adapters that will work with the Kuro use the ZD1211 driver. Other USB devices are only supported using NDISWrapper. Unfortunately, this wrapper only works with x86 machines. A mini PCI port would be a great addition to the next generation Kuro. The devices using the Prism chipset are moving towards supporting USB devices. In the future, the Prizm54 chipset will be the way to go as the current drivers, although not yet supporting USB, fully support master mode and bridging which is required to run an access point. Bridging is still quirky with the ZD1211 chipset, but does work. A future upgrade of the All in One will include support for a Prism chipset USB wireless dongle.

We need to install extra USB headers for this setup. The manufacturer of the Kuro filled the jumper holes for the front USB with solder. Removing the solder from the jumper holes on the Kuro board is simple. Press the tip of a 15 watt soldering iron with a good sharp tip (if the tip isn’t sharp use a file to sharpen it and tin the tip) into the hole from the back of the circuit board. '''THIS IS VERY IMPORTANT. IN THE NEXT STEP THE BOARD SHOULD BE BETWEEN THE SOLDERING IRON AND YOUR MOUTH. FAILURE TO PLACE THESE THREE OBJECTS IN THE CORRECT ORDER WILL RESULT IN EXCESSIVE PAIN. '''When the solder is flowing nicely, get your mouth about 1" from the front of the board and blow hard into the wet solder while at the same time removing the solder iron. You will blow the solder out of the hole leaving a hole that you can easily put a wire through. It should be noted that the larger holes for the lugs on the connector might require a larger soldering iron. Do not use anything larger than a 25 watts iron or you risk damaging the board.

I have plugged a Belkin F5D5050 10/100 Ethernet adapter into the remaining rear USB port.

Compile a new kernel with the required functionality
Use the provided .config file and the patch for the 2.6.15 vanilla kernel to compile a 2.6.15 kernel with the required functionality. This kernel has the standard configuration and the following additional functionality:

Pegasos Ethernet driver

IP Chains

Bridging capability

IEEE 802.11 encryption

Net radio

Wireless Ethernet support

USB /proc filesystem support

I would suggest using the .config supplied here as a starting point as it is known to work.

Install and configure eth1
Follow the Gentoo Home router guide located at http://www.gentoo.org/doc/en/home-router-howto.xml. Eth1 is the wired USB ethernet adapter and will be connected to the WAN via the cable modem that is furnished by your ISP (Goodbye old Network Everywhere Cable/DSL Router). You need to setup eth1 in /etc/conf.d/net and add a symbolic link from /etc/init.d/net.lo to /etc/init.d/net.eth1. For a static IP address edit /etc/conf.d/net and add a line:

Config_eth1=(“xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx broadcast xxx.xxx.xxx.xxx”) if your ISP has assigned a static address to you. For a dynamic IP the file does not require editing. Replace the xxx.xxx.xxx.xxx with your WAN IP address, netmask and broadcast mask

Install and configure wlan0
There are reports of the R38 driver for the zd1211 chipset working with bridging. I didn’t have much success so I’ll use the latest version, R76. We will download and install the r-76 version of the driver.

wget http://zd1211.ath.cx/download/zd1211-driver-r76.tgz tar zxvf zd1211-driver-r76.tgz cd zd1211-driver-r76

change directories into the zd1211-driver-r76 directory and edit the makefile. Change the KERNEL_SOURCE lines to match these:


 * 1) KERNEL_SOURCE=$(MODPATH)/source

KERNEL_SOURCE=/usr/src/linux-2.6.15

Save the file and compile the driver.

make make install

Next we add the module name (zd1211) to /etc/modules/autoload.d/kernel-2.6. This will make the module automatically load on booting the 2.6.15 kernel.

Next we configure the wireless device. To make these settings permanent, edit /etc/conf.d/net and make sure the following lines are included. These lines can also be in /etc/conf.d/wireless, but /net is the recommended location. We will use the SSID of Kuro and passkey of 1234567890abcdef1234567890. In particular, make sure these lines are included:

essid_wlan0=”Kuro” key_Kuro=”1234567890abcdef1234567890” mode_wlan0=”master”

For a static IP address we edit /etc/conf.d/net and add a line:

config_wlan0=( “192.168.0.1” )

We use the same address, netmask, and broadcast mask as those assigned to eth0, so make sure the config_eth0 line has these numbers too. This setup makes the Kuro’s internal IP address 192.168.0.1 which is typical for a router.

The bridging capability of the zd1211 chipset has been reported to be quirky and in some cases badly behaved. We’ll give it a shot, although it is not needed to access the Kuro wirelessly, it is required to access the other wired devices on your intranet.

To create the bridge from eth0 to wlan0 Add the following lines:

bridge_br0=”eth0 wlan0” config_eth0=( “null” ) config_wlan0=( “null” ) config_br0=( “192.168.0.1” ) #this is the IP address of the kuro depend_br0 ( need net.eth0 net.wlan0 )

Last, add a symbolic link from /etc/init.d/net.lo to /etc/init.d/net.wlan0 and add net.wlan0 to the default runlevel.

rc-update add net.wlan0 default

Add net-misc/bridge-utils to /etc/portage/package.keywords since it is masked. It is needed to create the bridge between eth0 and wlan0.

emerge bridge-utils.

You need wireless-tools to configure wlan0.

emerge wireless-tools

Note: you cannot connect to the Kuro via a wireless connection while simultaneously connected via a wired connection. To test the wireless connection you must stop eth0 with the command “/etc/init.d/net.eth0 stop” or physically unplug the wired Ethernet cable from your client machine.

Install Apache, MySQL, and PHP
This is very straight forward. Follow the instructions at

http://gentoo-wiki.com/HOWTO_Apache2_with_PHP_MySQL

Install Your Mail Server
Follow the instructions at

http://forums.gentoo.org/viewtopic.php?t=56633&postdays=0&postorder=asc&start=0

I have been using this setup for over two months at this point and it works flawlessly. It is perfectly adequate for small a SOHO application.

Add POP3 support by starting courier-pop3 and adding it to the default runlevel.

/etc/init.d/courier-pop3 start

rc-update add courier-pop3 dafault

Install your FTP daemon
emerge vsftpd cp /etc/vsftpd/vsftpd.conf.example /etc/vsftpd/vsftpd.conf

Edit vsftpd.conf as required for your purposes. The file is well commented and very easy to understand.

Finally, add vsftpd to the default runlevel.

rc-update add vsftpd default

If you would like to run vsftpd via inetd follow the instructions for step 3 at http://www.vsftpd.org/rpm/

Install your DCHP daemon (if required – not in my case)
This is part of dnsmasq. Configuration instructions are part of the Home router guide (referenced in part 3 of this guide), chapter 5.

Install Samba
Everybody needs network storage for Windows, so emerge samba. Follow the Samba how-to at http://www.gentoo.org/doc/en/quick-samba-howto.xml. Also setup a printer if you want, but it will require adding a 4th USB or a USB hub. Since we are trying to reduce the total number of devices required, the 4th USB is the way I’d go.

Serve media across the internet or intranet with Jinzora
Follow the instructions at www.jinzora.com to access your central media store from anywhere. Jinzora requires that you have Apache/Mysql, and PHP (not version 5) installed and is very easy to install. The version I installed (2.3.7) had two errors in it. See this thread to fix one that causes problems with downloading:

http://www.jinzora.org/forums/viewtopic.php?t=2974

and to fix an error that prevents the database tables from being created. Edit the file jinzora.sql and change :

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

to

) ENGINE=MyISAM;

It shows up six or so times.

Serve media to your home media player with Wizd
Follow the instructions at http://jhue.users.sonic.net/. Also add the included wizd init script to /etc/init.d and add it to the default runlevel since there is not one that seems to work online, except the one I wrote last year. It assumes wizd is installed in /usr/local/wizd. Here it is:

start {       ebegin "Starting the Wizd Daemon"        start-stop-daemon --start  --pidfile /var/run/wizd --make-pidfile --chdir /usr/local/wizd --exec /usr/local/wizd/wizd        eend $?} stop {        ebegin "Stopping the Wizd daemon"        start-stop-daemon --stop --name wizd        eend $?}
 * 1) /etc/init.d/wizd
 * 2)  # start/stop the Wizd daemon.  #
 * 1)  # Stop the Wizd server daemon  #

Add it to the default runlevel:

rc-update add wizd default

Setup the startup scripts to boot the 2.6.15 Kernel
There are several bootloaders based on init.d scripts available on the Kurobox forums. The one written by Gordo works acceptably well and is the one I use. It can be found at http://www.kurobox.com/forums/viewtopic.php?t=665