SYSLINUX PXELINUX ETC

From Hack Sphere Labs Wiki
Revision as of 12:29, 1 August 2014 by Webdawg (talk | contribs) (file structure=)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
nano /etc/default/tftp<tab>

Add -v to see verbose in daemon.log



DRBL

dhcpd.conf and default file

Files needed for DRBL pxelinux testing 4.05

/bios/core/pxelinux.0 -> nbi_img
/bios/com32/chain/chain.c32 -> nbi_img/bios/
/bios/com32/hdt/hdt.c32 -> nbi_img/bios/
/bios/core/isolinux.bin -> nbi_img/bios/
/bios/com32/mboot/mboot.c32 -> nbi_img/bios/
/bios/mbr/mbr.bin -> nbi_img/bios/
/bios/memdisk/memdisk -> nbi_img/bios/
/bios/com32/menu/menu.c32 -> nbi_img/bios/
/bios/com32/modules/sanboot.c32 -> nbi_img/bios/
/bios/com32/menu/vesamenu.c32 -> nbi_img/bios/

script generated (run from root syslinux dir extracted)

mkdir nbi_img
mkdir nbi_img/bios
cp bios/core/pxelinux.0 nbi_img/
cp bios/com32/chain/chain.c32 nbi_img/bios/
cp bios/com32/hdt/hdt.c32 nbi_img/bios/
cp bios/core/isolinux.bin nbi_img/bios/
cp bios/com32/mboot/mboot.c32 nbi_img/bios/
cp bios/mbr/mbr.bin nbi_img/bios/
cp bios/memdisk/memdisk nbi_img/bios/
cp bios/com32/menu/menu.c32 nbi_img/bios/
cp bios/com32/modules/sanboot.c32 nbi_img/bios/
cp bios/com32/menu/vesamenu.c32 nbi_img/bios/

Files needed for DRBL pxelinux testing 6.03-pre18

nbi_img/pxelinux.cfg/default

The

PATH bios/

Is pretty important!

full default


# Created by generate-pxe-menu! Do NOT edit unless you know what you are doing! 
# Keep those comment "MENU DEFAULT" and "MENU HIDE"! Do NOT remove them.
# Note!!! If "serial" directive exists, it must be the first directive

default vesamenu.c32
timeout 5
prompt 0
noescape 1
MENU MARGIN 5
MENU BACKGROUND drblwp.png
# Set the color for unselected menu item and timout message
MENU COLOR UNSEL 7;32;41 #c0000090 #00000000
MENU COLOR TIMEOUT_MSG 7;32;41 #c0000090 #00000000
MENU COLOR TIMEOUT 7;32;41 #c0000090 #00000000
MENU COLOR HELP 7;32;41 #c0000090 #00000000

# MENU MASTER PASSWD

say **********************************************
say Welcome to DRBL.
say NCHC Free Software Labs, Taiwan.
say http://drbl.nchc.org.tw; http://drbl.sf.net
say **********************************************

# Allow client to edit boot parameters
ALLOWOPTIONS 1

PATH bios/

