Build a full-blown file/web server on Linksys NSLU2
Content
1. Introduction
2. Overview of NSLU2
3. Setup the new device
4. Upgrade firmware
5. Prepare the NSLU2 device for unsling
6. Unsling
7. Post-unslung setting
8. Install essential packages
9. A shell script to accelerate the setting
10. Legal notice
Currently more and more families have broadband Internet services, either through Cable or DSL. In general, every family has more than one computer. To share hardware and software resources at home, such as hard drive, photos, music, software and so on, a dedicated computer as a file and/or web server has to run all the time, at least during the day time. More people are willing to have their own private web server running within their LANs. The problem is that a dedicated computer is not a cost-efficient and power-saving solution. How can we obtain a more reasonable solution of a file and/or web server at home? A smart and practical solution of absolutely cost-efficient, power-saving and private file and/or web server is provided here for home networks. Linksys has a product called Network Storage Link for USB 2.0 Disk Drives (NSLU2). This device has two USB ports that you can plug external hard drives or flash drives. It provides a basic platform to create a file and/or web server. The second component we need is a flash drive with 1 GB or more storage capacity. The third component is a customized firmware that allows us to install and configure software in a NSLU2 device. In the public domain, a user community called nslu2-linux-org makes enormous efforts to develop alternative firmware for NSLU2 devices. Unfortunately, majority of people are not familiar with Linux and do not have experience to flash NSLU2 devices with the newly developed UNSLUG firmware.
Here is a customized NSLU2 with web server, file server, ftp server, and SSH server installed (see Figure 1). The customized system uses FTP client to transfer and manage all files on the web server. In addition, usage of the web server is summarized and every 6 hours by Webalizer application. You can view the daily and monthly usage of your web server. By browsing these daily updated web pages you can easily monitor how your web server is used. If you like, you can make your web server available in the Internet by configuring your router properly. As a plus, you still can plug another external hard drive (formatted in NTFS Windows format) to the device and share it in your home network. This DIY manual describes how to build a web/ftp/ssh server on a NSLU2 device from scratch. You can evaluate the efficiency and speed of the web server by visiting http://www.sunfinedata.com/. It was constructed by the exactly same method. Plus, you can learn basic Linux commands by SSHing into the NSLU2 because a customized Linux operation system is running on it.

Figure 1. Components of the NSLU2 file/web server
NSLU2 has the following features advertised by Linksys. You can get more detail descriptions of this device from the materials provided in the NSLU2 package and the Linksys web site.
- Connects USB 1.1 or 2.0 disk drives and flash disks directly to your network
- Share music, video, or data files with managed access by user name or group
- Integrated file server — access your files from the Internet
- Built-in disk utilities — format, backup, and scandisk
From a customer’s point of view, it has the following advantages:
- Small size – it can fit into your palm
- Simple and stable – less worries about failure and the loss of your files
- Power-efficient and cost-saving – save money for updating hard or flash drives
- Customizable – this is a big advantage for advanced user. This manual will teach you step by step to create a customized file/web server on NSLU2 from scratch
I value these features more than what Linksys advertises. Believe or not, NSLU2 can be used as Linux machine after it is customized. The NSLU2 user community has found a way to install a full functional Linux system (Debian Linux) to the device. I own NSLU2 devices with Debian installed. Because of Debian Linux running in the machine, there is numerous GNU software available for it. You can do whatever you want in the machine once Debian is installed. We do not discuss how to install Debian to NSLU2. If you are interested in this topic, please visit http://www.cyrius.com/debian/nslu2/.
In this document, I will explain in detail how to convert your NLSU2 into a full-blown file/web server. Do not panic. It is pretty easy to do if you follow the steps described in this document. Anybody with a little bit computer experience can do it.
After you get a band new NSLU2 device, you can convert it to a full-blown file/web server by following the steps described below. In this step, what you will do is to take advantage of the software and firmware provided by Linksys.
A. Use Linksys setup disk to change the device�s default settings
The setup program in the CD gives you capability to change default IP address and current date and time of the device. In this step, we want to change the fixed IP address to a dynamic IP address. The following three screen shots show how to do it step by step.

