Press "Enter" to skip to content

How to: Set up a thin client cluster

For my final project in my CSC-231 computer organization class at Furman University, I had to set up an Ubuntu server to run some services. I’ve always been interested in computer clusters and PXE technology, so I decided to install the Linux Terminal Server Project (LTSP). In this tutorial, I’ll show how I set up a basic thin client server that provides a NAT for thin clients to tunnel through for internet access.

Prerequisites

In order to complete this project, I chose the following materials:

+ Dedicated terminal server:

  • Asus DSAN-DX server motherboard and power supply
  • 2 network interfaces (eth0 and eth1; on motherboard)
  • 750GB Hard Disk
  • 3.25GB RAM
  • CD-ROM drive

+ Ubuntu 10.10 Desktop CD

+ 100Mbps switch

Hardware Setup

Here is the way that we set up our server. The physical terminal server has two NICs: one for connecting to the internet, and one that creates a LAN for all of the thin clients. We also got a fast switch for communication between the terminal server and the clients. Not shown, we had a monitor, keyboard, and mouse hookup for all the machines.

Preparing the Thin Clients

Any old machines that you have lying around can be turned into thin clients, and with no loss of data or major reconfigurations necessary! Well, the machine can’t be too old, as it needs to support net booting, or PXE. This usually depends on the BIOS, and most modern BIOSes support PXE. If your BIOS doesn’t support PXE, you can get a custom ROM chip that you can install in your network card that will allow it, but this is usually a non-issue. Another thing you must be aware of is that PXE currently does NOT work with wireless networks. You will need a wired connection to a switch on all of the thin clients that you want.

To prepare the thin clients for use, go into the BIOS for your machines and change the boot priority to use PXE, netboot, network, or your network card’s name. If you are using a Dell PC as a thin client, you may need to enable PXE under Network settings in the BIOS before netbooting will show up as an option on the Boot menu.

Preparing the Switch

If your switch happens to be a router, you must turn off the router’s DHCP functionality before you can use thin clients. The way that we are configuring this, the terminal server will be a DHCP server (something that assigns IPs to devices on the network.)

Installing Ubuntu 10.10

Firstly, even though this is a server, do not install Ubuntu Server edition. If you do, the process of getting a GUI running on the thin client will take more time than necessary. Install Ubuntu 10.10 by doing the following: (quite generic at this point)

  • Put the Ubuntu 10.10 desktop CD in your server’s CD drive
  • Press <Enter> when you see the purple start-up screen with the Universal Access logo to access the Ubuntu install menu. Select “Install Ubuntu” from the menu.
  • When the installer appears, progress through the installation wizard as normal, making sure that you wipe the disks on the machine and do a clean install. (This is a dedicated machine, you know)

Once you have finished the Ubuntu install and are sitting at a clean 10.10 desktop, it’s time to configure it.

Configuring the Terminal Server

Instructions largely based on the LTSP Quick Install guide on the Ubuntu Wiki.

Once you log into Ubuntu for the first time, you will need to configure it to be a terminal server. Make sure that your NIC’s are configured so that eth0 is facing out to the internet (ISP provided hostname and DNS) and that eth1 is plugged into the switch. Since eth1 is going to act as a DHCP server, set its IP address as 192.168.0.1. Next, install the LTSP server by opening a terminal (Applications > Accessories > Terminal) and executing the following:

$ sudo apt-get install ltsp-server-standalone openssh-server

This will install the Linux Terminal Server Project, DHCP3, and all the other packages necessary for you to boot your thin clients. Next, open the DHCP server config:

$ sudo nano /etc/ltsp/dhcpd.conf

Edit your dhcpd.conf file to match the settings of your eth1 NIC. Next, save the file and restart the server:

$ sudo /etc/init.d/dhcp3-server restart

Now the DHCP server should be ready to go. You should see an [OK] message in the output of the restart. If it fails, check your config file and your IP on eth1 and try again.

Next, lets create user accounts for all the thin clients that you are going to use. This is recommended so that you can easily run processes assigned to each client. Go to System > Administration > Users and add a new standard user account with a name that is easily identifiable (thinclient01, thinclient02, etc…) and when you are finished, it is time to build the thin client system. Open up a terminal and run the following command:

$ sudo ltsp-build-client

This command will download from the internet all of the files required for a Ubuntu LTSP minimal installation and put them into the /opt/ltsp/i386 directory. This directory will be very important later on in this tutorial.

Once the thin client image is done being prepared, you are ready to boot your first thin client.

Booting the first thin client

Make sure that your switch is on, all cables are properly connected, and that you have a mouse, keyboard and monitor plugged into your thin client. Make sure you have also completed the steps in “Preparing the thin clients” above. Turn on the power to the thin client and make sure that it is set to boot from network. You should see that the thin client is assigned an IP and begins to download the image that you built on the terminal server previously. After seeing the Ubuntu logo you should be at a login screen, and your IP address of the machine should be in the corner.

Attempt to log in with the account you created above. Either you will be successful, or you won’t be. If you are not successful, first check your password and try again. If you are still not successful, go back to the terminal server and run the following command, which will update the server’s SSH keys and allow you to log in:

$ sudo ltsp-update-sshkeys

Try logging in again and this time an SSH session will be started connecting you to a remote X session on the server. While this is ideal for schools and workstations, all the processing power is being done on the server, so it’s no different than having a remote desktop session open on a computer that is running a different OS. This is not what we have set out to do, but it’s a great interim to be at.

On the terminal server, open the Thin Client Manager (System > Administration > Thin Client Manager) and make sure that you see your thin client listed under “Connected Clients.” Also, right click your thin client and click on “Execute command.” The command you want to execute will start an X terminal on the thin client, but using the thin client’s processing power, not the server’s:

