Back to Technical Index

Turning a PC into a Terminal Server

Starting Idea:

Well... It started like this: There was gonna be a LAN-party (network gaming party) near here. For some reason you don't want your friends to bring their Hard Disk Drives with them, you don't want it to look like one of those file-trading-partys, you just want to play some games, clean and safe.
The problem is... it sound rather strange nowadays to run a PC without a hard disk. "There has to be an Operating System somewhere!"
At that moment I already heard about those "diskless PCs" "Thin-Clients" etc. and wanted to try it myself.
The concept of those system is, that the client PCs run without any Hard and Floppy Disk drives. They boot up using a special BOOT-Rom on their Network cards. Still those BOOT-Roms are rather small (just a few KB, far from a Meg), it's impossible to put a full OS there. (hmm - perhaps not impossible but rahter a challenge - but that's not the idea of this decoument).
So on this Rom there's only a few instructions, jsut enough to make the PC get all it needs to really start up.
When that Rom is booted the network card "asks" the network for an IP and the information to continue. Then they can get all files necessary to boot up over the network and start to work over ethernet.

OK, there's a slight bit of a problem. Although your party-guests tend to have a network card in their PCs (and lots of them even have a socket for the Boot-rom), it is rather uncommon having a boot-rom installed on it.
So we need a compromise. We are using a "simulated" Boot-Rom. You can also write the boot-information to Floppy-disk, so your guests simply put in the Bootdisk (for their Network Adapter) and then everything else is like booting from BootROM. Once booted they can even remove the Bootdisk and hand it to their neighbour.

The system to be booted will be Linux... Linux is free software and - like said above - we want the whole thing clean, safe and free. It's also the only Operating System I yet tried and there is a lot of documentation on it.

Okay, let's not forget the important thing: Although it is very nice to play with the basics of Linux and there is a lot to learn, your guests perhaps want to play a real game.
For this example I'm choosing FreeCiv. It's open-source, easy to compile and great fun to play with lots of players.
There is also a very nice Multiplayer-textmode-game: HUNT. If some of your guests can warm their hearts for Console-play and the VI-style-key-assignment, you might want to try that out, too.

Summary:
We want to build a Linux-Server, that clients can boot from.
We want to install FreeCiv.
We want to have some boot disks at hand (although on some parties, the RTL8139 will suffice).
and we want to do everything using free software.

Note: At this point I presume, you are using a working Computer. All necessary hardware is physically installed and connected. You should have about 2 GB of free Hard Disc space, although I believe you can get away with a lot less. I also take for granted that you have at least some experience with computers. I also recommend having another PC available so you can try the netbooting later - it is hard to try that from the netboot-server itself. Also prepare a boot-disk for that testing PC and try booting up again and again in the progress. It is interesting to see how far it loads after which step of the installation.
At the beginning it should only state its MAC-address and telling you it's searching for a DHCP-Server. In case it already finds one, you have a DHCP-Server somewhere on your net. Try isolating the testing PC and the Server-to-be from that Server (sometimes Router) as your Server-to-be will have its own DHCP-Server and is likely to collide with the other one.

My chosen toolbox:

LTSP (Kernel, Core, X-Core, X-Fonts)
The Linux Terminal Server Project already has a lot of data and documentation. Without their homepage I would not have tried out this whole diskless-thing for a looong time.
Suse Linux 7.1 (+Patch - see below)
Okay, Suse is a distribution you have to buy, and version 7.1 is a bit outdated - but this is the version I have. You might try with never versions. You might need a small patch somewhere in the install but I will tell more at the exact point.
and the latest FreeCiv distribution.
www.freeciv.org - You might also want to read a bit about that game and print out some manuals.

Suse Linux 7.1
I started with the Standard(non-office) installation... nothing much to say.
You might want to start with a minimum installation and then building yourself up from there... Just don't forget to install KDE... and in 7.1-non-X-installation there's one screen where you have to press ALT+F1 to continue installation.
(At one point the System asks you to reboot. If after rebooting you end up with a blank screen and only a cursor, try pressing ALT+F1)
I chose against the minimum-building-up because I wanted to play on the server itself. Why should I leave all the fun to the guests alone?
But I still plan to do a Server without monitor, keyboard and mouse... Perhaps I'll add some comments on that, later...

