IMPORTANT: Per accedir als fitxer de subversion: http://acacha.org/svn (sense password). Poc a poc s'aniran migrant els enllaços. Encara però funciona el subversion de la farga però no se sap fins quan... (usuari: prova i la paraula de pas 123456)

Vegeu també: Sistema de Restauració d'imatges per xarxa
TODO: thumb de DRBL tipus icecast. millorar l'existent
Logo del National Center of high Performance Computing (NCHC)

Cal tenir en compte que les eines DRBL i Clonezilla estan molt relacionades entre si, entre d'altres coses pel fet que el creador d'aquestes eines és el mateix (Steven Shiau i NHCH). Aquest artícle tracta sobre DRBL, per a tenir informació més detallada sobre clonezilla consulteu l'article Clonezilla

DRBL són les inicials de Diskless Remote Boot in Linux, és tracta doncs d'un sistema d'arrancada en xarxa (aka arrancada sense disc). DRBL utilitzar un sistema basat en NFS/NIS per tal de proveir d'un sistema operatiu a màquines remotes sense disc dur.

S'utilitza per a:

DRBL està disponible sota una llicència lliure GPL license.

DRBL Diskless Remote Boot in Linux és un sistema servidor de terminals lleugers.

Tots dos sistemes han estat creats al Center of High Performance Computing de Taiwan. El principal contribuïdor és Steven Shiau

Clonezilla utilitza DRBL per tal de permetre l'arrencada en xarxa (sense CD, ni USB ni disc dur) dels clients on volem restaurar una imatge. Els clients, restauren la imatge des de un servidor (drbl-server) amb clonezilla. La restauració de la imatge és pot fer amb multicast, fet que permet que la restauració sigui molt ràpida quan s'estan clonant múltiples màquines al mateix temps.

TODO

  • Buscar els TODOs?
  • Enllaços a comandes i fitxers isntal·lats

Introducció

Conceptes

  • SSI: Single Sistem Image
  • NBI: ???

Com funciona DRBL?

DRBL utilitza el protocol PXE per a iniciar l'arrancada des de la xarxa.

Consulteu l'article Arrancada de xarxa per saber com funciona PXE.

Instal·lació

Per a crear un servidor DRBL teniu dos opcions:

  • Instal·lar DRBL en servidor amb una distribució Linux ja instal·lada
  • Executar DRBL en un servidor utilitzant un LIVE-CD

Incompatibilitats

TODO: Tenir en compte que modifica:

  • DHCP
  • Arrancada de xarxa
  • Altres:

Pot causar certes incompatibilitats. vegeu:

DRBL repartit en dues màquines: Servidor de DHCP i DRBL

Instal·lació manual

Obteniu els paquets Debian de:

http://drbl.sourceforge.net/download/sourceforge/

Heu d'escollir la última versió estable que sigui per a la vostra arquitectura (i386 o amd64).

Podeu descarregar amb wget:

$ wget http://downloads.sourceforge.net/drbl/drbl_1.9.0-35_i386.deb?modtime=1214521165&big_mirror=0

I instal·leu amb:

$ sudo dpkg -i drbl_1.9.0-35_i386.deb

Instal·lació a Ubuntu

Es pot instal·lar des de uns repositoris específics. Afegiu al fitxer /etc/apt/sources.list:

$ sudo joe /etc/apt/sources.list

la següent línia:

deb http://free.nchc.org.tw/drbl-core drbl stable
NOTA: Si veieu que aquest repositori va molt lent podeu utilitzar algun dels mirrors.

Afegir la clau GPG del servidor:

$ wget -q http://drbl.sourceforge.net/GPG-KEY-DRBL -O- | sudo apt-key add -

Actualitzem i instal·lem drbl

$ sudo apt-get update
$ sudo apt-get install drbl

Per acabar la instal·lació és necessari executar la comanda:

$ sudo /opt/drbl/sbin/drblsrv -i
NOTA: Tant clonezilla com DRBL tenen la costum de mostrar els textos en groc. Podeu canviar la configuració del vostre 
 terminal a Edita/Perfil Actual/Colors i escolliu l'esquema de colors Gris sobre negre.

Haureu d'anar responent una sèrie de preguntes (en cas de dubte escolliu l'opció per defecte):

*****************************************************.
Hint! When a yes/no option is available, the default value is uppercase, Ex. (y/N), the default is "N", when you press "Enter",  
it will use "N". If you are not sure which one to choose, you can just press "Enter" key .
*****************************************************.
*****************************************************.
Installing DRBL for Debian Linux...
*****************************************************.

La primera pregunta us diu si voleu que DRBL ofereixi als clients lleugers l'opció d'instal·lar sistemes operatius lliures des de xarxa (la llista és gran: Debian, Ubuntu, RedHat....)

Do you want to install those network installation boot images so that you can let client to install some GNU/Linux distributions  
(Debian, Ubuntu, RedHat Linux, Fedora Core, Mandriva, CentOS and OpenSuSE...) via network ?  ///NOTE/// This action will 
download  a lot of files (> 100 MB totally) from Internet, so it might take a few minutes. If your client machine has harddisk 
and it is possible you will install GNU/Linux into that, say Y here. If you say "no" here, feel free to run drbl-netinstall to 
install them later.
[y/N] 

Si escolliu si tardarà força estona....

A la següent escolliu el valor per defecte (Enter):

*****************************************************.
This GNU/Linux distribution uses one kernel to support SMP and non-SMP arch.
*****************************************************.
Do you want to use the serial console output for clients ?
If you do NOT know anything about this, say "N" here, otherwise clients might show NOTHING on the screen !
[y/N] 

Si el servidor és de 64 bits cal que els clients també ho siguin o utilitzar l'opció 1 (Enter):

*****************************************************.
Which CPU architecture kernel do you want to assign for DRBL clients ?
0  -> i386 level CPU 
1 -> i586 level CPU
2 -> Use the same CPU level with that of this DRBL server
Note! Note Note!  Note!  Note!  Note!  Note!
NOTE!!! If your client machine(s) is not the same level with server, please answer "0" or "1", otherwise your client machine(s)  
will NOT be able to boot .
If you use wrong CPU level kernel, the glibc and openssl package might use i686 or i386, the kernel might use i686, i586 or i386, 
which might be not suitable to all your machines.
If you are not sure, "1" is recommended, this will still have good performance and compatibility.
[1] 

De fet observeu que treballara amb i386:

*****************************************************.
For the distribution you are using, only i386 and i686 are available, so the optimization level is changed from i586 to i386!!!
No optimization for your system, we will use the "i386" package.
*****************************************************.

Us preguntarà si voleu actualitzar el sistema. Si dieu si executarà:

$ sudo apt-get upgrade

En principi no cal...

*****************************************************.
Do you want to upgrade operating system ?
[y/N] 

Ara es posarà a comprovar que ja està instal·lat i que es necessita per a DRBL:

*****************************************************.
2nd, installing the necessary files for DRBL...
*****************************************************.
Searching if lvm2 ntfs-3g lshw aoetools vblade available... 
Package lvm2 exists in repository.
Package ntfs-3g exists in repository. 
....

Segurament us acabarà instal·lant alguns paquets:

The following extra packages will be installed:
 libevent1 libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common portmap
Suggested packages:
  floppyd
Recommended packages:
 wakeonlan
The following NEW packages will be installed:
  aoetools clonezilla curl dhcp3-server disktype drbl-chntpw drbl-etherboot drbl-lzop drbl-ntfsprogs drbl-partimage etherwake  
  freedos libevent1 libgssglue1 libnfsidmap2 librpcsecgss3 lvm2 mkpxeinitrd-net mkswap-uuid mtools nfs-common nfs-kernel-server 
  nis partclone portmap sdparm syslinux tftpd-hpa udpcast vblade
0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.3MB of archives.
After this operation, 45.6MB of additional disk space will be used.
Get:1 http://ch.archive.ubuntu.com hardy/main portmap 6.0-4 [33.6kB]
...

Intentarà actualitzar alguns paquets:

*****************************************************.
Trying to upgrade some necessary packages if available...
*****************************************************.

I finalment la configuració dels serveis:

*****************************************************.
Install kernel for clients... ...
In ayo repository, searching the latest kernel ...
*****************************************************.
Now run: drblsrv-offline -c -d -a -l en_US.UTF-8 -k /var/cache/apt/archives/linux-image-2.6.24-19-386_2.6.24-19.41_i386.deb -e   
/var/cache/apt/archives/linux-restricted-modules-2.6.24-19-386_2.6.24.13-19.45_i386.deb -e /var/cache/apt/archives/linux-ubuntu 
-modules-2.6.24-19-386_2.6.24-19.28_i386.deb "" ""

Kernel package /var/cache/apt/archives/linux-image-2.6.24-19-386_2.6.24-19.41_i386.deb is used for client...
*****************************************************.
The version number for your OS: Ubuntu 8.04
*****************************************************.
*****************************************************.
Install kernel for clients... ... 
The kernel for client is from specific package /var/cache/apt/archives/linux-image-2.6.24-19-386_2.6.24-19.41_i386.deb.
Installing /var/cache/apt/archives/linux-image-2.6.24-19-386_2.6.24-19.41_i386.deb for clients... 
It might take several minutes to install this kernel, please be patient...  
done!
Generating modules.dep and map files for clients... done!
Installing /var/cache/apt/archives/linux-restricted-modules-2.6.24-19-386_2.6.24.13-19.45_i386.deb for clients... 
It might take several minutes to install this kernel, please be patient...  
done!
Installing /var/cache/apt/archives/linux-ubuntu-modules-2.6.24-19-386_2.6.24-19.28_i386.deb for clients... 
It might take several minutes to install this kernel, please be patient...  
done!
Generating modules.dep and map files for clients... done!
*****************************************************.
Creating config file for PXE clients...
Copying pxelinux.0, gpxelinux.0, menu.c32, vesamenu.c32, chain.c32, mboot.c32, sanboot.c32 and memdisk to /tftpboot/nbi_img...
Copying memtest86+ to /tftpboot/nbi_img...
Copying FreeDOS files to /tftpboot/nbi_img/... 
Generating default pxelinux config (/tftpboot/nbi_img/pxelinux.cfg/default)...
Use com32 module: vesamenu.c32
Adding menus for DRBL, local boot, memtest86+, FreeDOS...
done!
*****************************************************.
*****************************************************.
Creating the image files for PXE and Etherboot client, this will take a few minutes ...
The latest kernel for DRBL clients is 2.6.24-19-386
Running mknic-nbi --kernel 2.6.24-19-386 --all --no-modules
Will client check DHCP server name is "drbl" or not: yes
The maximum times to try to get IP address for a client: 3
The pause time after network card is up: 0
Setting port for udhcpc request to default...
Using the kernel modules from /tftpboot/node_root//lib/modules...
The selected kernel for DRBL clients is: 2.6.24-19-386
Kernel 2.6 is found, so default to use initramfs.
Creating the network boot initrd for PXE clients by: mkpxeinitrd-net -k 2.6.24-19-386 -t initramfs  
Use kernel modules from /tftpboot/node_root//lib/modules/2.6.24-19-386.
Creating the initRAMFS image...
Initramfs, remove ramdisk_size/ramdisk_block in /tftpboot/nbi_img/pxelinux.cfg/default if exists...
Finished!
Done!
*****************************************************.
Done!  

Ja teniu DRBL instal·lat!

Recursos:

Quins paquets/dependències instal·la l'script?