ltsp-localapps xterm

You should see a terminal window popup on your thin client that reads [user]@[yourthinclientname]. The thin client’s name is the same as the one that was listed on the login window. Now try to ping Google:

$ ping google.com

This should fail, as we haven’t set up networking on the thin client’s local applications yet. However, if you open a regular terminal on the thin client (Applications > Accessories > Terminal) and try to ping Google, you should be able to reach it. Why is this? The reason is because you are running this terminal on the terminal server, which already has access to the Internet via eth0. What we need to do now is configure the terminal server and the thin client image so as to set up a NAT between the internet (eth0) and the switch (eth1).

Setting up a NAT

Instructions largely based on the Thin Client NAT Howto on the Ubuntu Wiki.

On your terminal server, open up the DHCP server configuration once more:

$ sudo nano /etc/ltsp/dhcpd.conf

Next, look for the text “option routers [eth1 IP]”. If you do not see it, add it into the main block:

subnet 192.168.0.1 netmask 255.255.255.0 {
	...
	option routers 192.168.0.1;
}

Save and close the file. Now, reboot the DHCP server:

$ sudo /etc/init.d/dhcp3-server restart

Now, open the system configuration file:

$ sudo nano /etc/sysctl.conf

And look for the following command, adding it if it isn’t in the file:

net.ipv4.ip_forward=1

Save and close the file. Now run the following three commands:

$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo iptables --table nat --append POSTROUTING --jump MASQUERADE  --source 192.168.0.0/24
$ sudo sh -c 'iptables-save > /etc/ltsp/nat'

These will enable the NAT and make requests from the thin clients able to be forwarded to the right places on the terminal server.

Now, right click on the network icon on the Ubuntu menu like before and click on Connection Information… to find out what the DNS server you are using is for eth0. This is important so that you can route the thin client requests on from the terminal server to the internet. Copy down the IP of the DNS server and once more edit the dhcpd.conf file, this time including the line “option domain-name-servers YOUR DNS IP;” and then restart the DHCP server one final time:

$ sudo nano /etc/ltsp/dhcpd.conf
subnet 192.168.0.1 netmask 255.255.255.0 {
        ...
        option domain-name-servers [DNS IP];
}
$ sudo /etc/init.d/dhcp3-server restart

Reboot the thin client, open a local terminal and ping Google again. It should be working! If not, check your DHCP server configuration and make sure you have IP forwarding enabled. Also make sure that all your IPs are correct in your configuration files!

On the terminal server, it is time to install openssh on the thin client image, which is required for the next step. The way that we will do this is by running the following commands:

$ sudo chroot /opt/ltsp/i386

You will now be inside the LTSP client image. It will say root@[your computer name]#. The first thing you will want to do is change root’s password:

# passwd root

This is important since you will need to log in as root later on and will require a password. Install the openssh server and exit out of chroot:

# apt-get install openssh-server
# exit

Now, update the thin client image and reboot the thin client:

$ sudo ltsp-update-image

After logging in to the thin client, start the openssh server. Start a local terminal and type the following:

$ su -
# /etc/init.d/ssh start

Now start all of your thin clients, log in, and make sure an SSH server is running. You can test to make sure by going to the terminal server and trying:

$ ssh [THIN CLIENT IP]

This should bring up a login prompt. If it does not, make sure that the server is running and try again.

Installing and deploying Folding@Home and Origami

I would recommend that you create a Folding@Home team first. This helps you track the performance of all your thin clients as one unit, not as each individual client. Fill out this form to create a team and get a team number. Another thing that you’ll need is a passkey. Go here to get one once you have a team number and username.

On the terminal server, this is a pretty straightforward process. First, install Origami:

$ sudo apt-get install origami

Change to your home directory and make a file called .origamirc:

$ nano ~/.origamirc

Put in this file a list of all the thin client IPs that you know, separated by line. You can look at the IPs of currently logged in thin clients in the thin client manager we installed previously. The file should look similar to the following:

192.168.0.20
192.168.0.21
192.168.0.22
192.168.0.23
etc.

Finally, execute the following commands to start Folding@Home and finish up your cluster!

$ sudo origami install  -u [USERNAME] -t [TEAMNUMBER]
$ sudo origami deploy -u [USERNAME] -k [PASSKEY]

Be prepared to enter your root password A LOT. At least 3 times for every thin client. Also be prepared to wait quite a long time. Finally, make sure that you keep your thin clients and terminal server powered on all the time, as every time that you reboot you will need to do the following:

  • Start the terminal server and thin client manager
  • Start the thin clients and log in to each
  • Start openssh on each of the thin clients (if it doesn’t start automatically)
  • Run the Origami deploy command

Now that Origami is installed and deployed, you can check the status of each individual thin client by running the following command on the terminal server:

$ sudo origami network-status

And the status of your current machine:

$ sudo origami status

Conclusion

Congratulations! In 2,113 words you have learned how to install a Linux terminal server and a Folding@Home cluster, and with no cost to you except time and some old hardware! Enjoy helping to cure cancer from the comfort of your own home!

Acknowledgements

Thanks to Furman University for providing the awesome, high performance server and four thin clients for this project! This was a great opportunity for me to do something that I’ve never had the resources to do at home.

2 Comments

  1. Jaco Botha Jaco Botha July 25, 2011

    Excellent I cant wait to use it. Im a teacher in South Africa with no resources(worth mentioning) looking for a cheaper sollution for bridging the digital divide. Would have cost me $2000+ that is 3x my pay. Thanx alot. The governments would probably remove this from the internet soon because its costing them money 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *


*