Figure 2. In this screen, you can change a fix IP address to a dynamic IP address. Just simply click “Automatically obtain an IP address (DHCP)” option and you are done. This effect will show in next screen shot.

Figure 3. A screen shot after selection of a dynamic IP adrress

Figure 4. This is a screen shot for changing time zone, date and time
Once the setup program is complete, the device will reboot. After the NSLU2 is fully rebooted, go to your router’s maintenance web page and check the client list of your router (see Table 1). You can find the IP address of your NSLU2 device. For my situation, the IP address of my NSLU2 is 192.168.2.3. From now on, I can use this IP address to access my NSLU2 in my LAN.
Table 1. Client IP addresses from the client list of a router
| Type | Name | MAC Address | IP Address | Expiration | |
| wired | FertileLand | 00:40:2B:6A:E7:08 | 192.168.2.2 | 54 minutes | 27 seconds |
| wired | LKG7E5076 | 00:0F:66:7E:50:76 | 192.168.2.3 | 59 minutes | 11 seconds |
In most cases, people who read this manual are not a Linux guru even do not know anything about Linux. So the NSLU2 devices you operate usually have Linksys default firmware. If this is the case, you can follow the steps described in section A to upgrade the device to Unslung 6.8. Sometimes you have a device that already has non-Linksys firmware. If that is the case, please follow the steps described in section B to upgrade the device to Unslung 6.8. Before you do upgrade your NSLU2, please download the Unslung 6.8 at http://www.slug-firmware.net/u-dls.php to your computer and unzip the package. Later on you will need the unpacked the bin (Unslung-6.8-beta.bin) file during the upgrade process. If there is a USB drive connected to your NSLU2, please unplug it first before firmware upgrade.
A. Use NSLU2 web interface to upgrade firmware
You know the IP address of your NSLU2 device. You can access its web interface to do more advanced setting even upgrade its firmware. We will take advantage of the functions provided in the web interface to install the customized firmware. In our case, it is Unslung 6.8 beta version (http://www.nslu2-linux.org/wiki/Unslung/HomePage). The following describes the detail steps.
- In the address bar of your web browser enter 192.168.2.3, the default NSLU2 web interface will show up;
- Click “Administration” link and a login dialog window pops up. You should use the default username (admin) and password (admin) of the Linksys NSLU2 to log in;
- Click “Advanced” -> “Upgrade” to get into the upgrade firmware page;
- Click “Browse…” button to find the customized firmware (Unslung-6.8-beta.bin) on your hard drive;
- Click “Start upgrade” link to upgrade the customized firmware.
The upgrade process will take several minutes to complete. At the end of the upgrade process the NSLU2 device will reboot automatically.
B. More advanced way to upgrade your firmware
This is a method recommened from the “Unslung-6.8-beta-README.txt”. You must follow the steps described here in sequence. The text in this section is mainly from “Unslung-6.8-beta-README.txt”.
If you are installing Unslung 6.x onto an NSLU2 unit with an existing version of nslu2-linux.org firmware already installed, you must first put the NSLU2 into RedBoot Upgrade Mode.
- The NSLU2 should still be powered off at this point. If not, shut it down again before proceeding.
- Using a paper clip, push and hold in the reset button which is located on the back of the NSLU2 near the power socket.
- While holding in the reset button, press and release the power button.
- Watch the Ready/Status LED, and as soon as it turns red quickly release the reset button.
- You should now be in upgrade mode which is indicated by the Ready/Status LED alternating between red and green.
- Use either the Linux UpSlug2 tool or the Windows SerComm Upgrade tool to upload the new firmware. You can find download links at http://www.sunfinedata.com/nslu2/download.html or http://www.nslu2-linux.org/wiki/HowTo/InstallUns lungFirmware.
7) During firmware flashing, the top LED – Ready/Status – flashes red and green (approximately 5 minutes, but can be much longer).
The NSLU2 will reboot after the flashing is complete.
5. Prepare the NSLU2 device for unsling
A. Check version see if the upgrade was successful
After the NSLU2 is rebooted (no any disk attached), check if it is successfully upgraded. Enter the NSLU2′s IP address (192.168.2.3 in my case) into your web browser’s address bar, the NSLU2 web interface show in the browser. If you see the version information is “V2.3R63 uNSLUng-6.8-beta”, that means the firmware has been successfully upgraded. Otherwise, you have to repeat the steps described in the upgrade firmware sections.
In the Unslung web interface, click “Manage telnet” link, then click “Enable Telnet” button in the new page. After the page is refreshed, you will see current telnet service status is “Enabled”. Click “Back” link at the bottom of the page to go back the NSLU2 main web page.
C. Telnet into the device
Once the telnet service is enabled, you can telnet into the NSLU2 device by following the simple steps here.
- Click “Start in Windows system bar and then click “Run” in the Start menu;
- Enter “telnet 192.168.2.3” into the textbox;
- Click “Open” button to run telnet program, a console window pop up to tell you connecting to the server;
- Then you have to login the NSLU2 device by using “root” as username and “uNSLUng” as password;
- The NSLU2 device will show the welcome information and tell the NSLU2 is running in the internal flash. Leave this window open while you carry on the following activities.
D. Format a flash or hard drive
Now you have to format your flash or hard drive. We recommend that you attach your flash or hard drive to USB Port 2 always. Here are the steps.
- Plug your flash drive or hard drive to USB port 2 (This is very important!!!!);
- Reflesh the NSLU2 web interface;
- Click “Administration” -> “Advanced” -> “Disk“. If needed, please use admin/admin as username/password to log in the device;
- Click “Format disk2” to format the flash or hard drive attached to USB port 2;
- Click “OK” for the popup confirmation window;
- After formatted, you may get error information. If so, detach your drive and reboot your NSLU2 device. After rebooted, repeat steps in sections B to D to format your drive;
- If no error information appears, please click “Home” link to switch to the main page of the NSLU2 web interface. Check the device status information and see if you can confirm that USB Port 2 is correctly formatted. If the drive attached to USB Port 2 correctly formatted, you will see a message very similar to “USB Port 2: Ready, 710MB (85% Free)”. Then you can go to next section.
The official install guide of Unslung 6.8 is at http://download.berlios.de/unslung/Unslung-6.8-beta-README.txt. Please follow this guide closely. The simplifies steps are listed here.
- Follow steps in the previous section to enable telnet and telnet into the device;
- Plug your USB flash drive or hard disk to the device;
- Refresh the web interface and check the disk status. If you see “not installed” at the USB Port2, that means your drive is not formatted or incorrectly formatted. You have to repeat the steps in previous section to prepare your drive;
- If you see “USB Port 2: Ready, xxxGB (xx% Free)” or something like that, that means your drive is ready for being unslung. You can proceed to the next step;
- In the telnet console window, you can type “/sbin/unsling disk2″ to unsling the file system to DISK2;
- In the telnet console windows, type “reboot” to reboot the NSLU2;
- After the device is rebooted, refresh the web interface. You can see the following information in the home page. This information confirms that your NSLU2 was correctly unslung.
Table 2. Correct information of an unslung NSLU2
| Server Name: | LKG7E5076 |
| Version: | V2.3R63-uNSLUng-6.8-beta |
| IP Address: | 192.168.2.50 |
| USB Port 1: | Not Installed |
| USB Port 2: | Ready, 729MB (96% Free) |
After successfully unslung you “slug”, you should complete the following two steps before install new packages.
If you want to use the file/web server to serve your LAN and the world, you can simplify your life by changing the dynamic IP address to a fixed IP address. Here are the steps to set a fixed IP address.
- Click “Administration” -> “LAN”. If needed, please use admin/admin to log in;
- Change IP address to “Fixed IP Address (recommended)”;
- Enter a fixed IP address in the IP address row, for example, 192.168.2.100 as shown in Figure 5. You have to choose one based on your real situation;
- Enter 255.255.255.0 in the network mask row;
- Enter the gateway IP address. It usually is the IP address of your router. For example, it is 192.168.2.1 in my situation;