aoetools bc binutils clonezilla curl dhcp3-server dialog discover discover-data disktype drbl-chntpw drbl-etherboot drbl-lzop drbl-ntfsprogs 
drbl-partimage etherwake ethtool freedos gawk genisoimage gpxe hwinfo lftp libcap1 libcurl3 libdigest-sha1-perl libdiscover2 libevent1 libgssglue1 
libhal1 libhd15 libnfsidmap2  librpcsecgss3 libslp1 libsmbios2 lvm2 make mknbi mkpxeinitrd-net mkswap-uuid mtools nfs-common nfs-kernel-server nis openbsd-inetd partclone pbzip2 pigz portmap sdparm  syslinux tftpd-hpa traceroute udpcast unzip update-inetd vblade wakeonlan watershed zip

Mirrors

Hi ha més llocs on obtenir DRBL (pot ser útil en cas que la connexió als originals de DRBL sigui massa lenta ):

http://ftp.twaren.net/local-distfiles/drbl-core/
http://drbl.sourceforge.net/drbl-core

Per utilitzar aquest mirror cal posar al fitxer /etc/apt/sources.list:

deb http://drbl.sourceforge.net/drbl-core drbl stable

Extret de:

Fitxers instal·lats

$ dpkg -L ????

Desinstal·lació

$ sudo /opt/drbl/sbin/drblsrv -u
*****************************************************.
Hint! When a "yes or no" option is available, the default value is uppercase. E.g. (y/N) the default is "N", so when you press  
"Enter" without typing "Y or N" it will be as if you typed "N" and then "Enter". If you are not sure which option to choose 
just  press "Enter" key.
*****************************************************.
*****************************************************.
Uninstalling DRBL for Debian Linux...
Analyzing info for the rpm packages... This might take several minutes...
*****************************************************.
Stopping clonezilla if it is running...
Setting the TERM as xterm
*****************************************************.
*****************************************************.
Clean all the previous saved config file if they exist...done!
OCS is not started!
*****************************************************.
Now disable the YP access for DRBL clients...
Stopping NIS service...


done!
Remove the /etc/ypserv.securenets...
*****************************************************.
Do you want to remove the small GNU/Linux Distributions (like DSL, PuppyLinux, INSERT or PLD) installed under the DRBL  
environment if they exist?
[Y/n] 
...

Configuració

Per configurar DRBL heu d'executar:

$ sudo /opt/drbl/sbin/drblpush -i
******************************************************
Hint! When a yes/no option is available, the default value is uppercase, Ex. (y/N), the default is "N", when you press "Enter", 
it will use "N". If you are not sure which one to choose, you can just press "Enter" key .
******************************************************
Searching the installed packages for DRBL server...This might take several minutes...
Finished searching the installed packages for DRBL server.
******************************************************
------------------------------------------------------
The interactive mode let you supply the information of your DRBL environment.
------------------------------------------------------
------------------------------------------------------

Us preguntara pels dominis de DNS, YP, etc... En cas de dubte--> Enter:

------------------------------------------------------
Please enter DNS domain (such as drbl.sf.net):
[example.com] 
Set DOMAIN as example.com
------------------------------------------------------
Please enter NIS/YP domain name:
[penguinzilla] 
Set DOMAIN as penguinzilla
------------------------------------------------------

Escolliu el prefix del nom de les màquines de la xarxa:

Please enter the client hostname prefix:
This prefix is used to automatically create hostname for clients. If you want to overwrite some or all automatically created  
hostnames, press Ctrl-C to quit this program now, edit /opt/drbl/conf/client-ip-hostname, then run this program again .
[dell-desktop] 
Set the client hostname prefix as dell-desktop

Ara hi ha 2 opcions. Teniur dos targetes de xarxa o no les teniu. Si no les teniu us dirà que indiqueu quina és la targeta de xarxa que esta connectada a Internet. Vegeu la nota. Si la teniu us detectara quin és la connectada a Internet:

------------------------------------------------------
eth0: IP address 192.168.1.33, netmask 255.255.255.0
eth0:1: IP address 147.83.15.23, netmask 255.255.255.0
Configured ethernet card(s) found in your system: eth0 eth0:1 
------------------------------------------------------
The ethernet port for Internet access is: eth0:1
The ethernet port(s) for DRBL environment:  eth0 
******************************************************
******************************************************
NOTA: DRBL (abans de la versió 1.9.1-26) necessita de dos targetes de xarxa. Si només teniu una podeu crear un alias:

 $ sudo ifconfig eth0:1 147.83.15.23 netmask 255.255.255.0 up
 $ ifconfig eth0:1
 eth0:1    Link encap:Ethernet  HWaddr 00:1d:09:59:10:39  
         inet addr:147.83.15.23  Bcast:147.83.15.255  Mask:255.255.255.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         Interrupt:16 