# simple menu title
MENU TITLE DRBL (http://drbl.nchc.org.tw, http://drbl.sf.net)

label drbl
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Debian 7.0 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: 2.3.12-drbl1. (C) 2003-2013, NCHC, Taiwan
  * Disclaimer: DRBL comes with ABSOLUTELY NO WARRANTY
  ENDTEXT

label clonezilla
  MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla: multicast restore AnImage to disk sda
  # MENU PASSWD
  kernel vmlinuz-pxe
  append initrd=initrd-pxe.img devfs=nomount drblthincli=off selinux=0 text 1     clientdir=node_root ocs_opt="-l en_US.UTF-8  -g auto -e1 auto -e2 -r --clone-hidden-data -p true --mcast-port 2232 multicast_restoredisk E5510.V1.WIN7.BAREBASE-SES sda"
  TEXT HELP
  * Clonezilla version: 3.3.10-drbl1. (C) 2003-2013, NCHC, Taiwan
  * Disclaimer: Clonezilla comes with ABSOLUTELY NO WARRANTY
  ENDTEXT

label local
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Local operating system (if available)
  # MENU PASSWD
  # 2 method to boot local device:
  # (1) For localboot 0, it is decided by boot order in BIOS, so uncomment the follow 1 line if you want this method:
  # localboot 0

  # (2) For chain.c32, you can assign the boot device.
  # Ref: extlinux.doc from syslinux
  # Syntax: APPEND [hd|fd]<number> [<partition>]
  # [<partition>] is optional.
  # Ex:
  # Second partition (2) on the first hard disk (hd0);
  # Linux would *typically* call this /dev/hda2 or /dev/sda2, then it's "APPEND hd0 2"
  #
  kernel chain.c32
  append hd0
  TEXT HELP
  Boot local OS from first hard disk if it's available
  ENDTEXT

# Note! *.bin is specially purpose for syslinux, 
# Do NOT use memtest86.bin, use memtest86 instead of memtest86.bin
label memtest
  # MENU DEFAULT
  MENU HIDE
  MENU LABEL Memory test using Memtest86+
  # MENU PASSWD
  kernel memtest86
  TEXT HELP
  Run memory test using Memtest86+ Memtest86 v4.20
  ENDTEXT

# ref: http://syslinux.zytor.com/memdisk.php
label fdos
  # MENU DEFAULT
  MENU HIDE
  MENU LABEL FreeDOS
  # MENU PASSWD
  kernel memdisk
  append initrd=fdos1440_drbl.img
  TEXT HELP
  Run FreeDOS
  ENDTEXT

label drbl-terminal
  # MENU DEFAULT
  MENU HIDE
  MENU LABEL Debian 7.0 Linux (Terminal mode, mostly remote resources)
  # MENU PASSWD
  kernel vmlinuz-pxe
  append initrd=initrd-pxe.img devfs=nomount drblthincli=on
  TEXT HELP
  Run DRBL in terminal mode.
  ENDTEXT

# Example for AoE booting
label AoE-client
  # MENU DEFAULT
  MENU HIDE
  MENU LABEL Diskless client (AoE booting)
  # MENU PASSWD
  kernel sanboot.c32
  append aoe:e0.0
  TEXT HELP
  Boot from AoE device
  ENDTEXT

# Example for Xen client. ///NOTE/// You might have to copy the required file, e.g. xen-3.0.3-1-i386-pae.gz in this case, from /boot to /tftpboot/nbi_img manually.
# label Xen client
  # MENU DEFAULT
#   MENU HIDE
#   MENU LABEL Xen client 
#   # MENU PASSWD
#   kernel mboot.c32
#   append xen-3.0.3-1-i386-pae.gz --- vmlinuz-2.6.18-6-xen-vserver-686 root=/dev/sda1 ro console=tty0 --- initrd-pxe.2.6.18-6-xen-vserver-686.img
#   TEXT HELP
#   DRBL client running on Xen kernel
#   ENDTEXT

# Example for Clonezilla live PXE booting
# //NOTE// Remember to change the file names to match your files and check parameters in syslinux/syslinux.cfg from the zip file, copy them to here. It might be different from here, say vmlinuz1 path maybe different.
#label Clonezilla Live
  # MENU DEFAULT
#  MENU HIDE
#  MENU LABEL Clonezilla Live
#  # MENU PASSWD
#  kernel vmlinuz1
#  append initrd=initrd1.img boot=live union=aufs noswap noprompt nolocales ip=frommedia vga=788 fetch=tftp://$YOUR_SERVER_IP/filesystem.squashfs
#  TEXT HELP
#  Boot Clonezilla live via network
#  ENDTEXT


# Example for GParted live PXE booting
# //NOTE// Remember to change the file names to match your files and check parameters in syslinux/syslinux.cfg from the zip file, copy them to here. It might be different from here, say vmlinuz1 path maybe different.
#label GParted Live
  # MENU DEFAULT
#  MENU HIDE
#  MENU LABEL GParted Live
#  # MENU PASSWD
#  kernel vmlinuz1
#  append initrd=initrd1.img boot=live union=aufs noswap noprompt ip=frommedia vga=788 fetch=tftp://$YOUR_SERVER_IP/filesystem.squashfs
#  TEXT HELP
#  Boot GParted live via network
#  ENDTEXT

dhcpd.conf




# 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  		192.168.199.1;
option domain-name			"nettdomain";	
ddns-update-style                       none;
server-name 				drbl;

allow booting;
allow bootp;
    
option arch code 93 = unsigned integer 16;
option space pxelinux;
option pxelinux.magic      code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;

#filename = "pxelinux.0";
site-option-space "pxelinux";
if exists dhcp-parameter-request-list {
    # Always send the PXELINUX options (specified in hexadecimal)
    option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
}
if option arch = 00:06 {
    filename "bootia32.efi";
    # option pxelinux.configfile "pxelinux.cfg/efi32";
} else if option arch = 00:07 {
    filename "bootx64.efi";
    # option pxelinux.configfile "pxelinux.cfg/efi64";
} else {
    filename "pxelinux.0";
    # option pxelinux.configfile "pxelinux.cfg/bios";
}

## 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 {
#         # sis900.zpxe is specially for sis900 NIC, you can download it from 
#         # http://rom-o-matic.net/etherboot/etherboot-5.4.4/contrib/rom-o-matic
#         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"),
#        " - ",
#        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 'allow 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.199.0 netmask 255.255.255.0 {
    option subnet-mask	255.255.255.0;
    option routers 192.168.199.1;
    next-server 192.168.199.1;

    pool {
      # allow members of "DRBL-Client";
      range 192.168.199.100 192.168.199.199;
    }
}

file structure

nbi_img/gpxelinux.0
nbi_img/ldlinux.c32
nbi_img/ldlinux.e32
nbi_img/ldlinux.e64
nbi_img/mboot.c32
nbi_img/memdisk
nbi_img/memtest86
nbi_img/pxelinux.0
nbi_img/bios/chain.c32
nbi_img/bios/hdt.c32
nbi_img/bios/isolinux.bin
nbi_img/bios/libcom32.c32
nbi_img/bios/libutil.c32
nbi_img/bios/mboot.c32
nbi_img/bios/mbr.bin
nbi_img/bios/memdisk
nbi_img/bios/menu.c32
nbi_img/bios/sanboot.c32
nbi_img/bios/vesamenu.c32 
/bios/com32/elflink/ldlinux/ldlinux.c32
/bios/com32/elflink/ldlinux/ldlinux.elf
/bios/com32/lib/libcom32.elf
/bios/com32/lib/libcom32.c32