Figure 5. IP address setting - Enter your router’s IP address into the primary DNS server’s IP address. For example, it is 192.168.2.1 in my situation;
- Click “Save” link at the bottom of the page to save your change. You are done once the page is flashed back. From now on, we will use IP address 192.168.2.100 to refer the NSLU2.
We want that the web server is running in a separate user. The following steps tell us how to create a new user called “wwwroot” that will be used as the user of web server.
- Click “Administration” in the NSLU2 web interface;
- Use admin/admin as username/password pair to enter the administration page if necessary;
- Click “Users” to open user setup page;
- Enter “wwwroot” in the “name” box;
- Enter “wwwroot” in the “password” and “verify password” boxes;
- Check “Create Private Folder (Share)” option and make sure “Disk 2″ is in the “Private Folder (Share) Location” option box;
- Click “Save as a new user” button to save create the new user (See Figure 6);

Figure 6. Create a new user - Select the newly created “wwwroot” user in the user list box (See Figure 7);
- Click “Groups” button below the list box;
- Check the group information in the left side list box of the popup window. If it does not have group called “everyone”, please remove any groups in the list box first and add “everyone” group into the left list box;
- Click “Close” button in the window. After the window is closed, you have completed the process to create a new user.

Figure 7. Change group information
In the last section, we describe what packages we should install for a full-blown file/web server. Since we will use Linux commands to complete all the steps, you have to telnet into the NSLU2 device first. Please use your web browser to open the NSLU2 web interface. The interface should look like Figure 8. Please check ther banner at the bottom of the page. If it shows “uNSLUng status: Unslung to disk 2, /dev/sda1″, you can proceed the following steps. Otherwise, if you see “uNSLUng status: Running from Internal Flash”, you have to go back to unsling section to successfully complete those steps.
Click “Mange Telnet” link in the top right side to open the manage telnet page. Click “Enable telnet” button and click “back” link in the refreshed page. Now you can telent into your device and log in by using root/uNSLUng combination or root/your customized password dung the unslung process. Once you telnet into the NSLU2 device, you can follow the following text to install and configure the essential packages.