I personally recommend to install one of the default options (Minimum, Standard, Office, Everything) and fiddle with the smaller packages once the main installation is complete.
It shouldn't be too important what kernel to choose. I vote for the 2.4 - because it has a higher version number and everything worked with my hardware - don't worry, you can install the other one if needed.
in case you're experienced some more you might decide to build your own kernel - or even have done that a lot of times - but I just wanted to write about some simple way.

LiLo:
Install the LiLo depending on your configuration and your personal taste.
As my "Freeciv-Bootserver"-Harddisk is not built into the PC all the time, I created a boot disk.
You might need to reboot your PC more than once and therefore a bootdisk for the system might come in handy...

After that the main installing will take place - Formatting hard discs, copying the packages etc. This will take a while... so relax and prepare for the challenges yet to come...

Also note that 7.1 can have a small problem with network card installation. (I personally get that bug with the RTL8139-card)... so if it says it couldn't write modules.conf and leaves you with some modules.conf.- in the /etc directory then you have to install a small patch:
"y2base.rpm" - simply the suse database for the "modules.conf" and you will find that easily.
You might want to have that file on a CD. Or on another HD partition - that makes the update easier. But you can also install it via network. It is a bit tricky, but it's not too hard net-copying files although there is that bug.
(The bug won't let you save your network configuration... but you can still use network until the next boot)


So, now you have your Linux-PC working and communicating with your ethernet.
Try not to choose 192.168.0.254 as IP because that is the default IP for the LTSP server used when there is nothing else in the config files.
We don't want to have things THAT easy. It is also interesting to know where you have to change that IP in the config files.
If you already have a small network at home, you might want to isolate that new server in a new subnet. That way it won#t interfere with the rest of your network - and the later testing will be much more honest.

Okay, we skipped on fiddling with the smaller packages before, so let's do that now:

Serie AP, Packet MC:
Midnight Commander. Make sure you have it installed. It's not only a wonderful tool for copying and moving files (Perhaps you know Norton Commander, the MC is a clone), the built-in File Editor mcedit is also a bit easier to use than VI or Emacs (In my opinion... and I don't want to start wars about that)
Serie D, Packets GCC, MAKE, LINCLUDE:
We are gonna compile Freeciv later on, so we need a compiler, the make-tool and the smallest available Include-Files.
Serie fun, Packets ?:
Hey! We are installing a game server, so having some games here wont hurt. Just don't choose the most graphical intense and processor consuming ones.
The BSDGames are nice because they don't need much graphic at all (Console games)
You can use the freeciv-package from here but I recommend compiling a more current one.
Serie ham, packets ?:
Just in case you're having your party in the basement of a school with some amateur radio equipment, you might want to install some of those, too. Don't ask me how I could think of something of this.
Serie n, packet DHCP:
You need to shuffle out some IPs to the clients, so you need a DHCP-Daemon.
on the other hand you can delete the DHCP-client.
Serie n, packet etherboot:
here are all the nice boot-rom-images you need. i'll write a bit more about them, later
Serie n, packet inetd:
an absolute must for doing something over network. I consider "DHCP-Giving out IPs, Gaming, NFS, TFPD..." to be something over network.
Serie n, packet ircd:
This is an IRC-Server. It is not really needed. But experience has shown that some chatting during games is nice. (Although most smaller LAN-parties are in rather small rooms you can talk across).
The Freeciv chat implementation didn't look so very nice the last time I looked.
(by the way: I don't know how to use that server, so don't expect lots of information about it)
Serie n, packet ircii:
This is an IRC-Client. All your players will need a client to connect to the IRC-Server
Serie n, packet nfs-server:
Don't install that packet, NFS should be integrated in the kernel.
Serie n, packet portmap:
You need this for some of the NFS-stuff.
Serie n, packet samba:
this packet provides compability with the Windows-Network Filesharing system. So if no one's gonna appear with a Windows-PC anyway, you won't need this. But Samba sure is worth looking on it.
Serie n, packet: tftp:
I tend to overlook that one again and again. but it IS important for serving the clients a kernel.

