Bezdiskové stanice (BootP, DHCP, TFTP)

Rudolf Sabo, xsabo@fi.muni.cz

Obsah

1. BOOTP

Je protokol na dynamicke pridelovanie IP adries. Popiseme si protokol ktory vyuziva.

BOOTP Protokol

BOOTPmessage:
Opcode|Hardwaretype|Hardwareaddresslength|Hopcount
TransactionID
Numberofseconds|Flags
ClientIPaddress
YourIPaddress
ServerIPaddress
GatewayIPaddress
Clienthardwareaddress
Serverhostname
Bootfilename
Vendorspecificinfo

Opcode:
1 BOOTREQUEST, Boot request.
2 BOOTREPLY, Boot reply.

Hardware type:
1 Ethernet.
6 IEEE 802.
7 ARCNET.

Pouzivaju sa porty: 67 (UDP) server, 68 (UDP) host.

Konfiguracia BOOTP serveru

Priklad /etc/bootpdtab suboru:

global:sm= 255.255.255.0:ds=157.171.1.4:gw=157.171.5.10:ht=ethernet:hd=/tftpboot:
client01:tc=global:ha=00:00:C0:12:B1:01:ip=157.151.7.200:bf=client01:
client02:tc=global:ha=00:00:C0:C1:B1:11:ip=157.151.7.201:bf=client02:

Policka:
sm maska podsiete
ds IP adresa DNS serveru
gw IP adresa default gateway
ht Typ hardveru
bf Meno boot suboru
hd Meno adresara v ktorom sa sa nachadza
ha Ethernetova hardverova adresa
ip IP adresa
tc Meno ktoru globalnu sekciu pouzit

Spustenie pomocou:
bootpd -s

2. DHCP

Ide o vylepsene BOOTP, rozdiel je hlavne v konfiguracii servera.

Konfiguracia DHCP serveru

Existuje implementacia DHCP serveru od ISC, podobne ako BIND pre DNS,
na http://www.isc.org/index.pl?/sw/dhcp/.

Konfiguruje sa pomocou suboru dhcpd.conf:
default-lease-time 600;
max-lease-time 7200;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.org";

# pre WINS
option netbios-name-servers 192.168.1.1;

host client01 {
hardware ethernet 00:00:D0:C4:24:D6;
fixed-address 192.168.1.9;
filename "/tftpboot/client01";
}

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
}

Spustit pomocou: /usr/sbin/dhcpd
Parametre: pre iny interface napr. eth2, pre debug -d -f

DHCP klient

V RedHat "Network Configuration"
pre eth0 interface definovat DHCP protokol

nadstavia sa premenne

DEVICE = eth0
IPADDR = 0.0.0.0
NETMASK = 255.255.255.0
NETWORK =
BROADCAST = 0.0.0.255
GATEWAY = none
ONBOOT = yes
DYNAMIC = dhcp

do /etc/dhclient.conf

interface eth0
send dhcp-lease-time 3600;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name;
require subnet-maska, domain-name-servers;

spusti sa
/usr/sbin/dhcpcd

3. TFTP

Sluzi na stahovanie dat po sieti. Ide o zjednodusenu verziu FTP, takzvany trivial FTP.

Protokol TFTP

TFTP header:
Opcode
Data

Opcode:
1 RRQ. Read request.
2 WRQ. Write request.
3 DATA. Read or write the next block of data.
4 ACK. Acknowledgment.
5 ERROR. Error message.
6 OACK. Option acknowledgment.

Ports: 69 (UDP) server; 1758 (UDP) multicast.

Konfiguracia TFTP

Spusta sa metademonom inetd alebo xinetd.

Pridat do /etc/inetd.conf:
tftp dgram udp wait nobody /usr/sbin/in.tftpd -s /tftboot tftpd

Pridat do /etc/services:
bootps 67/tcp # BOOTP server
tftp 69/udp # TFTP server

Restartovat inetd:
kill -HUP PID

4. Bezdiskove stanice

Boot ROMka: PXE, Etherboot, Netboot
Sietove bootloadery: pxelinux, bpbatch
Pouzity filesytem: RAM disk, NFS root, local hard drive

Jadro pre klienta

V jadre treba podporu pre:
* interface sietovej karty na klientovi
* TCP/IP sietovanie
* NFSROOT
* NFS suborovy sytem
* RARP

Pomocou Netboot
mknbi -linux -a nfsroot=ip_serveru:/export/root/meno_stroja -i rom -k zImage -o meno_stroja

napr.
mknbi -linux -a nfsroot=151.157.1.1:/export/root/client01 -I rom -k zImage -o client01

make bootrom
dd if=image.flo of=/dev/fd0

Pomocou Etherboot

Podla NFS-Root Mini-HOWTO

5. Sietovy boot loader pxelinux

Konfiguracia

/tftpboot/pxelinux.cfg:

DEFAULT linux
# Pre ramdisk
APPEND initrd=rootfs.gz root=/dev/ram rw\
ip=192.168.1.2:192.168.1.1:192.168.1.1:255.255.255.0:node1:eth0:off
# Pre NFS
APPEND root=/dev/nfs nfsroot=192.168.1.1:/export/root/node1,rw ip=ip-adresa

Nadstavenie PXE rozsireni na DHCP servery

Code 1: Multikastova adresa boot file serveru
Code 2: UDP port klienta ktory monitoruje MTFTP
Code 3: UDP port na ktorom MTFTP servery pocuvaju na MTFTP poziadavky
Code 4: Ako dlho ma pocuvat aktivitu pred novym pokusom o MTFTP prenos (v sekundach)
Code 5: Ako dlho ma klient pocuvat aktivitu kym restartuje MTFTP prenos (v sekundach)

option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;

subnet 192.168.1.0 netmask 255.255.255.0 {

class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
option vendor-class-identifier "PXEClient";
vendor-option-space PXE;

option PXE.mtftp-ip 0.0.0.0;

#meno suboru ktory boot ROMka stiahne
filename "pxelinux.0";

#meno serveru odkial ho dostane
next-server 192.168.1.1;
}
host node1 {
hardware ethernet fe:ed:fa:ce:de:ad;
fixed-address 192.168.1.2;
}
}
}
Dolezita je volba: PXE.mtftp-ip
jej nadstavenim povieme klientovy, ze vieme PXE DHCP a pomocou
mtftp-ip povieme, ze mozeme poskytovat multikastove TFTP

Unicastove a Multicastove TFTP

Umoznuje viacerym klientom stahovat rovnaky subor naraz pomocou multikastovych
paketov namiesto forkovania procesu pre kazdeho klienta.

PXE obsahuje podporu pre multikastove TFTP

6. Odkazy

(1)http://hobbes.jct.ac.il/docs/Diskless-HOWTO.html
(2)http://frank.harvard.edu/~coldwell/diskless/
(3)http://www.linux-mag.com/2000-04/networknirvana_01.html
(4)http://www.networksorcery.com/enp/protocol/bootp.htm
[RFC 951] BOOTSTRAP PROTOCOL (BOOTP)
[RFC 1534] Interoperation Between DHCP and BOOTP
[RFC 2132] DHCP Options and BOOTP Vendor Extensions
(5) http://www.networksorcery.com/enp/protocol/dhcp.htm
[RFC 2131] Dynamic Host Configuration Protocol.
(6)HOWTO dokumentacia:
http://www.tldp.org
Diskless-HOWTO zamerany na Etherboot and Netboot
Diskless-root-NFS-HOWTO
Diskless-root-NFS-other-HOWTO
Remote-boot-mini-HOWTO
Network-Boot-HOWTO
PXE using etherboot: HOWTO