Figure 8. The snapshot of the web interface of an Unslung NSLU2 device
The ipkg is a tool that is used to install and remove software. There are tons of software available for Linux/unslung system. Before you use it, you have to execute the following commands. These commands will update the package list and essential things for ipkg.
# update ipkg
ipkg update
ipkg install unslung-feeds
ipkg update
Telnet is a unsecure way to log in your NSLU2 device. OpenSSH provides secure way to log in your device. In order to secure your device and skip the step to enable telnet, you have to install OpenSSH by executing the following command.
# install openssh
ipkg install openssh
After you successfully install OpenSSH on your device, you can use PuTTY to test your brand new ssh server. You can download PuTTY at http://www.sunfinedata.com.
C. Install webalizer and configure it
Webalizer is a useful software that can generate html pages that include visit statistics in tables and graphs. You can use these pages to monitor how your web server serves the world and detect any problems, such as dead links. Please execute the following commands and stemps.
# install webalizer
ipkg install webalizer
chmod +x /opt/bin/webalizer
cp /public/webalizer.conf /opt/etc/
chmod +r /opt/etc/webalizer.conf
cp /public/update-webalizer-stats /opt/etc/
Please note the config file should be copied to public folder. You can find the config file at http://www.sunfinedata.com.
In order to automatically run the webalizer to update visiting reports, you have to add one line to /etc/crontab. You can use vi or nano to edit /etc/crontab by adding the following line. After you complete this step, your web site visiting reports will be updated every 6 hours.
59 5,11,17,23 * * * root /usr/bin/webalizer &>/dev/null
Now you can setup thttpd for our web server. Since the Unslung already includes a default web server running at port 80 (serving the web interface). We have to setup our own web server at a different port 8080. To do this, please follow the following commands.
#Setup thttpd web server
mkdir /opt/var
mkdir /opt/var/log
mkdir /opt/var/run
cp /usr/sbin/thttpd /opt/sbin/mythttpd
cp /public/mythttpd.conf /opt/etc/
cp /public/S8080mythttpd /opt/etc/init.d
chmod +x /opt/etc/init.d/S8080mythttpd
chmod +r /opt/etc/mythttpd.conf
After you complete this step, please type http://192.168.2.3:8080/ at your web browser’s address box to browse the first page of the server. You can visit http://192.168.2.3:8080/_stats/ to monitor how your web server serves the world.
The following is a sample of mythttpd web server config file. You can find the config file at http://www.sunfinedata.com.
mythttpd.conf
# This section overrides defaults
dir=/share/flash/data/wwwroot
nochroot
nosymlink
user=wwwroot# default = nobody
logfile=/opt/var/log/mythttpd.log
pidfile=/opt/var/run/mythttpd.pid
cgipat=**.cgi
# This section _documents_ defaults in effect
port=8080
# nosymlink# default = !chroot
# novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
charset=utf-8
9. A shell script to accelerate the setting
To manually complete the above steps, you have to type a lot Linux commands. To get thing simple and straight, a shell script (postunsling) was provided to accelerate the setting process. The zip file provided at http://www.sunfinedata.com includes this shell script plus all config files and other related files. Please extract these files to a folder on your desktop machine and copy all files under folder “Webserver” to public folder in your device. Then add execute privilege to the postunsling shell script at an ssh console. Run this script once you complete all manual work through the web interface.
postunsling
#!/bin/sh # # This shell command file is used to config openssh, mythttpd, and webalizer # That can minimize the manual work and reduce any possible errors # # # Before run this script, please create a new user through NSLU2 web interface # the username and password should be wwwroot/wwwroot # This is the default user of web server # Users will use it to upload files to the server # # update ipkg ipkg update ipkg install unslung-feeds ipkg update # install openssh ipkg install openssh # install nano editor ipkg install nano # install webalizer ipkg install webalizer chmod +x /opt/bin/webalizer cp /share/flash/data/public/webalizer.conf /opt/etc/ chmod +r /opt/etc/webalizer.conf cp /share/flash/data/public/update-webalizer-stats /opt/etc/ chmod +x /opt/etc/update-webalizer-stats # config mythttpd server mkdir /opt/var mkdir /opt/var/log mkdir /opt/var/run cp /usr/sbin/thttpd /opt/sbin/mythttpd chmod +x /opt/sbin/mythttpd cp /share/flash/data/public/mythttpd.conf /opt/etc/ chmod +r /opt/etc/mythttpd.conf cp /share/flash/data/public/S8080mythttpd /opt/etc/init.d/ chmod +x /opt/etc/init.d/S8080mythttpd mkdir /wwwroot/_stats chmod +r /wwwroot/_stats chown wwwroot:everyone /wwwroot/_stats cp /share/flash/data/public/index.html /wwwroot/ chmod +r /wwwroot/index.html
This guide is provided as is without any warranty. The author and sunfinedata.com does not assume any responsibility if you damage your device. You are on your own by following the steps presented in the document.
Reference

[...] Build a full-blown file/web server on Linksys NSLU2 Posted 2009/08/17 by Zhanshan Dong. Comments and trackbacks are open. Follow the comments feed. Filed under: Hands-on Tutorial Tagged with: file server, Linksys, NSLU2, user guide, web server. [...]
[...] Build a full-blown file/web server on Linksys NSLU2 [...]
Hey, would you like to submit comments and backlinks to millions of blogs automatically? Blog Comment Poster will do it for you. Blog Comment Poster will increase your traffic, backlinks and earnings dramatically! Sounds cool? Yes, it is cool! It’s the best automated comments posting tool on the Internet with many advanced features. Check it out!