You could also deinstall many other packets... but I don't want to list all of them...
Now you can start the installation and are in for some more or less serious Disk-Jockeying. (except if you're using a DVD or something and spoil all the fun)


Next you should change some things in the configuration file (rc.config):

KBD_NUMLOCK -> yes
I just hate to start typing some numbers and then finding out I moved the cursor all over the screen.
NFS_SERVER ->, yes
sure we need that...
SERIAL_CONSOLE -> ?
We don't need that now, but if you have a spare WYSE or QUME Terminal you might want to turn that feature on, one time... it's REALLY easy.
START_DHCPD -> yes
we need that! Our clients want to have an IP
START_IRCD -> yes/perhaps
still need to find out a bit about configuring... but perhaps it'll work without on some systems.
START_PORTMAP -> yes
normally this should already be switched on... but just make sure it is.


Now let's install the LTSP packages... I tend to install the core via console
rpm -ivh ltsp_core-#####
(because it responds with a message)
and the other three files with yast (because they don't respond with messages to confuse yast)...


When the clients "boots up" from disk, the first thing it needs is an IP-Address. Our DHCP-Daemon is responsible for handing out those adresses but therefore needs a bit of configuration in
/etc/DHCP.conf
I didn't want to collect all the MAC-addresses from my guests so I wanted to keep most of the configuration general...
(btw: the MAC-address is a series of number unique for each network adapter in the whole world.)
default-lease-time 600;
max-lease-time 7200;
# you might want to change the times... I didn't consider it to be important
option domain-name "Lan-party.here";
# just give your domain some name... perhaps it's not needed anyway.
option subnet-mask 255.255.255.0;
# so all PCs having the same first 3 numbers will be able to communicate
option root-path "192.168.200.200:/opt/ltsp/i386";
# this is the path from where the Clients will get their root
# be sure to insert your servers IP there.
filename "/lts/vmlinuz.ltsp";
# this is the kernel the clients will try to load.
# you should note that the LTSP-Installation has put files with other filenames into that folder
# so you should copy, rename or link one of those files to that filename...
# (or change the filename here)
# btw: the root directory for tftp it /tftpboot - so this line in reality links to
# /tftpboot/lts/vmlinuz.ltsp
subnet 192.168.200.0 netmask 255.255.255.0 {
# here you start the definition for your clients.
range 192.168.200.100 192.168.200.199;
# first number is the first available number, second the last.
# make sure that those are in the given subnet... and won't collide with your server-IP
# That way we are able to serve about 100 guests. Should suffice for some smaller parties.
}
# technically that's all
# You might want to have some Clients with special configuration
# (like the mouse on serial port instead of PS2)... so you have to give
# them their own name... - you can also give them a fixed IP if you like...
host Playerkiller{
# choose whatever name you like - or that specific guest likes.
hardware ethernet 01:23:45:67:89:ab;
# As the client PC has not booted up yet, there is only one thing to identify it - the MAC address. so insert it here.
# now you already gave one client a name... you can use that later (ltsp.conf) but you can
# also add some options here for that player... like:
filename "someotherKernel";
# another Kernel
fixed-address 192.168.200.99;
# a fixed IP-address
option-129 "NIC=3C509 IO=0x240";
# or options for the kernel
}

There are some problems with ISA-cards. They are not found automatically by the kernel so you have to add their name as a parameter to the kernel (like with option-129 above). But even then I'm not sure if that works.
Of course it's better to ensure that everyone has PCI-Network-cards installed. You might want to have one or two in reserve if some ISA-players show up.
btw: most cheap Ethernet-cards are RTL8139 (100MBit) or RTL8029 (10MBit), they are recognized easily.
If you reboot your server and then try the testing PC again, it should get its IP and claim that there is no kernel to be found.


After the clients got their IPs, they want to load the kernel. That's why you provided a "FILENAME" in the dhcp.conf. The clients are gonna try to load the kernel with the tftp protocol so you have to make sure your Server has that daemon running..
It's rather easy: Simply uncomment the line with the
tftp
in
/etc/inet.d

While loading the kernel, your clients will need to mount some directories. This is done via NFS (Network File System). Of course your server has to supply those directories. That's why you needed to supply the "root-path"...
Those directories are mounted using the NFS (Network File System). Of course your server must be able to serve those directories. Therefore you have to add some lines to the
/etc/exports:
/opt/ltsp/i386 192.168.200.0:255.255.255.0(ro,no_root_squash)
/var/opt/ltsp/swapfiles 192.168.200.0:255.255.255.0(rw,no_root_squash)
# Of course you have to supply to the right subnet...


If you restart the server again and then try booting your testing PC with the disk it should show a lot of messages and then start up a X-Window-System... that strange graphical thing where you can move your mouse on. It shouldn't do anything else, because it still needs a window-manager. We are using KDE and so we need to make sure that KDM allows them to connect.
So you have to deactivate "only local logins":
in /etc/X11/xdm/xdm-config:
Displaymanager.requestport 0 # <-- (you have to comment this, put the # in front of the line!)

and allow every address to connect to the manager.
in /etc/X11/xdm/xaccess:
# in some line there has to be an uncommented asterik
* # <- anyone can connect to here !

(it seems that this line is already uncommented at default.)
You could also possibly limit the access only to your subnet... but that's not too important. We are building a game server and not a top-secret-high-security-military equipment.


There also is some small config file
/opt/ltsp/i386/etc/lts.conf
that needs to be edited. You can fill it with a lot of options about the keyboards, mouses, displays etc at the clients (I recommend the LTSP Homepage for more reference) but for now it should suffice to tell them where your server is located:
SERVER = 192.168.200.200
# if you need to give some clients special options, you have to do it here... you also need the names you gave them via dhcp.conf
[PlayerKiller]
XkbModel = Killer245 # Keyboard Model
XkbLayout = PlayerKillLayout # Keyboard Layout


Now make sure your server recognizes all changes (by changing Runlevels or simply rebooting) and then try to boot a client with the right boot disk. It should start up and give you a login prompt like on the server PC. If it doesn't, try to search the messages on the screen for some hint what went wrong. Sometimes simply a ; is missing in the dhcp.conf or there is a typo elsewhere. Also the /var/log/messages on the server-PC might help a bit.
again the LTSP.ORG - homepage has a list of lots of things than can have gone wrong.
try to run "dhcpd" at command prompt... sometimes it tells you which mistake you made...
I suppose everything has gone well. You now know that the Ethernet-Boot works with at least you testing PC. So now you need some boot disks for your guests.
They are rather easy to create, switch to the Etherboot directory:
(it's in /usr/lib/etherboot I've searched for it again and again)
and write the BootRom and the Diskboot-prelude to disk: cat floppyload.bin.pre compressed/yourNIC.lzrom >/dev/fd0
(if your floppydisk is located somewhere else than /dev/fd0, you have to provide another path)
technically it should be possible to write that image to a bootable CD, too. I haven't tried that one, yet... I also don't really like the idea of recording a complete CD-Rom for a 32kilobyte-bootstrap.

Okay, now you know, your server works, you have a pile of boot disks for everyone attending. But there's still a nifty little thing we forgot.
We haven't compiled and installed Freeciv, yet. But this is rather easy:
(login as non-root, extract the files... standard procedure)
./configure
make
su
(login as root)
make install

you might also want to read the Freeciv install documentation.

Last things to do:
You might want to put an icon on your guests Desktop, leading them directly to the game.
It seems like KDE forbids two clients with same username to log in. So you might need to create some more. You could give every guest his own username, or you could use general names (player1, player2) without passwords.
Well. and you might want your server to forbid them mounting disk drives etc.