PXELinux: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
 
(44 dazwischenliegende Versionen von 6 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
=Ldee=
 
Mit PXELinux kann man ein System über ein Netzwerk booten oder auch installieren.  
 
Mit PXELinux kann man ein System über ein Netzwerk booten oder auch installieren.  
 
 
==Installation tftp-Server==
 
==Installation tftp-Server==
root@xinux-desktop:/# apt-get install tftpd-hpa
+
*[[Tftp-Sever]]
 
+
*[[Tftp-Server]]
===Start über inetd===
 
* /etc/inetd.conf : udp -> udp4 ändern
 
tftp          dgram  udp4    wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
 
 
 
===Start als Alleinstehender Server===
 
* /etc/default/tftpd-hpa
 
#Defaults for tftpd-hpa
 
RUN_DAEMON="yes"
 
OPTIONS="-l -s /var/lib/tftpboot"
 
 
 
===Starten===
 
root@xinux-desktop:~# /etc/init.d/tftpd-hpa start
 
===Kontrolle===
 
*Ist der tftp Port geöffnet
 
root@ubuntu-server:/etc/dhcp3# netstat -lnu | grep 69
 
udp        0      0 0.0.0.0:69              0.0.0.0:*
 
 
 
*Installation tftp Client
 
root@lydia:~# apt-get install tftp
 
 
 
*Kann man einen Datei ziehen?
 
root@lydia:~# tftp 192.168.11.50
 
tftp> get 1545_sender
 
Received 900983 bytes in 0.6 seconds
 
tftp> quit
 
  
 
==Installation DHCP-Server==
 
==Installation DHCP-Server==
Zeile 36: Zeile 11:
 
* /etc/dhcp3/dhcpd.conf
 
* /etc/dhcp3/dhcpd.conf
 
  subnet 192.168.242.0 netmask 255.255.255.0 {
 
  subnet 192.168.242.0 netmask 255.255.255.0 {
        range 192.168.242.170 192.168.242.180;
+
      range 192.168.242.170 192.168.242.180;
        #Lease-Zeit in Sekunden
+
      default-lease-time 600;
        default-lease-time 600;
+
      max-lease-time 7200;
        max-lease-time 7200;
+
      option domain-name-servers 192.168.240.21;
        option domain-name "gamma.intern";
+
      option broadcast-address 192.168.242.255;
        option domain-name-servers 192.168.240.21;
+
      option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.242.255;
+
      filename "/pxelinux.0";
        option subnet-mask 255.255.255.0;
+
      next-server 192.168.242.140;
        #Gateway
+
      option root-path "192.168.242.140:/pxeroot";
        option routers 192.168.242.1;
+
 
+
      host pxeclient {
        #Hosts an die MAC festnageln
+
              hardware ethernet 00:0c:29:99:25:91;
        host pxeclient {
+
              fixed-address 192.168.242.171;
                hardware ethernet 00:0c:29:99:25:91;
+
              option host-name "pxeclient";
                fixed-address 192.168.242.171;
+
      }
                option host-name "pxeclient";
 
                next-server 192.168.242.140;
 
                filename "/pxelinux.0";
 
 
        }
 
 
  }
 
  }
 +
 +
===Starten===
 +
root@xinux-desktop:~# /etc/init.d/dhcp3-server start
 +
 +
===Stoppen===
 +
root@xinux-desktop:~# /etc/init.d/dhcp3-server stop
 +
 +
===Neustarten===
 +
root@xinux-desktop:~# /etc/init.d/dhcp3-server restart
 +
 +
===Kontrolle===
 +
root@xinux-desktop:~# netstat -nplu | grep 67
 +
udp        0      0 0.0.0.0:67              0.0.0.0:*                          3515/dhcpd3
  
 
==Bootimage vorbereiten==
 
==Bootimage vorbereiten==
Installation des Syslinux Paketes (normal nicht notwenig)
+
  root@xinux-desktop:~# apt-get install syslinux
  root@xinux-desktop:/etc/dhcp3# apt-get install syslinux
 
Kopieren des PXELINUX in das tftp Bootverzeichnis
 
 
  root@xinux-desktop:~# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/
 
  root@xinux-desktop:~# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/
  
Zeile 78: Zeile 59:
 
  root@xinux-desktop:~# debootstrap intrepid /pxeroot
 
  root@xinux-desktop:~# debootstrap intrepid /pxeroot
  
===DHCP auf für Client aktivieren===
+
 
* /pxeroot/etc/network/interfaces
 
auto eth0
 
iface eth0 inet dhcp
 
  
 
===Hostname setzen===
 
===Hostname setzen===
Zeile 97: Zeile 75:
 
  ff02::2 ip6-allrouters
 
  ff02::2 ip6-allrouters
 
  ff02::3 ip6-allhosts
 
  ff02::3 ip6-allhosts
:wq zum Speichern und Beenden
+
Escape :wq zum Speichern und Beenden
  
 
===fstab anpassen===
 
===fstab anpassen===
  # <file system> <mount point>  <type> <options>       <dump>  <pass>
+
  /dev/ram0 /       ext2  defaults    0  0
 
  proc            /proc          proc    defaults        0      0
 
  proc            /proc          proc    defaults        0      0
/dev/ram0  /      ext2  defaults    0  0
 
 
  tmpfs      /tmp      tmpfs  defaults    0  0
 
  tmpfs      /tmp      tmpfs  defaults    0  0
  
Zeile 115: Zeile 92:
 
Ramdisk auf NFS anpassen
 
Ramdisk auf NFS anpassen
 
  xinux-desktop:/# sed -i.bak -e "s/BOOT=local/BOOT=nfs/" /etc/initramfs-tools/initramfs.conf
 
  xinux-desktop:/# sed -i.bak -e "s/BOOT=local/BOOT=nfs/" /etc/initramfs-tools/initramfs.conf
 +
xinux-desktop:/# sed -i.bak -e "s/MODULES=most/MODULES=netboot/" /etc/initramfs-tools/initramfs.conf
 
  xinux-desktop:/#update-initramfs -vu  
 
  xinux-desktop:/#update-initramfs -vu  
  
  
Locales installieren und de_DE@euro ISO-8859-15  als Spracheinstellung auswählen
+
Tastatur einstellen
  xinux-desktop:/# apt-get install locales
+
  xinux-desktop:/# dpkg-reconfigure keyboard-configuration
  xinux-desktop:/# dpkg-reconfigure locales
+
Passwort setzen
 
+
  xinux-desktop:/# passwd
 
 
 
  exit
 
  exit
  
===DHCP-Server konfigurieren===
+
==mit NFS==
subnet 192.168.242.0 netmask 255.255.255.0 {
 
        range 192.168.242.170 192.168.242.180;
 
        default-lease-time 600;
 
        max-lease-time 7200;
 
        #option domain-name "gamma.intern";
 
        option domain-name-servers 192.168.240.21;
 
        option broadcast-address 192.168.242.255;
 
        option subnet-mask 255.255.255.0;
 
         
 
        host pxeclient {
 
                hardware ethernet 00:0c:29:99:25:91;
 
                fixed-address 192.168.242.171;
 
                option host-name "pxeclient";
 
                next-server 192.168.242.140;
 
                filename "/pxelinux.0";
 
                option root-path "192.168.242.140:/pxeroot";
 
        }
 
}
 
 
 
Anschließend neustarten
 
root@xinux-desktop:~# /etc/init.d/dhcp-server restart
 
 
 
===TFTP Server konfigurieren===
 
* /etc/default/tftpd-hpa
 
RUN_DAEMON="yes"
 
OPTIONS="-l -s /var/lib/tftpboot"
 
 
 
Neustarten
 
/root@xinux-desktop:~# etc/init.d/tftpd-hpa restart
 
 
 
 
===PXE boot konfigurieren===
 
===PXE boot konfigurieren===
 
  root@xinux-desktop:~# cd /var/lib/tftpboot
 
  root@xinux-desktop:~# cd /var/lib/tftpboot
  root@xinux-desktop:~# wget http://ftp.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/pxelinux.0
+
  root@xinux-desktop:~# cp /pxeroot/vmlinuz .
  root@xinux-desktop:~# cp /pxeroot/vmlinuz ./
+
  root@xinux-desktop:~# chmod 644 vmlinuz  
  root@xinux-desktop:~# cp /pxeroot/initrd.img ./
+
  root@xinux-desktop:~# cp /pxeroot/initrd.img .
 
  root@xinux-desktop:~# mkdir pxelinux.cfg
 
  root@xinux-desktop:~# mkdir pxelinux.cfg
 
  root@xinux-desktop:~# vim pxelinux.cfg/default
 
  root@xinux-desktop:~# vim pxelinux.cfg/default
Zeile 166: Zeile 113:
 
* /var/lib/tftpboot/pxelinux.cfg/default
 
* /var/lib/tftpboot/pxelinux.cfg/default
 
  DEFAULT linux
 
  DEFAULT linux
 
 
  LABEL linux
 
  LABEL linux
 
     kernel vmlinuz
 
     kernel vmlinuz
     append vga=normal initrd=initrd.img ramdisk_size=14332 root=/dev/nfs nfsroot=192.168.242.140:/pxeroot rw --
+
     append vga=normal initrd=initrd.img ramdisk_size=14332 root=/dev/nfs nfsroot=192.168.242.140:/pxeroot ip=dhcp rw --
 
 
  PROMPT 0
 
  PROMPT 0
  TIIMEOUT 0
+
  TIMEOUT 0
  
 
===nfs server konfigurieren===
 
===nfs server konfigurieren===
Zeile 181: Zeile 126:
 
Neustarten
 
Neustarten
 
  /etc/init.d/nfs-kernel-server restart
 
  /etc/init.d/nfs-kernel-server restart
 +
 +
==mit RAMdisk==
 +
*[[PXE mit Ramdisk]]
  
 
=Quellen=
 
=Quellen=

Aktuelle Version vom 15. Februar 2023, 17:17 Uhr

Ldee

Mit PXELinux kann man ein System über ein Netzwerk booten oder auch installieren.

Installation tftp-Server

Installation DHCP-Server

root@xinux-desktop:~# apt-get install dhcp3-server

Anpassen der dhcpd.conf

  • /etc/dhcp3/dhcpd.conf
subnet 192.168.242.0 netmask 255.255.255.0 {
      range 192.168.242.170 192.168.242.180;
      default-lease-time 600;
      max-lease-time 7200;
      option domain-name-servers 192.168.240.21;
      option broadcast-address 192.168.242.255;
      option subnet-mask 255.255.255.0;
      filename "/pxelinux.0";
      next-server 192.168.242.140;
      option root-path "192.168.242.140:/pxeroot";
  
      host pxeclient {
              hardware ethernet 00:0c:29:99:25:91;
              fixed-address 192.168.242.171;
              option host-name "pxeclient";
      }
}

Starten

root@xinux-desktop:~# /etc/init.d/dhcp3-server start

Stoppen

root@xinux-desktop:~# /etc/init.d/dhcp3-server stop

Neustarten

root@xinux-desktop:~# /etc/init.d/dhcp3-server restart

Kontrolle

root@xinux-desktop:~# netstat -nplu | grep 67
udp        0      0 0.0.0.0:67              0.0.0.0:*                           3515/dhcpd3

Bootimage vorbereiten

root@xinux-desktop:~# apt-get install syslinux
root@xinux-desktop:~# cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/

PXELinux mit debootstrap

Minimales virtuelles System erstellen

Installation von debootstrap

root@xinux-desktop:~# apt-get install debootstrap

Debian

root@xinux-desktop:~# mkdir /pxeroot
root@xinux-desktop:~# cd /pxeroot
root@xinux-desktop:~# debootstrap etch /pxeroot

Ubuntu

root@xinux-desktop:~# mkdir /pxeroot
root@xinux-desktop:~# cd /pxeroot
root@xinux-desktop:~# debootstrap intrepid /pxeroot


Hostname setzen

root@xinux-desktop:~# echo pxeboot > /pxeroot/etc/hostname
root@xinux-desktop:~# cp /etc/hosts /pxeroot/etc/hosts
root@xinux-desktop:~# vi /pxeroot/etc/hosts
127.0.0.1       localhost pxeboot

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

Escape :wq zum Speichern und Beenden

fstab anpassen

/dev/ram0  /       ext2   defaults    0   0
proc            /proc           proc    defaults        0       0
tmpfs      /tmp       tmpfs  defaults    0   0

Virtuelles System anpassen

root@xinux-desktop:/pxeroot/etc# chroot /pxeroot

Kernel installieren

xinux-desktop:/# apt-get install linux-image

Die Warnung, dass keine Bootloader installiert sind, kann ignoriert werden. Wenn das Skript fragt, ob abgebrochen werden soll mit no antworten.

Ramdisk auf NFS anpassen

xinux-desktop:/# sed -i.bak -e "s/BOOT=local/BOOT=nfs/" /etc/initramfs-tools/initramfs.conf
xinux-desktop:/# sed -i.bak -e "s/MODULES=most/MODULES=netboot/" /etc/initramfs-tools/initramfs.conf
xinux-desktop:/#update-initramfs -vu 


Tastatur einstellen

xinux-desktop:/# dpkg-reconfigure keyboard-configuration

Passwort setzen

xinux-desktop:/# passwd 
exit

mit NFS

PXE boot konfigurieren

root@xinux-desktop:~# cd /var/lib/tftpboot
root@xinux-desktop:~# cp /pxeroot/vmlinuz .
root@xinux-desktop:~# chmod 644 vmlinuz 
root@xinux-desktop:~# cp /pxeroot/initrd.img .
root@xinux-desktop:~# mkdir pxelinux.cfg
root@xinux-desktop:~# vim pxelinux.cfg/default

  • /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT linux
LABEL linux
    kernel vmlinuz
    append vga=normal initrd=initrd.img ramdisk_size=14332 root=/dev/nfs nfsroot=192.168.242.140:/pxeroot ip=dhcp rw --
PROMPT 0
TIMEOUT 0

nfs server konfigurieren

root@xinux-desktop:~# apt-get install nfs-kernel-server
  • /etc/exports
/pxeroot    192.168.0.0/255.255.0.0(rw,sync,no_root_squash,no_subtree_check)

Neustarten

/etc/init.d/nfs-kernel-server restart

mit RAMdisk

Quellen

http://www.pieczewski.de/?page_id=51

http://forum.ubuntuusers.de/topic/pxe-image-bauen/

http://www.howtoforge.com/pxe_booting_debian