WIreless Technology and Future Tech

download WIreless Technology and Future Tech

of 6

Transcript of WIreless Technology and Future Tech

  • 7/29/2019 WIreless Technology and Future Tech

    1/6

    Wireless LTSP on Ubuntu 9.04

    LTSP (Linux Terminal Server Project) used in wireless networks is very usefull a pratic. I have

    noticed there is no tutorial about it in portuguese, The only one I found that describe how to make it

    work is http://www.lug-kr.de/wiki/ThinClientLokalBooten (in german). His autor, LUG Krefeld,

    made an excellent job making it possible. What I will do here is write detailed and aditional

    information that I am sure will help. The two scrips used here were made by de LUG Krefeld. Thistutorial as shown work in ubuntu 9.04 In other ubuntu based distro it will work with few

    modifications. In other distros such as Fedora, Suse more modifications will be necessary since the

    boot and the init are different.

    There are two ways to have LTSP working in ubuntu.

    1. Method:

    The ubuntu 9.04 cd alredy comes withs LTSP, just press F4 in the boot menu and choose "Install an

    LTSP Server" . Just be aware to choose what interfaces is the internet one because the other willserve the LTSP requests.

    2. Method:

    LTSP can be easyly installed in a alredy installed ubuntu.

    sudo apt-get update

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

    sudo ltsp-build-client

    If Ubuntu 9.04 X86_64 is being used it is recommended to use the command below because the

    client will probably be i386

    sudo ltsp-build-client --arch i386

    With any of the two methods, LTSP will alredy been installed

    A little theory.

    In wired networks all that we have to do is to boot by pxe (avaiable in most motherboards ) or, if

    unavaiable boot by Etherboot/GPXe. In both case there will be a dhcp requisition, the server will

    return an ip and a little image by TFTP and this image will load the kernel plus the image and

    continue boot.

    In wireless netwoks is a little diferent because there are no wireless devices that come with boot

    embedded. In Eherboot/GPXe also there are no wireless drivers.

    The solution I write here is to boot the kernel with a modified initrd.

    For who does not know , in the standart boot procedure the little image loaded by TFTP later loads

    the kernel and the initrd (that are on the server) and foward the boot procedure. With grub installed

  • 7/29/2019 WIreless Technology and Future Tech

    2/6

    for example,we can load this kernel plus the image localy , the result will be the same.

    In the ubuntu initrd there are no wireless drivers, they are only loaded after. What will be done is

    incluide alredy in this initrd everything necessary to make wireless LTSP possible.

    The image and the kernel are in the folder /opt/ltsp/i386/boot in the server.

    After the modifications are made the gerenerated image (initrd) and the kernel (which was not

    altered) will need to be booted somehow. I will give examples with grub.

    Some things have to be modified in the initrd: include wireless drivers, packages to allow making a

    wireless connection, and two scrips that were made by LUG Krefeld. On of the scripts is responsible

    for making all the inclusions and the other two capture what is typed at boot , like essid and

    password.

    Beginning with the packages:

    make a folder to download the packages.

    mkdir pacotes_wireless

    cd pacotes_wireless

    sudo aptitude download wireless-tools libiw29 libc6 libssl0.9.8 openvpn liblzo1 zlib1g

    This will download the necessary packages to the corrent directory.

    This packages are necessary to make possible the wireless connection. This packages are for ubuntu

    9.04. Some little varations can happen in other distros or versions, for exemple, the libiw29

    depending in the linux version can be libiw28

    Remember that if you change the folder name (wireless),will have to change it in the script

    "wirelessboot" too.

    The next command extracts the content of the packages to a folder(wireless)

    sudo su

    for package in *.deb ; do dpkg -x $package wireless ; done

    The folder wireless must be copied to /opt/ltsp/i386/root . Think this folder(wireless) as being the

    root of a system. One of the scripts will later copy the contents of the folder to the root of the new

    image that will then allow the wireless conection. It is better to do this way rather than copy

    directely to the LTSP root (/opt/ltsp/i386/) for a matter of organization

    This tutorial uses two scripts made by LUG Krefeld

    http://www.lug-kr.de/wiki/ThinClientLokalBooten

    The first does not need to be modified, so I will not translate. The second scrips must be modifieddepending of the wireless device used.

  • 7/29/2019 WIreless Technology and Future Tech

    3/6

    The purpose of the first script is catch the command options passed to grub (or another boot

    manager)in the boot and connect to the wireless network. Give it the name wireless and copy it

    to folder /opt/ltsp/i386/etc/initramfs-tools/scripts/init-premount/ ,it not necessary to modify

    ---

    #!/bin/sh

    PREREQ="udev"

    prereqs()

    {

    echo "$PREREQ"

    }

    case $1 in

    prereqs)

    prereqsexit 0

    ;;

    esac

    for x in $(cat /proc/cmdline); do

    case $x in

    device=*)

    device=${x#device=}

    ;;

    essid=*)essid=${x#essid=}

    ;;

    wirelesskey=*)

    wirelesskey=${x#wirelesskey=}

    ;;

    openvpn=*)

    openvpn=${x#openvpn=}

    ;;

    hostname=*)

    hostname=${x#hostname=}

    ;;esac

    done

    if [ -n "${device}" ]; then

    DEVICE=$device

    # den Wert fuer nachfolgende Skripte speichern

    echo "DEVICE=${device}" >>/conf/param.conf

    fi

    if [ -n "${essid}" ]; then# dem USB-System Zeit lassen, den WLAN-Treiber zu installieren

    sleep 5

  • 7/29/2019 WIreless Technology and Future Tech

    4/6

    # Besonderheit fuer rt73-Treiber, schadet anderen aber wohl nicht:

    ifconfig $DEVICE up

    if [ -n "${wirelesskey}" ]; then

    iwconfig $DEVICE key $wirelesskey

    fi

    iwconfig $DEVICE essid $essid

    fi

    if [ -n "${openvpn}" ]; then

    # Als Parameter muss ein lokales Device angegeben werden, in dem die Schluessel liegen

    echo -n "OpenVPN startet..."

    mount $openvpn /mnt/

    # zuerst sollte die Basisverbindung konfiguriert werden

    ipconfig $DEVICE

    # source relevant ipconfig output

    . /tmp/net-${DEVICE}.conf

    # OpenVPN benoetigt seinerseits evtl. auch den Nameserverecho "nameserver $IPV4DNS0" >/etc/resolv.conf

    # Jetzt sollte das Ding starten:

    /usr/sbin/openvpn --daemon --cd /mnt/openvpn --config /mnt/openvpn/${hostname}.conf

    # Ich setze die MAC-Adresse des tun-Devices auf die meiner Ethernet-Schnittstelle

    # So ist es dem DHCP-Server egal, ueber welches Netz ich komme

    ifconfig eth0 down

    until ifconfig tap1; do sleep 1; done

    ifconfig tap1 down

    mac=`ifconfig eth0|grep eth0`

    ifconfig tap1 hw ether ${mac#*HWaddr}ifconfig tap1 up

    # Die weiteren Skripte sollen jetzt vom tun-Device als Hauptdevice ausgehen

    echo "DEVICE=tap1" >>/conf/param.conf

    echo "Fertig."

    fi

    ---

    The second script (which needs to be modified) is:

    ---

    #!/bin/sh

    . /usr/share/initramfs-tools/hook-functions

    PREREQ="lvm"

    prereqs()

    {

    echo "$PREREQ"

    }

    case $1 in

  • 7/29/2019 WIreless Technology and Future Tech

    5/6

    prereqs)

    prereqs

    exit 0

    ;;

    esac

    echo "Adding wireless modules"

    force_load ide-disk

    force_load generic

    force_load tun

    cp -a /root/wireless/* "${DESTDIR}/"

    This scripts needs to be altered, and depends on the wireless device used in the client. Its is not

    necessary to remove anything, just and. The are no generic image, its difficult is to not carry

    garbage, but soon I or someone will do it. In this script we must put the modules used in the client

    hardware. Sometimes just the modules related to the wireless device are enought but this modulescan depend on other modules. The easiest way to know which modules are used in the client is to

    boot ubuntu or xubuntu in the client and make the following comand:

    lsmod > modules

    This will generate a file that contains the modules used at the left side and the dependencies at the

    right side . Edit this file deleting all the dependencies on the right and adding forceload before

    the modules with a space. It will be similar to this:

    force_load led-classforce_load lbm_cw-cfg80211

    force_load lbm_cw-mac80211

    force_load ath5k

    ...

    it will 30 or more lines . I recommend using all this modules. After editing copy all this lines to

    before the last script line (cp -a /root/wireless/* "${DESTDIR}/")

    Save the script, name it wirelessboot and put it in the folder

    /opt/ltsp/i386/etc/initramfs-tools/hooks/

    The script will include all the necessary modules and the packages need for the wireless LTSP

    (/opt/ltsp/i386/root/wireless). Do not execute this scripts.

    When both scripts are copied to their respective folders do the command below:

    sudo chroot /opt/ltsp/i386 update-initramfs -u

    In the folder /opt/ltsp/i386/boot will be the kernel (which is the same) and the new initrd (which will

    have more or less 14mb, the triple of its original size).

    the kernel name will be probably "vmlinuz-2.6.28-11-generic" and the image

    "initrd.img-2.6.28-11-generic".

  • 7/29/2019 WIreless Technology and Future Tech

    6/6

    Copy this two files to a harddrive, or CD or flashdrive with grub installed. I usually do it with a

    flash drive with supergrubdisk

    www.supergrubdisk.org/

    add this entries in menu.lst. Modify to suit your network.

    title ThinClient wireless

    root (hd0,0)

    kernel /boot/vmlinuz device=wlan0 essid=house wirelesskey=password openvpn=/dev/hda1

    hostname=myclient

    initrd /boot/initrd.img

    Generally the device=wlan0 but can have other names. In my dell 9 mini device=eth0

    essid is the name of the network and wirelesskey its password. Remember that wep passphrassesmust have an "s:" preceding. It would be essid=s:password

    Do not put passwords with the character # in the access point because it will not work since it

    will comment a line in the script.

    The openvpn and hostname are only necessary if vpn is used. It is easier to use this tutorial with an

    access point and no other dhcp server in the network.The are ways to solve this in the internet.

    Some notebooks,such as the dell mini 9, use restrict wireless drivers. The most common is the wl

    If it is the case the drive itself must also be copied manually inside the /opt/ltsp/i386/root/wirelessas this folder was the root and adding later the path to the drivers as it would be in a normal boot.

    Generally this drivers are in a folder named volatile, and have a .ko extension.

    This tutorial was tested in Ubuntu 9.04. Is also work in other ubuntu based distros and in Debian

    Lenny with few or even none modifications. For other distros the ideia is the same, but since their

    structure are different more modifications will be necessary.

    This tutorial is a little difficult when made the fisrt time, but the result are very good, it is very

    pratic. I advice to have a wired LTSP server alredy working correctly before trying this.

    It is very usefull in schools with the edubuntu add on.

    I hope it helps someone. Email me if you have doubts.

    Fabio Moraes Hache

    [email protected]