Si no ho havíeu fet podeu acabar la comanda (Ctrl-C), fer l'alias i tornar a començar.
Consulteu la secció [[DRBL_i_clonezilla#Problemes_amb_una_sola_tarja_de_xarxa._IP_alias | Solució de problemes].
NOTA 2: També us preguntarà quina és la targeta connectada a Internet en el cas que no trobi cap ip que sigui pública a la 
màquina. 

Recol.leció de les adreces MAC:

Aquesta es segurament la part més important. DRBL necessita tenir les MAC dels clients lleugers. Ens proporciona un programa que ens pot fer aquesta recol·lecció:

Now we can collect the MAC address of clients!
If you want to let the DHCP service in DRBL server offer same IP address to client every time when client boot, and you never 
did  this procedure, you should do it now!
If you already have those MAC addresses of clients, you can put them into different group files (These files number is the same
number of networks cards for DRBL service). In this case, you can skip this step .
This step helps you to record the MAC addresses of clients, then divide them into different groups. It will save your time and 
reduce the typos.
The MAC addresses will be recorded turn by turn according to the boot of clients,
and they will be put into different files according to the network card in server, file name will be like macadr-eth1.txt, 
macadr- eth2.txt... You can find them in directory /etc/drbl.
Please boot the clients by order, make sure they boot from etherboot or PXE!
Do you want to collect them ?

Contesteu que sí (y). Ara heu d'iniciar tots els clients amb Boot de xarxa i automàticament DRBL recollirà les MAC. L'ordre en que enceneu les màquines és important perquè coincidirà amb l'ordre en que li assignarà adreces IP.

Podeu anar consultant la recol·lecció de MACs amb la tecla 1:

Start detecting MAC address....
Enter 1 or press Enter to view the collecting status.
Enter 2 or q to finish collecting and quit.
1
=======================================
Total: 0
=======================================
Enter 1 or press Enter to view the collecting status.
Enter 2 or q to finish collecting and quit.
NOTA: Si teniu problemes amb la detecció de MACs o amb el boot de xarxa mireu que no tingueu un Switch amb STP activat (cas 
habitual en molts Cisco). Consulteu la secció  [[DRBL_i_clonezilla#Switchs_Cisco_.28Spanning_Tree_protocol.29_i_problemes_amb_Etherboot | resolució de problemes] per tal de 
veure com desactivar STP en un switch Cisco.

Quan hàgiu acabat premeu 2:

*****************************************************.
The collected MAC addresses from [eth0] are saved in file(s) separately: macadr-eth0.txt.
These files are saved in directory /etc/drbl.
******************************************************

Les MAC queden guardades en un fitxer especific: /etc/drbl/macadr-eth0.txt

Ara ens preguntarà si volem assignar IPs de forma estàtica amb DHCP (utilitzant les MAC abans recollides)

OK! Let's continue...
******************************************************
Do you want to let the DHCP service in DRBL server offer same IP address to the client every time when client boots (If you want  
this function, you have to collect the MAC addresses of clients, and save them in file(s) (as in the previous procedure)). This 
is  for the clients connected to DRBL server's ethernet network interface eth0 ?
[y/N] 

Seleccioneu sí (y). Us pregunta quin és el path (relatiu a /etc/drbl o complet) del fitxer amb les adreces MAC:

OK! Please tell me the file name which contains the MAC address of clients line by line for eth0.
[macadr-eth0.txt] 

A partir de quina IP voleu començar a assignar (de forma correlativa) adreces IP als clients:

What is the initial number do you want to use in the last set of digits in the IP (i.e. the initial value of d in the IP address  
a.b.c.d) for DRBL clients connected to this ethernet port eth0.
[1] 

Ara ens ensenyarà un resum del que hem escollit. En el nostre cas hem utilitzat un fitxer anomenat macs.txt amb les MAc dels clients:

NOTA: També podeu collir les MAC a mà i guardar-les en un fitxer per a l'aula.
*****************************************************
The file name you set is "macs.txt".
The clients number in this file is 1.
We will set the IP address for the clients connected to DRBL server's ethernet network interface eth0 By the MAC address file  
you  set, the IP addresses for the clients connected to DRBL server's ethernet network interface eth0 as: 192.168.1.1 -  
192.168.1.1
Accept ? [Y/n] 

Accepteu i us mostrar un gràfic resum:

******************************************************
OK! Let's continue...
******************************************************
The Layout for your DRBL environment: 
******************************************************
          NIC    NIC IP                    Clients
+-----------------------------+
|         DRBL SERVER         |
|                             |
|    +-- [eth0:1] 147.83.15.23 +- to WAN
|                             |
|    +-- [eth0] 192.168.1.33 +- to clients group 0 [ 1 clients, their IP 
|                             |            from 192.168.1.1 - 192.168.1.1]
+-----------------------------+
******************************************************
Total clients: 1
******************************************************
Press Enter to continue...

Premeu Enter. Comencen les preguntes de configuració del servidor de clients lleugers. En cas de dubte--> Enter

******************************************************
------------------------------------------------------
In the system, there are 3 modes for diskless linux services:
[0] Full DRBL mode, every client has its own NFS based /etc and /var.
[1] DRBL SSI (Single system image) mode, every client uses tmpfs based /etc and /var. In this mode, the loading and necessary  
disk space of server will be lighter. NOTE! (a) The client machine memory is recommended at least 256 MB. (b) The setting and 
config files of client will not be saved to the DRBL server! They are just used once and will vanish after the machine shutdo  
wns! Besides, if you modify any file in the template client (located in /tftpboot/nodes), you have to run /opt/drbl/sbin/drbl- 
gen-ssi-files to create the template tarball in /tftpboot/node_root/drbl_ssi/. (c) If you want to provide some file to overwrite  
the setting in the template tarball when client boots, check /tftpboot/node_root/drbl_ssi/clients/00_README for more details.
[2] I do NOT want to provide diskless Linux service to client.
Which mode do you prefer ?
[0] 

Hi han 3 modes per treballar amb clients lleugers. Cal que testeu quin és el més adequat per al vostre cas... Nosaltres premem Enter.

Ara escollim com volem que treballi clonezilla:

Full DRBL mode is chosen!
******************************************************
******************************************************
------------------------------------------------------
In the system, there are 3 modes available for clonezilla:
[0] Full Clonezilla mode, every client has its own NFS based /etc and /var.
[1] Clonezilla box mode, every client uses tmpfs based /etc and /var. In this mode, the loading and necessary disk space of  
server will be lighter than that in Full Clonezilla mode. Note! In Clonezilla box mode, the setting and config files of client 
will not be saved to the DRBL server! They just use once and will vanish after the machine shutdowns!
[2] I do NOT want clonezilla.
Which mode do you prefer ?

Un altre cop Enter.

Si no voleu canviar cap de les opcions per defecte, aleshores tot Enters:

[0] 
Full clonezilla mode is set!
******************************************************
******************************************************
------------------------------------------------------
When using clonezilla, which directory in this server you want to store the saved image (Please use absolute path, and do NOT  
assign it under /mnt/, /media/ or /tmp/)  ?
[/home/partimag] 
Directory for clonezilla saved images: /home/partimag
------------------------------------------------------
If there is a local harddrive with swap partition or writable file system in your client machine,
do you want to use that swap partition or create a swap file in  the writable filesystem so that client has more memory to use ? 
(This step will NOT destroy any data in that harddisk)
[Y/n] 
******************************************************
OK! We will try to create a swap space for your client if it has a local hard drive!
------------------------------------------------------
What's the maximun size (Megabytes) for the swap space ?
We will try to allocate the swap space for you, if it's not enough, 60% of the free space will be used.
[128] 
maxswapsize=128
******************************************************
------------------------------------------------------
Which mode do you want the clients to use after they boot ?
"1": Graphic mode (X window system) (default),
"2": Text mode.
[1] 
The clients will enter graphic mode after booting.
******************************************************
------------------------------------------------------
Which mode do you want when client boots in graphic mode ?
0: normal login, 1: auto login, 2: timed login
[0] 
The clients will wait for user to login when they boot.
******************************************************
------------------------------------------------------
Do you want to set the root's password for clients instead of using same root's password copied from server ? (For better  
security) 
[y/N]  
OK! Let's continue...
------------------------------------------------------
Do you want to set the pxelinux password for clients so that when client boots, a password must be entered to startup (For better 
security)
[y/N]   

------------------------------------------------------
Do you want to set the boot prompt for clients ?
[Y/n] 
How many 1/10 sec is the boot prompt timeout for clients ?
[70 ] 
OK! Let's continue...
------------------------------------------------------
------------------------------------------------------
Do you want to use graphic background for PXE menu when client boots ?
Note! If you use graphical PXELinux menu, however client fails to boot, you can switch to text mode by running "/opt/drbl  
/sbin/switch-pxe-bg-mode -m text".
[Y/n] 
Use text PXE Linux menu for client.
------------------------------------------------------
------------------------------------------------------
Do you want to let audio, cdrom, floppy, video and plugdev (like USB device) open to all users in the DRBL client ? If yes, we  
will add all the users to those device groups in the server and client .
[Y/n]  
OK! Let's continue...
------------------------------------------------------
------------------------------------------------------
By using alias interface, every client can have 2 IPs,
one of them is private IP for clients connected to DRBL server, and the other is public IP for clients directly connected to 
WAN   from switch !
Do you want to setup public IP for clients ?
[y/N] 
------------------------------------------------------
Do you want to let DRBL clients have an option to run terminal mode ? i.e. you want to let that client run remote display (which  
will mostly use resources of server), say "Y" here .
Note!
0. If you say yes to this option, this will be a very limited environment for client, i.e. NO local access for USB, CD, audio,  
printer, etc. in client.
1. If your server is not powerful, say "no" here.
2. By saying "yes" here, we will turn on xdmcp,
It is never a safe thing to turn on that.  Setting up /etc/hosts.allow and /etc/hosts.deny to only allow local access is another  
alternative but not the safest .
Firewalling port 177 is the safest if you wish to have xdmcp on.
Read the manual for more notes on the security of XDMCP.
Please set it by yourself!
3. If you say "yes" here, you might have to restart your desktop environment manager (gdm/kdm) later, remember to save your data  
before you close applications!
Do you want to let client has an option to run terminal mode ?
[y/N] 
OK! Let's continue...
------------------------------------------------------
------------------------------------------------------
Do you want to let DRBL server as a NAT server ? If not, your DRBL client will NOT be able to access Internat.
[Y/n]  

[Y/n] 
OK! Let's continue...
------------------------------------------------------
******************************************************
The running kernel in the server supports NFS over TCP!
Note! If you change the running kernel in the server, and not sure whether the kernel supports NFS over udp or tcp, you'd 
better   to re-run "drblpush -i" again to avoid the client boots in failure !
Press Enter to continue... 
Note! If you change the running kernel in the server, and not sure whether the kernel supports NFS over udp or tcp, you'd better  
to re-run "drblpush -i" again to avoid the client boots in failure!
Press Enter to continue... 
------------------------------------------------------
Searching installed Etherboot files for dhcpd.conf... done! 
******************************************************
The calculated NETWORK for eth0 is 192.168.1.0.
******************************************************
******************************************************
We are now ready to deploy the files to system! 
Do you want to continue ?
Warning! If you go on, your firewall rules will be overwritten during the setup!
The original rules will be backuped as iptables.drblsave in system config directory (/etc/sysconfig or /etc/default).
[Y/n] 
******************************************************
OK! Let's do it!
------------------------------------------------------
Checking the necessary disk space... 

Un cop acabeu crearà la configuració del clients:

Checking the necessary disk space... done!
Copying the config file to /etc/drbl... done!
Backup the original /etc/hosts as /etc/hosts.drblsave... done!
Generate the /etc/hosts for clients connected to eth0... done!
Cleaning the stale files of the diskless nodes if they exist... done!
Backuping the old MAC address files... done!
*****************************************************.
*****************************************************.
The version number for your GNU/Linux: DBN-TU
Keeping the old common root files if they exist... 
Keeping old nodes if they exist... 
Creating common root files... This might take several minutes........... done!
Update the kernel for client if necessary... 
The DRBL client uses i486 kernel with version 2.6.24-19-386...
Trying to update the /tftpboot/node_root/lib/modules/2.6.24-19-386 from server's /lib/modules/... This might take several  
minutes...
"i486" 2.6.24-19-386 kernel in this DRBL server is not found, so skip this.
Copying the directory /etc/ to clients common root /tftpboot/node_root...
Cleaning the ssh key file ssh_host_dsa_key copied from server... done!
Cleaning the ssh key file ssh_host_dsa_key.pub copied from server... done!
Cleaning the ssh key file ssh_host_rsa_key copied from server... done!
Cleaning the ssh key file ssh_host_rsa_key.pub copied from server... done!
Commenting the TCPwrapper related file /tftpboot/node_root/etc/hosts.deny copied from server... done!
Commenting the TCPwrapper related file /tftpboot/node_root/etc/hosts.allow copied from server... done!
The startup services for DRBL client are:
firstboot portmap nis nfs-common makedev ssh hal dbus acpid acpi-support usplash cupsys drblthincli mkswapfile arm-wol sendsigs   
umountfs
Using udev for clients... Set graphic mode for Debian DRBL client...
Deleting the accounts (except root) in the clients common root template... done!
Enabling the NIS client in the common root template... done!
Creating some necessary files in the clients common root template....... done!
Creating DRBL client: dell-desktop001 192.168.1.1... Generating SSH host keys for client 192.168.1.1 if they do not exist... done!
Display manager:"gdm"...
Setting node 192.168.1.1 as normal_login... done!
Template client for DRBL SSI is 192.168.1.1
Disable the password in pxelinux simple menu for all clients... 
Disabling PXE password in config file /tftpboot/nbi_img/pxelinux.cfg/default... 
 done!
Now add necessary services to this DRBL server: DHCP, TFTP, NFS, NIS...
Generating the NFS exports for DRBL clients... 
Backup the original /etc/exports as /etc/exports.drblsave
Exporting to clients by IP address line-by-line...
Full DRBL or Full Clonezilla mode, exporting client's directories etc, var, root...
The /etc/exports setting is ok now!
Now generate the firewall rules for NAT service...
Stop the NAT service first...
Flushing firewall rules: success
Turn on ip_forward now.
Now set the YP securenets...
Backup the original /etc/ypserv.securenets as /etc/ypserv.securenets.drblsave
The /etc/ypserv.securenets setting is done!
Update YP...
Now add the service:  portmap dhcp3-server nis nfs-common nfs-kernel-server tftpd-hpa drbl-clients-nat
Force to add portmap service in this Debian DRBL server...
Force to add dhcp3-server service in this Debian DRBL server...
Force to add nis service in this Debian DRBL server...
Force to add nfs-common service in this Debian DRBL server...
Force to add nfs-kernel-server service in this Debian DRBL server...
Force to add tftpd-hpa service in this Debian DRBL server...
Force to add drbl-clients-nat service in this Debian DRBL server...
Now start the service:  portmap dhcp3-server nis nfs-common nfs-kernel-server tftpd-hpa drbl-clients-nat
 * Stopping portmap daemon...    [ OK ] 
 * Starting portmap daemon...    [ OK ] 
 * Stopping DHCP server dhcpd3   [fail] 
 * Starting DHCP server dhcpd3   [ OK ] 
 * Starting NIS services         [ OK ] 
 * Stopping NFS common utilities [ OK ] 
* Starting NFS common utilities  [ OK ] 
* Stopping NFS kernel daemon     [ OK ] 
* Unexporting directories for NFS kernel daemon... [ OK ] 
* Exporting directories for NFS kernel daemon...   [ OK ] 
* Starting NFS kernel daemon                       [ OK ] 
Restarting HPA's tftpd: in.tftpd.
Stopping the NAT services for DRBL clients... Now stop the NAT service...
Flushing firewall rules: success
done!
Starting the NAT services for DRBL clients... done!
ip_forward is already on.
The display manager in this DRBL server is "gdm" 
Disable the terminal mode for DRBL clients ...
done !
Clean all the previous saved config file if they exist...done!
Turn on the boot prompt for PXE client...done!
Turn off the thin client option in PXE boot menu...done!
Modifying /tftpboot/nbi_img/pxelinux.cfg/default to let DRBL client use graphical PXE boot menu... done!
Full DRBL mode. Remove clientdir opt for label drbl in pxelinux config... 
Setting drbl_mode="full_drbl_mode" in /etc/drbl/drbl_deploy.conf and /etc/drbl/drblpush.conf... done!
Full clonezilla mode. Remove clientdir opt for label clonezilla in pxelinux config... 
Setting clonezilla_mode="full_clonezilla_mode" in /etc/drbl/drbl_deploy.conf and /etc/drbl/drblpush.conf... done!
You have to use "/opt/drbl/sbin/dcs" -> clonezilla-start to start clonezilla serivce, so that there will be a clonezilla menu  
when client boots 
*****************************************************.
Adding normal users to group "audio cdrom plugdev floppy video"........ done!
*****************************************************.
Updating the YP/NIS for group...
Note! If you add new or remove accounts in the DRBL server in the future, remember to run the following command again, so that  
some group (EX:plugdev) will be updated:
tune-debian-dev-group-perm -g "audio cdrom plugdev floppy video" -e
*****************************************************.
Enjoy DRBL!!!
http://drbl.nchc.org.tw; http://drbl.sf.net
NCHC Free Software Labs, Taiwan. http://free.nchc.org.tw
*****************************************************.
If you like, you can reboot the DRBL server now to make sure everything is ready...(This is not necessary, just an option.).
*****************************************************.
DRBL server is ready! Now set the client machines to boot from PXE or Etherboot (refer to http://drbl.sourceforge.net for more  
details).
NOTE! If Etherboot is used in client machine, version 5.4.0 or newer is required!
PS. The config file is saved as /etc/drbl/drblpush.conf. Therefore if you want to run drblpush with the same config again, you  
may run it as: /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf

drblpush

El programa principal està a:

#########################################
# Main program

Aquest programa genera un fitxer de configuració:

/etc/drbl/drblpush.conf

El primer cop s'executa en mode interactiu, que proporciona un assistent per a configurar DRBL:

$ sudo /opt/drbl/sbin/drblpush -i

Pero es pot executar en mode no interactiu amb

$ sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf

Fitxers de configuració

/opt/drbl/conf/drbl.conf

Fitxer principal de la configuració de DRBL.

Per exemple aquí es pot canviar l'adreça URL desde on es descarreguen els netinstalls:

$ sudo cat /opt/drbl/conf/drbl.conf | grep -n url
...
376:debian_url_site="http://free.nchc.org.tw"
385:ubuntu_url_site="http://free.nchc.org.tw"
394:fedora_url_site="http://free.nchc.org.tw"
403:centos_url_site="http://free.nchc.org.tw"
412:#redhat_url_site="http://free.nchc.org.tw"
421:mandriva_url_site="http://free.nchc.org.tw"
430:scientific_url_site="http://free.nchc.org.tw"
440:opensuse_url_site="http://free.nchc.org.tw"
451:freebsd_url_site="ftp://ftp.twaren.net"
460:openbsd_url_site="ftp://ftp.twaren.net"

La URL http://free.nchc.org.tw té uns temps de descarrega molts lents. Podeu de mirar d'utilizar els mirror oficials de les distribucions.

/etc/drbl/drblpush.conf

Un exemple de fitxer:

#Setup for general
[general]
domain=iescopernic.com
nisdomain=iescopernic
localswapfile=yes
client_init=graphic
login_gdm_opt=login
timed_login_time=
maxswapsize=128
ocs_img_repo_dir=/home/partimag
total_client_no=128
create_account=
account_passwd_length=8
hostname=DRBLCopernic_
purge_client=yes
client_autologin_passwd=
client_root_passwd=
client_pxelinux_passwd=
set_client_system_select=yes
use_graphic_pxelinux_menu=yes
set_DBN_client_audio_plugdev=yes
open_thin_client_option=no
client_system_boot_timeout=70
language=en_US
set_client_public_ip_opt=no
config_file=drblpush.conf
collect_mac=no
clonezilla_mode=full_clonezilla_mode
drbl_mode=full_drbl_mode
drbl_server_as_NAT_server=no
add_start_drbl_services_after_cfg=yes
continue_with_one_port=
#nfsserver=192.168.0.8

#Setup for eth0:1. Simula aula 1
[eth0:1]
interface=eth0:1
range=75-90

#Setup for eth0:2 Simula aula 2
[eth0:2]
interface=eth0:2
range=75-90

#Setup for eth0:3. Simula aula 3
[eth0:3]
interface=eth0:3
range=75-90
...
   

clonezilla_mode

Opcions:

  • full_clonezilla_mode
  • clonezilla_box_mode
  • none

drbl_mode

Opcions:

  • full_drbl_mode
  • drbl_box_mode
  • none

Configuració del menú pxelinux

El menú d'arrancada des de xarxa el proporciona pxelinux. Vegeu el fitxer:

/syslinux/syslinux.cfg

Del LIVE-CD. Segons aquest fitxer si copiem els fitxers del LIVE-CD, descarregant-nos el fitxer zip de:

http://clonezilla.org/download/sourceforge/

Executant:

$ wget http://downloads.sourceforge.net/clonezilla/clonezilla-live-1.2.0-25.zip?modtime=1221639594&big_mirror=0

I ara només cal afegir al fitxer de grub (/boot/grub/menu.lst):

#Boot from Network
title Iniciar des de la xarxa (PXE)
root            (hd0,1)
kernel          /clonezilla/live/gpxe.lkn 
 
#Boot from Network 2
title Iniciar des de la xarxa (Etherboot)
root            (hd0,1)
kernel          /clonezilla/live/eb.zl

Configuració de l'idioma

Els fitxers d'idioma es troben a:

/opt/drbl/lang

Hi han fitxers per traduir les aplicacions perl a:

/opt/drbl/lang/perl

I les bash a:

/opt/drbl/lang/bash

A data (--acacha 06:56, 30 maig 2009 (UTC)), l'ajuda està desfasada i l'única manera d'utilitzar idiomes diferents és:

LANG=es_ES.UTF-8 sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf

Comandes

drbl-netinstall

$ sudo /opt/drbl/sbin/drbl-netinstall

Permet instal·lar les intal·lacions des de xarxa de diversos sistemes operatius.

Per exemples, per afegir Debian:

$ sudo /opt/drbl/sbin/drbl-netinstall -i debian

Per instal·lar tots:

$ sudo /opt/drbl/sbin/drbl-netinstall -i all

Les adreces d'Internet de on es baixen els netinstall estan a:

/opt/drbl/conf/drbl.conf
...
debian_netinstall_ver="etch lenny"
debian_netinstall_arch="i386 amd64"
debian_url_site="http://ftp.es.debian.org/debian"
# Path to Debian where directory $ver (Ex. etch) exists
path_to_debian="debian/dists"
debian_netinstall_kernel="linux"
debian_netinstall_initrd="initrd.gz"

# Ubuntu netinstall
ubuntu_netinstall_ver="hardy intrepid jaunty" 
ubuntu_netinstall_arch="i386 amd64"
ubuntu_url_site="http://es.archive.ubuntu.com"
# Path to Ubuntu where directory $ver (Ex. dapper) exists
path_to_ubuntu="ubuntu/dists"
ubuntu_netinstall_kernel="linux"
ubuntu_netinstall_initrd="initrd.gz"

Per tal que es mostri en el menú de PXE cal executar:

dcs -> more -> switch-pxe-menu

O treure les opcions MENU HIDE.

generate-pxe-menu

$ locate generate-pxe-menu
/opt/drbl/sbin/generate-pxe-menu

Genera el menú de boot (GRUB) de DRBL. Toca el fitxer /tftpboot/nbi_img/pxelinux.cfg/default. Aquest fitxer és utilitzat per PXE.

S'executa de la següent manera:

$ sudo /opt/drbl/sbin/generate-pxe-menu
Generating default pxelinux config (/tftpboot/nbi_img/pxelinux.cfg/default)...
Use com32 module: vesamenu.c32
Adding menus for DRBL, local boot, memtest86+, FreeDOS...
done!

/opt/drbl/sbin/drblsrv

És l'executable de DRBL.


Que modifica DRBL?

Còpies de seguretat

DRBL guarda una copia dels fitxers que modifica:

$ sudo updatedb
$ locate drblsave
/etc/exports.drblsave
/etc/hosts.drblsave
/etc/netgroup.drblsave
/etc/ypserv.securenets.drblsave
/tftpboot/node_root/etc/exports.drblsave
/tftpboot/node_root/etc/hosts.drblsave
/tftpboot/node_root/etc/netgroup.drblsave
/tftpboot/node_root/etc/ypserv.securenets.drblsave


Fitxer /etc/hosts

Durant la configuració diu:

Backup the original /etc/hosts as /etc/hosts.drblsave... done!
Generate the /etc/hosts for clients connected to eth0... done!

Afegeix els clients lleugers i el terminals server al fitxer hosts:

$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 dell-desktop.example.com dell-desktop

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
192.168.1.33 dell-desktop-eth0
192.168.1.1 dell-desktop001

El fitxer antic es guarda a:

/etc/hosts.drblsave

DHCP

Durant la instal·lació es modifica DHCP diversos cops:

Force to add dhcp3-server service in this Debian DRBL server...
...
Searching installed Etherboot files for dhcpd.conf... done! 

Fitxer /etc/dhcp/dhcpd.conf:

Sense comentaris ni espais:

$ cat dhcpd.conf | grep -v '^#\|^$\|^;'
default-lease-time			300;
max-lease-time				300;
option subnet-mask			255.255.255.0;
option domain-name-servers  		192.168.1.1;
option domain-name			"drbl.name";	
ddns-update-style                       none;
server-name 				drbl;
filename = "pxelinux.0";
class "DRBL-Client" {
  match if 
  (substring(option vendor-class-identifier, 0, 9) = "PXEClient") or
  (substring(option vendor-class-identifier, 0, 9) = "Etherboot") or
  (substring(option vendor-class-identifier, 0, 10) = "DRBLClient") ;
}
subnet 192.168.1.0 netmask 255.255.255.0 {
    option subnet-mask	255.255.255.0;
    option routers 192.168.1.1;
    next-server 192.168.1.5;
    pool {
      # allow members of "DRBL-Client";
      range 192.168.1.1 192.168.1.12;
    }
}
subnet 192.168.0.0 netmask 255.255.255.0 {
       allow booting;
       allow bootp;
       
       option domain-name-servers 192.168.0.5, 208.67.222.222, 208.67.220.220, 195.235.113.3, 195.235.96.90;
       option broadcast-address 192.168.0.255;
       option subnet-mask 255.255.255.0;
       option routers 192.168.0.1;
       range 192.168.0.50 192.168.0.80;
       option domain-name "ferrer-tura.org";
       default-lease-time 1800;
       max-lease-time 7200;
       
       # PXE
       group {
               next-server 192.168.0.5;
               filename "pxelinux.0";
               # Crazy Laptop eth
               host crazy-laptop-eth {
                       hardware ethernet 00:1d:09:3c:a4:93;
                       fixed-address 192.168.0.16;
                       }
               }


}


Sencer

# Generated by DRBL. 
# Do NOT modify this file unless you know what you are doing! 

default-lease-time                      300;
max-lease-time                          300;
option subnet-mask                      255.255.255.0;
option domain-name-servers              80.58.61.250,80.58.61.254;
option domain-name                      "example.com";
ddns-update-style                       none;
server-name                             drbl; 

filename = "pxelinux.0";
# gpxelinux.0 features: HTTP, DNS, TFTP, iSCSI, AoE, bzImage ELF, Multiboot, PXE, PXEXT. Ref: http://ols.fedoraproject.org 
/OLS/Reprints-2008/anvin-reprint.pdf 
# filename = "gpxelinux.0"; 

## Uncomment the following "if block" when you have some buggy PXE NIC card (such as annoying sis900 NIC). Remember to modify the 
MAC vendor prefix and restart dhcpd service!!!
## This is a workround for some network card with BAD PXE code in firmware.
## It will only affect those clients with MAC vendor prefix you assigned.
## Ref: http://syslinux.zytor.com/archives/2005-August/005640.html 
  
#if substring (option vendor-class-identifier, 0, 3) = "PXE" {
#     # **************************************************************
#     # ***MODIFY*** the MAC vendor prefix of client network card here.
#     # **************************************************************
#     # For annoying sis900 network card, maybe it is 00:07:95, 00:0C:6E...
#     if substring (hardware, 1, 3) = 00:0C:6E {
#         # eb-5.4.3-etherboot-pci.zpxe is a all-in-one pxe image, works for most NIC.
#         # sis900.zpxe is specially for sis900 NIC.
#         # Try either one.
#         #filename = "eb-5.4.3-etherboot-pci.zpxe";
#         filename = "sis900.zpxe";
#     }
#}

# Uncomment the following to get the debug/verbose messages in system log. The messages like the following will be shown:
# Client 0:c:29:3b:34:fb requests 1:2:3:5:6:b:c:d:f:10:11:12:2b:36:3c:43:80:81:82:83:84:85:86:87 -   
PXEClient:Arch:00000:UNDI:002001 - no dhcp-client-id
# Client 0:c:29:3b:34:fb requests 1:3:6:c:f:1c:28:29:2a - DRBLClient - no dhcp-client-id
# Begin of log command
#log(info, concat("Client ",
#        binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)),
#        " requests ",
#        binary-to-ascii(16, 8, ":", option dhcp-parameter-request-list),
#        " - ",
#        pick-first-value(option vendor-class-identifier, "no vendor-id"),
#        " requests ",
#        binary-to-ascii(16, 8, ":", option dhcp-parameter-request-list),
#        " - ",
#        pick-first-value(option vendor-class-identifier, "no vendor-id"),
#        " - ",
#        pick-first-value(option dhcp-client-identifier, "no dhcp-client-id"))
#   );
# End of log command

# This class 'DRBL-Client' defines 3 kind of clients: PXE, Etherboot (1st stage) or DRBL client (2nd stage, i.e. in network  
initrd/initramfs (mkpxeinitrd-net)) to lease IP address.  This will only affect 'range' statement only, not the 'host' statement.
# Note! The following line(s) in the pool statement: 'allow members of "DRBL-Client";' is/are commented to disable this mechanism 
#by default.
# If you do want to use this mechanism, uncomment all 'allow members of "DRBL-Client";', then only PXE, etherboot and DRBL client 
# can lease IP address from this DHCP service.
# ///NOTE/// In summary, two cases you can turn on this mechanism:
# (1) This DRBL server is not used as a clonezilla server.
# (2) This DRBL server is used as a Clonezilla server, with the following conditions:
#     (a) 'range' statement is used in this DRBL service.
#     (b) There is an existing DHCP service which can provide IP address leases to the restored OS (either GNU/inux or MS 
#Windows) in the client. Otherwise if you uncomment 'all
#ow members of "DRBL-Client";', restored OS won't be able to lease IP address.

# The DRBL client class: PXE, Etherboot or DRBL client
class "DRBL-Client" {
  match if 
  (substring(option vendor-class-identifier, 0, 9) = "PXEClient") or
  (substring(option vendor-class-identifier, 0, 9) = "Etherboot") or
 (substring(option vendor-class-identifier, 0, 10) = "DRBLClient") ;
}

# If you want to use special port for DHCP service, edit here:
# For more info, ref: http://drbl.sourceforge.net/faq/index.php#path=./2_System&entry=37_coexist_with_existing_dhcp.faq
# local-port 1067;
# remote-port 1068;

subnet 192.168.1.0 netmask 255.255.255.0 {
    option subnet-mask	255.255.255.0;
    option routers 192.168.1.33;
    next-server 192.168.1.33; 

    host dell-desktop001 {
        hardware ethernet  00:1d:09:59:10:39;
        fixed-address 192.168.1.1; 
	# option host-name "dell-desktop001";
    }
}

SSH

Cleaning the ssh key file ssh_host_dsa_key copied from server... done!
Cleaning the ssh key file ssh_host_dsa_key.pub copied from server... done!
Cleaning the ssh key file ssh_host_rsa_key copied from server... done!
Cleaning the ssh key file ssh_host_rsa_key.pub copied from server... done!

Per cada client:

Creating DRBL client: dell-desktop001 192.168.1.1... Generating SSH host keys for client 192.168.1.1 if they do not exist... done!

NFS

Durant la configuració diu:

Generating the NFS exports for DRBL clients... 
Backup the original /etc/exports as /etc/exports.drblsave
Exporting to clients by IP address line-by-line...
Full DRBL or Full Clonezilla mode, exporting client's directories etc, var, root...
The /etc/exports setting is ok now!
$ cat /etc/exports
# Generated by DRBL at 13:22:40 2008/10/25
/tftpboot/node_root 192.168.1.1(ro,sync,async,no_root_squash,subtree_check)
/usr 192.168.1.1(ro,sync,async,no_root_squash,subtree_check)
/opt 192.168.1.1(ro,sync,async,no_root_squash,subtree_check)
/home 192.168.1.1(rw,sync,async,no_root_squash,no_subtree_check)
/var/spool/mail 192.168.1.1(rw,sync,async,root_squash,no_subtree_check)

/tftpboot/nodes/192.168.1.1/ 192.168.1.1(rw,sync,async,no_root_squash,no_subtree_check)

Hi ha una còpia de seguretat del fitxers anterior a:

cat /etc/exports.drblsave

iptables

Durant la configuració diu:

Warning! If you go on, your firewall rules will be overwritten during the setup!
The original rules will be backuped as iptables.drblsave in system config directory (/etc/sysconfig or /etc/default).
[Y/n] 


I després:

Now generate the firewall rules for NAT service...
Stop the NAT service first...
Flushing firewall rules: success
IMPORTANT: DRBL es carrega les normes del firewall que existeixin!. Però fa una còpia de seguretat a :
/etc/default/iptables.drblsave 

Afegeix normes NAT per fer masquerade entre la targeta LAN i la WAN:

$ sudo iptables -nvL -t nat
Chain PREROUTING (policy ACCEPT 1 packets, 121 bytes)
pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 37 packets, 2708 bytes)
pkts bytes target     prot opt in     out     source               destination         
   0     0 MASQUERADE  all  --  *      *       192.168.1.1          0.0.0.0/0

Chain OUTPUT (policy ACCEPT 37 packets, 2708 bytes)
pkts bytes target     prot opt in     out     source               destination

NIS

Now set the YP securenets...
Backup the original /etc/ypserv.securenets as /etc/ypserv.securenets.drblsave
The /etc/ypserv.securenets setting is done!
Update YP...

I més tard:

*****************************************************.
Adding normal users to group "audio cdrom plugdev floppy video"........ done!
*****************************************************.
Updating the YP/NIS for group...
Note! If you add new or remove accounts in the DRBL server in the future, remember to run the following command again, so that   
some group (EX:plugdev) will be updated :
tune-debian-dev-group-perm -g "audio cdrom plugdev floppy video" -e
*****************************************************.
$ cat /etc/ypserv.securenets
# Generated by DRBL at 13:22:42 2008/10/25
255.0.0.0       127.0.0.0
# For DRBL server
255.255.255.255 192.168.1.33
255.255.255.255 147.83.15.23 

# For DRBL clients
255.255.255.255 192.168.1.1
$ cat /etc/netgroup.drblsave 
# Added by DRBL, begin
nodes (ubuntuServer1001,,) (ubuntuServer1002,,) (ubuntuServer1003,,) (ubuntuServer1004,,) (ubuntuServer1006,,) (ubuntuServer1007,,)    
(ubuntuServer1008,,) (ubuntuServer1009,,) (ubuntuServer1010,,) (ubuntuServer1011,,) (ubuntuServer1012,,) (ubuntuServer1013,,) 
# Added by DRBL, end

tftpd

Consulteu l'article TFTP i Arrancada de xarxa. Es modifica el fitxer:

$ cat /etc/default/tftpd-hpa 
RUN_DAEMON="yes"
OPTIONS="-l -s /tftpboot/nbi_img"
$ dpkg -l | grep 
ii  tftpd-hpa                         0.48-2.2ubuntu1               HPA's tftp server
Restarting HPA's tftpd: in.tftpd                                                                                                              [ OK ]

pxelinux

Consulte l'article PXE Linux.

La configuració inicial relativa a l'arrancada de xarxa de DRBL es troba a:

$ cat /opt/drbl/conf/drbl.conf
...
# syslinux_binsrc_url is for downloading syslinux.exe, syslinux if necessary. You can change to any mirror site.
syslinux_binsrc_url="http://free.nchc.org.tw/syslinux"
pxelinux_binsrc_dir="$DRBL_SCRIPT_PATH/pkg/syslinux/" 
pxelinux_file="$pxelinux_binsrc_dir/pxelinux.0"
gpxelinux_file="$pxelinux_binsrc_dir/gpxelinux.0"
pxelinux_simple_menu="$pxelinux_binsrc_dir/menu.c32"
pxelinux_simple_vesamenu="$pxelinux_binsrc_dir/vesamenu.c32"
pxelinux_memdisk_file="$pxelinux_binsrc_dir/memdisk"
pxelinux_chain_file="$pxelinux_binsrc_dir/chain.c32"
pxelinux_mboot_file="$pxelinux_binsrc_dir/mboot.c32"
pxelinux_sanboot_file="$pxelinux_binsrc_dir/sanboot.c32"
# Note, we can not use - or other charactor, since isolinux won't accept that (drbl-pxe.png is not accepted by syslinux,   
however, it's ok for pxelinux). To 
pxelinux_bg_img="$DRBL_SCRIPT_PATH/image/drblwp.png"
PXELINUX_DIR="/tftpboot/nbi_img/pxelinux.cfg"
PXE_CONF_DEF="$PXELINUX_DIR/default"
isolinux_file="$pxelinux_binsrc_dir/isolinux.bin"
# Note, we can not use - or other charactor, since isolinux won't accept that (ocs-logo.png is not accepted by syslinux,   
however, it's ok for pxelinux). To
ocs_logo_img_syslinux="$DRBL_SCRIPT_PATH/image/ocswp.png"
ocs_logo_img_grub="$DRBL_SCRIPT_PATH/image/ocswp.xpm.gz" 
memtest86_file="$DRBL_SCRIPT_PATH/pkg/memtest86+/memtest86"
fdos_img_src="/usr/lib/freedos/fdos1440.img"
fdos_img_output="fdos1440_drbl.img"
 PXE_RAMDISK_SIZE="12288"
PXE_RAMDISK_BLOCKSIZE="1024"
NETINSTALL_RAMDISK_SIZE_DEF="65535"
# The default-lease-time and max-lease-time in dhcpd.conf (secs)
DHCPD_DEFAULT_LEASE_TIME="300"
DHCPD_MAX_LEASE_TIME="300"
...

Si executeu:

$ sudo updatedb
$ locate pxelinux
/opt/drbl/pkg/syslinux/gpxelinux.0
/opt/drbl/pkg/syslinux/pxelinux.0
/opt/drbl/sbin/drbl-pxelinux-passwd
/tftpboot/nbi_img/gpxelinux.0
/tftpboot/nbi_img/pxelinux.0
/tftpboot/nbi_img/pxelinux.cfg
/tftpboot/nbi_img/pxelinux.cfg/default
/usr/lib/syslinux/pxelinux.0
/usr/share/doc/syslinux/pxelinux.txt.gz

Veureu que la configuració de pxelinux en DRBL està a la carpeta:

/tftpboot/nbi_img/pxelinux.cfg

Per tal de fer a mida aquest menú consulteu:

SistemaDeRecuperacióImatgesPerXarxa#PXELinux

Mode SSI

Són generats pel fitxer:

/opt/drbl/sbin/drbl-gen-ssi-files

Durant la instal·lació el missatge és:

Template client for DRBL SSI is 192.168.1.1
Using template host /tftpboot/nodes/192.168.1.1
Generating SSH host keys for client 192.168.1.1 if they do not exist... done!
Generating the files for DRBL single system image template... etc... var... opt/drbl... Root's openssh public key... done!

Les plantilles són uns fitxers tar.gx que contenen les carpetes:

  • /etc/
  • /var
  • /opt/drbl

Aquestes carpetes son muntades amb un sistema temporal (tmpfs) al iniciar els clients SSI. Qualsevol modificació en aquestes carpetes en els clients no es guarda, ja que al tornar a muntar es munta la plantilla un altre cop.

Les plantilles es troben a:

$drbl_common_root/drbl_ssi/template_etc.tgz

És a dir, normalment a:

$ ls /tftpboot/node_root/drbl_ssi/
clients  DRBL-Clonezilla-related-pkgs.txt  rc1.d  root_ssh_key  template_etc.tgz  template_opt_drbl.tgz  template_var.tgz

Si volem regenerar els fitxers tar.gx cal modificar la plantilla. Normalment la plantilla és el primer client. Per exemple, modifiquem els fitxers:

/tftpboot/nodes/192.168.1.1/etc
/tftpboot/nodes/192.168.1.1/var
/tftpboot/nodes/192.168.1.1/opt/drbl 

I tornem a executar només drbl-gen-ssi-files:

$ sudo /opt/drbl/sbin/drbl-gen-ssi-files

És a dir no cal tornar a executar drblpush sencer.

El codi que genera les plantilles és:

$ cat /opt/drbl/sbin/drbl-gen-ssi-files
...
...
echo -n "Generating the files for DRBL single system image template... "
# use only one drbl client as template, the 1st one.
echo -n "etc... "
(cd $template/; tar $etc_exclude_opt -czf $drbl_common_root/drbl_ssi/template_etc.tgz etc)
echo -n "var... " 
# 2 >/dev/null to avoid some warnings about socket files in /var/
(cd $template/; tar -czf $drbl_common_root/drbl_ssi/template_var.tgz var 2>/dev/null)
echo -n "opt/drbl... "
(cd /; tar --exclude=doc --exclude=setup -czf $drbl_common_root/drbl_ssi/template_opt_drbl.tgz /opt/drbl 2>/dev/null)

# make them can read by root only, better security 
chmod 600 $drbl_common_root/drbl_ssi/template_*.tgz

Qüestions avançades

DRBL repartit en dues màquines: Servidor de DHCP i DRBL

Es pot utilitzar un servidor DHCP ja existent.

A l'IES Nicolau Copèrnic s'està fent un muntatge per tal d'utilitzar clonezilla amb la arrancada de xarxa mitjançant la eina DRBL.

En el nostre cas ja disposem d'un servidor de DHCP. El primer pas és traspassar la configuració del servidor de DHCP de DRBL al servidor de DHCP de la nostra xarxa. El que volem fer és un "merge" entre la configuració nostra i la que necessita DRBL.

En aquest apartat documentarem les passes que s'han dut a terme per a realitzar aquesta configuració.

Instal·lació de DRBL

El servidor de DRBL s'ha instal·lat a una Ubuntu Server 8.10, seguin les passes de #DRBL_i_clonezilla#Instal.C2.B7laci.C3.B3_a_Ubuntu.

El servidor és accessible des de totes les màquines de totes les aules però no està en el mateix segment de xarxa. Per aquesta raó, el servidor de DHCP de DRBL no dona servei als clients. El primer que cal fer és moure la configuració de DRBL al nostre servidor DHCP.

Adaptació de DRBL

Per a les nostres necessitats, ha calgut adaptar el codi de drblpush.

A la màquina on s'executa DRBL no és on finalment anirà el servidor de DHCP. DRBL necessita que durant la execució de drblpush hi hagi totes les interfícies de xarxa que tindrà el servidor de DHCP de DRBL, si no dona errors.

El servidor de DHCP del centre, dona servei a 8 aules diferents. Hi ha 8 targetes de xarxa una per cada aula (cada aula en una subxarxa diferent).

Per simular aquestes targetes de xarxa es podria utilitzar IP Aliasing:

$ sudo ifconfig eth0:1 192.168.1.1 netmask 255.255.255.0 up
$ sudo ifconfig eth0:2 192.168.2.1 netmask 255.255.255.0 up
$ sudo ifconfig eth0:3 192.168.3.1 netmask 255.255.255.0 up
...
$ sudo ifconfig eth0:8 192.168.8.1 netmask 255.255.255.0 up

Simulant les 8 targetes de xarxa. Però això finalment dona problemes.

La opció escollida ha estat adaptar l'script de perl:

/opt/drbl/sbin/drblpush

NOTA: realment el fitxer /opt/drbl/sbin/drblpush és un enllaç a /opt/drbl/setup/drblpush

La idea és no utilitzar el mode interactiu i utilitzar directament el fitxer /etc/drbl/drblpush.conf.

Volem obtenir un configuració similar a la següent:

$ sudo cat /etc/drbl/drblpush.conf
#Setup for general
[general]
domain=iescopernic.com
nisdomain=iescopernic
nfsserver_default=192.168.0.8
localswapfile=yes
client_init=graphic
login_gdm_opt=login
timed_login_time=
maxswapsize=128
ocs_img_repo_dir=/home/partimag
total_client_no=128
create_account=
account_passwd_length=8
hostname=DRBLCopernic_
purge_client=yes
client_autologin_passwd=
client_root_passwd=
client_pxelinux_passwd=
set_client_system_select=yes
use_graphic_pxelinux_menu=yes
set_DBN_client_audio_plugdev=yes
open_thin_client_option=no
client_system_boot_timeout=70
language=en_US
set_client_public_ip_opt=no
config_file=drblpush.conf
collect_mac=no
clonezilla_mode=clonezilla_box_mode
drbl_mode=none
drbl_server_as_NAT_server=no
add_start_drbl_services_after_cfg=yes
continue_with_one_port=

#Setup for eth1. Simula aula 1
[eth1]
interface=eth1
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.1.1

#Setup for eth2 Simula aula 2
[eth2]
interface=eth2
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.2.1  

#Setup for eth3. Simula aula 3
[eth3]
interface=eth3
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.3.1  

#Setup for eth4 Simula aula 4
[eth4]
interface=eth4
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.4.1  

#Setup for eth5. Simula aula 5
[eth5]
interface=eth5
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.5.1  


#Setup for eth6 Simula aula 6
[eth6]
interface=eth6
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.6.1  
 
 
#Setup for eth7. Simula aula 7
[eth7]
interface=eth7
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.7.1 

#Setup for eth8. Simula aula 8
[eth8]
interface=eth8
range=75-90
netmask=255.255.255.0
nfsserver=192.168.0.8
gateway=192.168.8.1 

Per utilitzar aquesta configuració cal executar:

$ sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf

Però si s'executa en una màquina que no té les 8 targetes de xarxa no funciona. Les funcions:

/opt/drbl/bin/drbl-get-netmask 
/opt/drbl/drbl-get-ipadd

No retornen res si la interfície no existeix.

Cal modificar el fitxer drblpush. Cal modificar la part 3 del fitxer, els canvis estan en negreta:

# Part 3,
# create every client node, like Debian's diskless-newhost
#
 foreach my $k1 ( sort(keys %$rHoH) ) {
   if( $k1=~/general/ ) { next; } # skip general block
   my $interface=$rHoH->{$k1}{"INTERFACE"};
   my $netmask_sys=$rHoH->{$k1}{"NETMASK"};
   my $hostname_sys=$rHoH->{$k1}{"HOSTNAME"};
   my $ipaddr_sys=$rHoH->{$k1}{"IPADDRESS"};
   my $network=$rHoH->{$k1}{"NETWORK"};
   my $nfsserver=$rHoH->{$k1}{"NFSSERVER"};
   my $bootserver=$rHoH->{$k1}{"BOOTSERVER"};
   my $nisserver=$rHoH->{$k1}{"NISSERVER"};  
   my $gateway=$rHoH->{$k1}{"GATEWAY"};
   my $nbi=$rHoH->{$k1}{"NBI"};
   my $mac=$rHoH->{$k1}{"MAC"};
   my $ip_start=$rHoH->{$k1}{"IP_START"};
   my $range=$rHoH->{$k1}{"RANGE"};
   
   /* Uncomment these lines to debug
   print "interface: $interface\n";
   print "netmask_sys: $netmask_sys\n";
   print "hostnmae_sys: $hostname_sys\n";
   print "ipaddr_sys: $ipaddr_sys\n";
   print "network: $network\n";
   print "nfsserver: $nfsserver\n";
   print "bootserver: $bootserver\n";
   print "nisserver: $nisserver\n";  
   print "gateway: $gateway\n";
   print "nbi: $nbi\n";
   print "mac: $mac\n";
   print "ip_start: $ip_start\n";
   print "range: $range\n"; 
   */
   
   if( length($bootserver)==0 ) { $bootserver=$nfsserver; }
   if( length($nisserver)==0 ) { $nisserver=$nfsserver; }  
   if( length($gateway)==0 ) { $gateway=$nfsserver; }
   if( length($nbi)==0 ) { $nbi=$rHoH->{"general"}{"NBI"}; }
   # Try to get setting from system also
   # use the NIC "eth1, eth2..." of DRBL server as default nfsserver_sys...


    if( length($hostname_sys)==0 ) {
       chomp($hostname_sys=`hostname`);
   }
   if( length($netmask_sys)==0 ) {
       chomp($netmask_sys=`drbl-get-netmask $interface`);
   }
    
   if( length($ipaddr_sys)==0 ) {
       chomp($ipaddr_sys=`drbl-get-ipadd $interface`);
   }
   if( length($ipaddr_sys)==0 ) {
           print ("Using gateway address ($gateway) as system ip address...");
           $ipaddr_sys=$gateway;
   }
   ...
   unless ( $netmask_sys ) {
      print "Error! NETMASK for interface $interface is unset!\n";
      print "Please set NETMASK in system config file (at interfaces section) or check your network configuration.\n";
      exit;
   }
    
   unless ( $ipaddr_sys ) {
      print "Error! IPADDRESS for interface $interface is unset!\n";
      print "Please set IPADDRESS in system config file (at interfaces section)  or check your network configuration.\n";
      exit;
   }

Aquests canvis permeten indicar la màscara, el nom de màquina i la adreça ip de cada interfície de xarxa encara que no existeixi.



Servidor de DHCP

Com que ja existeix un servidor de DHCP al centre, s'ha optat per no utilitzar el servidor de DHCP de clonezilla.

DRBL win roll

Multicast

DRBL utilitza Udpcast per enviar les imatges a la xarxa amb multicast.

Al fitxer /opt/drbl/sbin/ocs-functions, tenim la funció find_multicast_ethernet_port:

find_multicast_ethernet_port() {
   echo -n "Finding the multicast seed ethernet port... "
   for eth in `get_dhcpd_interface`; do
     # keep the port for multicast to be echoed in screen
     eth_for_multicast="$eth"
     break
   done
   echo "done."
   echo "Will use ethernet port $eth_for_multicast for multicast seed in this clonezilla server."
} # end of find_multicast_ethernet_port

Consulteu també l'article:

Multicast

i

Udpcast

La variable que determina quina és la interfície de xarxa a utilitzar per a multicast és:

$eth_for_multicast

La funció udp_send_part_img() també es troba al fitxer /opt/drbl/sbin/ocs-functions (línia 3605) i s'encarrega de configurar la comanda udp-sender:

udpcast_send_cmd="udp-sender $udp_sender_extra_opt $udpcast_hold_opt1 $udpcast_hold_opt2 $udpcast_hold_opt3 --interface $eth_for_multicast --nokbd 
--mcast-all-addr $MULTICAST_ALL_ADDR --portbase $port $TIME_TO_LIVE_OPT"

Es pot establir un altre targeta de xarxa afegint la línia:

eth_for_multicast="eth0"

O es pot modificar el time to live canviant la variable:

$TIME_TO_LIVE_OPT 

Al fitxer /opt/drbl/conf/drbl-ocs.conf:

$ sudo joe /opt/drbl/conf/drbl-ocs.conf
...
# multicast setting
# From udpcast menu:
# --mcast-all-addr address
# Uses   a  non-standard  multicast  address  for  the  control
# connection  (which  is  used  by  the sender and receivers to
# "find"  each  other). This is not the address that is used to
# transfer the data.
# By  default  mcast-all-addr is the Ethernet broadcast address
# if ttl is 1, and 224.0.0.1 otherwise. This setting should not
# be  used  except  in  very  special  situations, such as when  
# 224.0.0.1 cannot be used for policy reasons.
# Note! It's better to keep 224.0.0.1, For example, if $eth_for_multicast is eth1. In Debian sarge, for different clients in eth2 or eth3, will not be 
able
MULTICAST_ALL_ADDR="224.0.0.1"
MULTICAST_PORT="2232"
TIME_TO_LIVE_OPT="--ttl 1"

Abans de la definició de la variable udpcast_send_cmd.

Segons els tipus d'imatge, es farà un multicast o un altre, les funcions són:

  • partimage: multicast_feed_img_for_partimage
  • ntfsclone: multicast_feed_img_for_ntfsclone
  • partclone: multicast_feed_img_for_partclone
  • dd: multicast_feed_img_for_dd

Al final, el que fa DRBL és utilitzar una pipe per a enviar la imatge per la xarxa amb udp-sender. Si executeu:

$ ps aux | grep udp
root     27925  0.0  0.0   1084   312 pts/0    S    08:51   0:00 udp-sender --full-duplex --min-clients 5 --max-wait 300 --interface eth0 --nokbd 
--mcast-all-addr 224.0.0.1 --portbase 2232 --ttl 1

i

$ ps aux | grep cat
root     27924  0.0  0.0   2904   624 pts/0    S    08:51   0:00 cat /home/partimag/2009-04-29-19-img-FestaUbuntuAula5/sda1

El que s'ha executat ha estat:

$ cat /home/partimag/2009-04-29-19-img-FestaUbuntuAula5/sda1 | udp-sender --full-duplex --min-clients 5 --max-wait 300 --interface eth0 --nokbd 
--mcast-all-addr 224.0.0.1 --portbase 2232 --ttl 1

Anem a veure que executen els clients. Per NFS a cada client se li munta la carpeta:

/tftpboot/node_root

Aquesta carpeta conté el sistema de fitxers dels clients. El fitxer encarregat d'executar clonezilla és:

/tftpboot/node_root/etc/init.d/ocs-run
/opt/drbl/sbin/ocs-sr --language 0  -g auto -hn0 PC -p true --max-time-to-wait 300 --mcast-port 2232 multicast_restoredisk 2disks hda hdb
task_multicast_restoredisk 

Està a /opt/drbl/sbin/ocs-functions

task_multicast_restoredisk() {
 local target_dir="$1"
 local target_hd="$2"
 local port=$3
 # For multicast, we check md5/sha1 sums on DRBL server, not clients. Force to set check_md5sum and check_sha1sum as no
 check_md5sum="no"; check_sha1sum="no"
 # To do backward compatability, we still keep task_multicast_restoredisk function, but let task_restoredisk do the real job.
 task_restoredisk "$target_dir" "$target_hd" "$port"
} # end of task_multicast_restoredisk

task_restoredisk

do_multicast_udpcast_restore()

També hi ha:

multicast_restore_by_partimage
 elif [ -f "$target_d/$img_file.ntfs-img" -o -f "$target_d/$img_file.ntfs-img.aa" ]; then
   # The saved image is from ntfsclone
   multicast_restore_by_ntfsclone
 elif is_partclone_image $target_d $img_file; then
   # The saved image is from partclone
   multicast_restore_by_partclone
 elif [ -f "$target_d/$img_file.dd-img" -o -f "$target_d/$img_file.dd-img.aa" ]; then
   # The saved image is from dd
   multicast_restore_by_dd

multicast_restore_by_partimage() {

 # get $unzip_stdin_cmd from image file
 if [ -f "$target_d/$img_file.000" ]; then
   get_image_cat_zip_cmd $target_d/$img_file.000
 elif [ -f "$target_d/$img_file.aa" ]; then
   get_image_cat_zip_cmd $target_d/$img_file.aa
 else
   get_image_cat_zip_cmd $target_d/$img_file
 fi
 echo $msg_delimiter_star_line
multicast_restore_by_partimage() {
 # get $unzip_stdin_cmd from image file
 if [ -f "$target_d/$img_file.000" ]; then
   get_image_cat_zip_cmd $target_d/$img_file.000
 elif [ -f "$target_d/$img_file.aa" ]; then
   get_image_cat_zip_cmd $target_d/$img_file.aa
 else
   get_image_cat_zip_cmd $target_d/$img_file
 fi
 echo $msg_delimiter_star_line

 start_time="$(date +%s%N)"
 $udpcast_rec_cmd 2>$udpcast_stderr | $unzip_stdin_cmd | partimage \
 $DEFAULT_PARTIMAGE_RESTORE_OPT $PARTIMAGE_RESTORE_OPT restore $part stdin
 # TODO
 # partimage will return 1 no matter it finishes or not when we use stdin and
 # other options to suppress the warning message... 
 # So just return 0.
 rc=0
 end_time="$(date +%s%N)"
 calculate_elapsed_time $start_time $end_time
 # prepare statistic report
 conv_return_code_to_human_read $rc
 report_msg="$report_msg $part, $clone_status, $time_elapsed_in_min mins;"
} # end of multicast_restore_by_partimage
$udpcast_rec_cmd 2>$udpcast_stderr | $unzip_stdin_cmd | partimage $DEFAULT_PARTIMAGE_RESTORE_OPT $PARTIMAGE_RESTORE_OPT restore $part stdin

Per buscar la variable udpcast_rec_cmd utilitzem la comanda grep:

$ sudo grep -n -r "udpcast_rec_cmd" /opt/drbl
/opt/drbl/sbin/ocs-functions:3315:  $udpcast_rec_cmd 2>$udpcast_stderr | $unzip_stdin_cmd | partimage \
/opt/drbl/sbin/ocs-functions:3354:  $udpcast_rec_cmd 2>$udpcast_stderr | $unzip_stdin_cmd | \
/opt/drbl/sbin/ocs-functions:3409:  $udpcast_rec_cmd 2>$udpcast_stderr | $unzip_stdin_cmd | \
/opt/drbl/sbin/ocs-functions:3454:  $udpcast_rec_cmd 2>$udpcast_stderr | $unzip_stdin_cmd | \
/opt/drbl/sbin/ocs-functions:3517:  udpcast_rec_cmd="udp-receiver $udp_receiver_extra_opt_default --nokbd --mcast-all-addr $MULTICAST_ALL_ADDR 
--portbase $port $TIME_TO_LIVE_OPT" 

La variable $udpcast_rec_cmd es defineix a la funció do_multicast_udpcast_restore() del fitxer /opt/drbl/sbin/ocs-functions.

DRBL com a restaurador d'imatges de xarxa

Consulteu Sistema de Restauració d'imatges per xarxa


Detalls del funcionament

drblsrv

El codi principal és:

# do it
case "$mode" in
  install)
       [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
       eval msg=\$msg_install_${OS_type}
       echo $msg
       [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
       install_drbl_${OS_type}
       ;;
  uninstall)
       [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
       eval msg=\$msg_uninstalling_DRBL_${OS_type} 
       echo $msg
       echo "$msg_analyzing_rpm_info"
       [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
       uninstall_drbl_${OS_type}
       ;;
  *)
       Usage
       exit 1
esac


Com veieu l'únic que fa és detectar el sistema operatiu i determinar si es una instal·lació o una desinstal·lació i executar:

install_drbl_${OS_type}

Instal·lació de distribucions (netinstall)

És una de les primeres preguntes. Es pot saltar i després executar DRBL_i_clonezilla#drbl-netinstall.

install_drbl_DBN()

Aquesta és la instal·lació per a sistemes operatius de la família Debian (inclou Ubuntu)

run_drblsrv_offline

Al final de la funció install_drbl_DBN() s'executa run_drblsrv_offline.

S'identifica durant l'execució per un missatge similar a:

Now run: drblsrv-offline -c -d -a -l en_US.UTF-8 -k /var/cache/apt/archives/linux-image-2.6.28-6-386_2.6.28-6.20_i386.deb "" ""
Kernel package /var/cache/apt/archives/linux-image-2.6.28-6-386_2.6.28-6.20_i386.deb is used for client...

És a di s'executa la comanda:

/opt/drbl/sbin/drblsrv-offline

Que es pot tornar a executar en qualsevol moment:

sergi@ubuntuServer904:~$ sudo /opt/drbl/sbin/drblsrv-offline -c -d -a -l en_US.UTF-8 -k /var/cache/apt/archives/linux-image-
2.6.28-6-386_2.6.28-6.20_i386.deb "" ""
Kernel package /var/cache/apt/archives/linux-image-2.6.28-6-386_2.6.28-6.20_i386.deb is used for client...
*****************************************************.
Your OS version is:: Ubuntu 9.04
*****************************************************.
*****************************************************.
Installing kernel for clients... ... 
The kernel for client is from specific package /var/cache/apt/archives/linux-image-2.6.28-6-386_2.6.28-6.20_i386.deb.
Installing /var/cache/apt/archives/linux-image-2.6.28-6-386_2.6.28-6.20_i386.deb for clients... 
It might take several minutes to install this kernel, please be patient...  
done!
Generating modules.dep and map files for clients... done!
*****************************************************.
Creating config file for PXE clients...
Copying pxelinux.0, gpxelinux.0, menu.c32, vesamenu.c32, chain.c32, mboot.c32, sanboot.c32 and memdisk to /tftpboot/nbi_img...
Copying memtest86+ to /tftpboot/nbi_img...
Copying FreeDOS files to /tftpboot/nbi_img/... 
Generating default pxelinux config (/tftpboot/nbi_img/pxelinux.cfg/default)...
Use com32 module: vesamenu.c32
Adding menus for DRBL, local boot, memtest86+, FreeDOS...
done!
*****************************************************.
*****************************************************.
Creating the image files for PXE and Etherboot client computer(s), this will take a few minutes ...
The latest kernel for the DRBL clients is 2.6.28-6-386
Running mknic-nbi --kernel 2.6.28-6-386 --all --no-modules
Will client check DHCP server name is "drbl" or not: yes
The maximum times to try to get IP address for a client: 3
The pause time after network card is up: 0
Setting port for udhcpc request to default...
Using the kernel modules from /tftpboot/node_root//lib/modules...
The selected kernel for DRBL clients is: 2.6.28-6-386
Kernel 2.6 was found, so default to use initramfs.
Creating the network boot initrd for PXE clients by: mkpxeinitrd-net -k 2.6.28-6-386 -t initramfs  
Use kernel modules from /tftpboot/node_root//lib/modules/2.6.28-6-386.
Creating the initRAMFS image...
Initramfs, remove ramdisk_size/ramdisk_block in /tftpboot/nbi_img/pxelinux.cfg/default if exists...
Finished!
Done!
*****************************************************.
Done!

prepare-files-for-PXE-client

TODO

generate-pxe-menu

TODO

mkpxeinitrd-net i mknbi

El paquet Debian es troba a:

http://www.stevenshiau.org/misc/mkpxeinitrd-net/mkpxeinitrd-net_1.2-16eb_i386.deb

El podeu descarregar i instal·lar amb:

$ wget http://www.stevenshiau.org/misc/mkpxeinitrd-net/mkpxeinitrd-net_1.2-16eb_i386.deb
$ sudo dpkg -i mkpxeinitrd-net_1.2-16eb_i386.deb

O millor encara es poden obtenir del repositori de DRBL:

$ sudo joe /etc/apt/sources.list

Afegiu la línia:

deb http://drbl.sourceforge.net/drbl-core drbl stable

I:

$ sudo apt-get update
$ sudo apt-get install mkpxeinitrd-net mknbi

I consultar els fitxers instal·lats amb:

$ sudo dpkg -L mkpxeinitrd-net
$ dpkg -L mknbi
$ cat /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init | more

Aquest fitxer, la comanda /usr/bin/mkpxeinitrd-net li canviarà el nom a linuxrc o init depenent de si utilitza initrd o initramfs.

L'executable:

/opt/drbl/sbin/mknic-nbi

Es proporcionat pel paquet drbl.

Aquest script és executat per drblsrv:

$ sudo drblsrv -i
...
The latest kernel for DRBL clients is 2.6.24-19-386
Running mknic-nbi --kernel 2.6.24-19-386 --all --no-modules
$ cat /opt/drbl/sbin/mknic-nbi | grep mkpxeinitrd-net
NETDEV_MOD="/usr/lib/mkpxeinitrd-net/initrd-skel/etc/modules"
NETINITRD_CFG="/usr/lib/mkpxeinitrd-net/initrd-skel/etc/linuxrc.conf"
NETDEV_CFG="/usr/lib/mkpxeinitrd-net/initrd-skel/etc/netdev.conf"
# parse the parameter for etc/linuxrc.conf in mkpxeinitrd-net
  # put the option for mkpxeinitrd-net
  echo "Creating the network boot initrd for PXE clients by: mkpxeinitrd-net -k $drbl_kernel $initfs_opt $usb_kb_opt $VERBOSE"
  mkpxeinitrd-net $initfs_opt $usb_kb_opt $VERBOSE -k $drbl_kernel

Paquets:

mknbi mkpxeinitrd-ne

Recursos:

Crear uns fitxers

O millor encara es poden obtenir del repositori de DRBL:

$ sudo joe /etc/apt/sources.list

Afegiu la línia:

deb http://drbl.sourceforge.net/drbl-core drbl stable

Ara executeu:

$ sudo apt-get update
$ sudo apt-get install mkpxeinitrd-net mknbi drbl gawk 
$ cd
$ mkdir kernel
$ cd kernel

Localitzeu les línies que hem de canviar amb:

$ sudo cat /usr/bin/mkpxeinitrd-net | grep -n tftpboot
24:output_dir=/tftpboot/nbi_img
95:  output_dir=tftpboot
132:# kernel config is either in /boot/ or /tftpboot/node_root/boot

Canvieu:

$ sudo joe /usr/bin/mkpxeinitrd-net
output_dir=/home/sergi/kernel

A la línia 24. Executeu:

$ sudo /usr/bin/mkpxeinitrd-net

S'hauran creat els fitxers initrd i vmlinuz:

$ ls
initrd-pxe.2.6.28-11-generic.img  initrd-pxe.img  vmlinuz-2.6.28-11-generic  vmlinuz-pxe

Els copiem a l'arrel del servidor TFTP:

$ sudo cp * /var/lib/tftpboot

I afegim una entrada a:

$ sudo joe pxelinux.cfg/default

...
...

label drbl_pxe
 # MENU DEFAULT
 #MENU HIDE
 MENU LABEL Ubuntu 8.04 Linux (DRBL mode, mostly local resources)
 # MENU PASSWD
 kernel vmlinuz-pxe
 append initrd=initrd-pxe.img devfs=nomount drblthincli=off selinux=0     clientdir=node_root
 TEXT HELP
 * DRBL version: 1.9.3-24. (C) 2003-2008, NCHC, Taiwan
 * Disclaimer: DRBL comes with ABSOLUTE NO WARRANTY
 ENDTEXT

Procés de boot de DRBL

Primer s'inicia una busybox? que s'encarrega d'iniciar un sistema bàsic que ha de carregar el maquinari de xarxa, configurar la xarxa amb DHCP i muntar el root remot amb NFS.

Després es continua l'execució des del root que s'ha muntat de forma remota amb NFS:

Fitxer original /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init:

...
echo "Use switch_root to exit initramfs"
   echo "Finished busybox $initfile! Enter DRBL init!"
   exec switch_root -c /dev/console /sysroot /sbin/init
 else
   echo "Use pivot_root to exit initrd"
   $echo "Pivoting root to /sysroot"
   pivot_root /sysroot /sysroot/initrd
   # From now on, original files in initrd are in /sysroot/initrd/ 
   # (Ex: /sysroot/initrd/bin/busybox), and 
   # / is mounted from $NFSSERVER:/tftpboot/node_root/
   cd /
Fitxer /usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init

S'encarrega de l'execució inicial.

Com veieu:

# Load setting
. /etc/linuxrc.conf
# We can assign the priority of network card to request IP address, 
# not from the results of auto detection.
. /etc/netdev.conf 

#

El fitxer /etc/linuxrc.conf realment és el fitxer de configuració /usr/lib/mkpxeinitrd-net/initrd-skel/etc/linuxrc.conf es pot modificar les opcions:

  • iretry_max: Numero d'intents de configuració de xarxa per DHCP
  • check_server_name: Cal verificar el nom del servidor DHCP?
  • dhcp_server_name: Nom del servidor DHCP
  • sleep_time_after_NIC_up: Temps a esperar després d'activar la tarjeta de xarxa
$ cat /usr/lib/mkpxeinitrd-net/initrd-skel/etc/linuxrc.conf | more
# retry max times for udhcp in one ethernet port
iretry_max="3" 

# Does linuxrc check the server name ?
check_server_name="yes" 

# The dhcp server name which client accepts. Default we use 'drbl', since the dhcp server name in dhcpd.conf is drbl (server-name drbl;). If you 
want to use another dhcp server,
 use the dhcp name of that server.
dhcp_server_name="drbl"

# The pause time (secs) after network card is up
# This is specially for some switch which need extra time to link, check 
# https://sourceforge.net/forum/message.php?msg_id=3583499 for more details.
sleep_time_after_NIC_up="0"

# Vendor Class ID is sent with udhcpc, this is a tag to let DHCP server know the request is from DRBL
# Ref: http://www.busybox.net/downloads/BusyBox.html
# udhcpc [-Cfbnqtv] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE] [-p pidfile] [-r IP] [-s script] 
# -V,     --vendorclass=CLASSID   Set vendor class identifier
# NOTE! Do not modify this unless you know how to modify the corresponding settings in dhcpd.conf in your DRBL server. Otherwise client might not be 
able to lease IP address.
ven dor_class_id="DRBLClient"

# udhcpc port. Normally we do not have to assign this. However, if for some reason, e.g. to avoid conflicting with existing dhcp server, i.e. 2 
dhcp  servers co-exist in a subnet
. Ref: http://drbl.sourceforge.net/faq/index.php#path=./2_System&entry=37_coexist_with_existing_dhcp.faq
# If you use this option with etherboot client with "ALTERNATE_DHCP_PORTS_1067_1068", here you should assign udhcpc_port=1068.
$ cat /usr/lib/mkpxeinitrd-net/initrd-skel/etc/netdev.conf
#  This file is used to assign the DRBL client to use which network card to
# connect to the server. If You assign the netdevices="eth1 eth0", then when
# client boot, it will try to get IP address first from eth1, then eth0.
netdevices=""
  1. REDIRECT Pàgina on redireccionar

Interfícies gràfiques

Sembla que totes estan força verdes...

Grimiore

NOTA: Són eines madureS?

restonux

Resolució de problemes. Troubleshooting

Error! NFSSERVER is unset!

Si durant la configuració de DRBL us dona el següent error:

$ sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
...
...
Error! NFSSERVER is unset!
Please set nfsserver in config file "/etc/drbl/drblpush.conf" or IPADDR in system config file.

Problemes amb Windows. Falta ntldr

Problemes amb una sola tarja de xarxa. IP alias

Còpia literal del manual d'instal·lació:

  1. If you have only one NIC, you may set two IP addresses, i.e. one in eth0 and another alias IP address in eth0:1. eth0 will be used for the DRBL server to connect to the public Internet while eth0:1 will be used for the DRBL environment. Here's how to setup eth0:1 in RedHat-like Linux. NOTE! This alias IP address will cause some problems if you do not provide static IP address to DRBL client via its MAC address. In this example, the DRBL server will lease IP address to any machine connected to eth0 if no MAC address is set in the DHCP service. Hence you'd better not to use alias IP if you do not know exactly what you are doing! Two or more NICs are recommended!

Switchs Cisco (Spanning Tree protocol) i problemes amb Etherboot

En commutadors Cisco com els Cisco Catalyst 2950 switches, el autosense feature dona problemes. Resulta que el protocol pot tardar tant en verificar que el nou port a l'engegar-se no provoca cap conflicte de bucle de xarxa, que a vegades els clients no estan a temps de iniciar la càrrega per xarxa.

Per desactivar-ho:

All ports/whole switch

enable
configure terminal
no spanning-tree vlan 1
end
show spanning-tree
NOTA: si voleu fer el canvi com a permanent executeu:
# copy running-config startup-config 
Destination filename [startup-config]? 
Building configuration...
[OK]

Al final de les comandes anteriors

Single port(s)

enable
configure terminal
int fa 4
no spanning-tree vlan 1
end
show spanning-tree

Consulteu:

Portfast

Es una versió ràpida de STP

Catalyst 6500/6000 Switch That Runs Cisco IOS System Software
This section presents the commands to turn on spanning tree PortFast and turn off trunking negotiation (DISL, DTP). With this operating system, PAgP 
is not active until you add a port to an EtherChannel. You do not need to turn it off. You can issue the interface range command in order to apply 
these commands to a group of ports at one time. The interface range command in this example allows you to apply the commands to ports 3/2 through 3/4 
at the same time:
Note: There is a space between the 2 and the - in the interface range fastethernet 3/2 -4 command. This space is mandatory in 
order to avoid a syntax error.

Estat inicial:

 # show run interface fastethernet 0/13
Building configuration...

Current configuration : 61 bytes
 !
 interface FastEthernet0/13
  no ip address
  shutdown
  end
# configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
# interface range FastEthernet 0/1 -24
(config-if-range)#

Ara per configurar les passes són

1) Utilitzar la comanda switchport per tal d'indicar que és un port de commutador

#switchport

2) Per desactivar DTP (Trunking negotation), configureu el port com a port només d'accés:

#switchport mode access

3) Activeu spanning tree PortFast:

#spanning-tree portfast 

4) Guardeu la configuració

#no shutdown

Premeu Ctrl+z:

#^Z
#copy run start

Tot junt:

# configure terminal
# interface range FastEthernet 0/1 -24
(config-if-range)#switchport
#switchport mode access
#spanning-tree portfast 
#no shutdown

Premeu Ctrl+z:

#^Z
#copy run start

Per verificar-ho:

#show version
Cisco Internetwork Operating System Software 
IOS (tm) c6sup1_rp Software (c6sup1_rp-JSV-M), Version 12.1(6)E, EARLY DEPLOYME)
#show run interface FastEthernet 0/13
   Building configuration...
   Current configuration : 109 bytes
   !
   interface FastEthernet0/13
    no ip address
    switchport
    switchport mode access
    spanning-tree portfast
   end

#show interfaces FastEthernet 0/13 switchport 
   Name: Fa0/13
   Switchport: Enabled
   Administrative Mode: static access
   Operational Mode: static access
   Administrative Trunking Encapsulation: negotiate
   Operational Trunking Encapsulation: native
   Negotiation of Trunking: Off
   Access Mode VLAN: 1 (default)
   Trunking Native Mode VLAN: 1 (default)
   Trunking VLANs Enabled: ALL
   Pruning VLANs Enabled: 2-1001

#show spanning-tree interface FastEthernet 0/13
    Port 141 (FastEthernet3/13) of VLAN1 is forwarding
      Port path cost 19, Port priority 128, Port Identifier 128.141.
      Designated root has priority 32768, address 00d0.024f.6001
      Designated bridge has priority 32768, address 00d0.024f.6001
      Designated port id is 128.141, designated path cost 0
      Timers: message age 0, forward delay 0, hold 0
      Number of transitions to forwarding state: 1
      BPDU: sent 8984, received 0
      The port is in the PortFast mode

Recursos:

Problemes amb partimage (es penja hangs up at 99%. stdin.001 not found)

L'error que us donarà serà quelcom similar a:

Can't read the following volume file 
/images/E2/d1p1.img.001
Enter another full path (directory & name)

Una alternativa és utilitzar partclone en comptes de partimage (alternativa apuntada per Steven Shiau):

Opció -q2

Sembla però que l'error és de partimage. Vegeu:

Provar :

The first test I made has failed with :  
/opt/drbl/sbin/ocs-iso -g en -t -k NONE -e "-b -c restoredisk sarge-image hda" sarge-image 
I had the same error. 
 
I added the option "--nogui" and now it works : 
/opt/drbl/sbin/ocs-iso -g en -t -k NONE -e "-b --nogui -c restoredisk sarge-image hda" sarge-image

Fitxer de log del partimage:

/var/log/partimage-debug.log

Vegeu també

Enllaços externs