Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Created October 10, 2011 22:20
Show Gist options
  • Save gdamjan/1276752 to your computer and use it in GitHub Desktop.
Save gdamjan/1276752 to your computer and use it in GitHub Desktop.

Revisions

  1. gdamjan revised this gist Dec 3, 2012. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -28,13 +28,13 @@ LABEL arch
    MENU LABEL Arch Linux i686
    LINUX /arch/boot/i686/vmlinuz
    INITRD /arch/boot/i686/archiso.img
    APPEND ip=dhcp checksum=y archiso_http_srv=http://192.168.234.1/ archisobasedir=pxe/arch/
    APPEND ip=dhcp checksum=y archiso_http_srv=http://${pxeserver}/ archisobasedir=pxe/arch/
    # get files from http://mirror.centos.plus.hr/centos/6.3/os/i386/images/pxeboot/
    # put them in /home/tftproot/centos/6.3/i386
    # get files from http://mirror.centos.plus.hr/centos/6.3/os/x86_64/images/pxeboot/
    # put them in /home/tftproot/centos/6.3/x86_64 the same for i386
    LABEL centos6.3
    MENU LABEL Centos 6.3 (32-bit)
    kernel centos/6.3/i386/vmlinuz
    initrd centos/6.3/i386/initrd.im
    kernel /centos/6.3/x86_64/vmlinuz
    initrd /centos/6.3/x86_64/initrd.im
    EOF
  2. gdamjan revised this gist Dec 3, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,7 @@ LABEL arch
    APPEND ip=dhcp checksum=y archiso_http_srv=http://192.168.234.1/ archisobasedir=pxe/arch/
    # get files from http://mirror.centos.plus.hr/centos/6.3/os/i386/images/pxeboot/
    # put them in /home/tftproot/centos/6.3/i386
    LABEL centos6.3
    MENU LABEL Centos 6.3 (32-bit)
    kernel centos/6.3/i386/vmlinuz
  3. gdamjan revised this gist Dec 3, 2012. 2 changed files with 19 additions and 16 deletions.
    33 changes: 18 additions & 15 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,15 @@
    #!/bin/sh

    mkdir /home/tftproot
    # install syslinux from package and symlink it or just download and extract it
    ln -s /usr/lib/syslinux /home/tftproot/syslinux
    ln -s /usr/lib/syslinux/gpxelinux.0 /home/tftproot/pxelinux.0

    mkdir /home/tftproot/pxelinux.cfg

    mkdir /home/tftproot/pxelinux.cfg/

    cat > /home/tftproot/pxelinux.cfg/default <<EOF
    # file names relative to /home/tftproot
    UI syslinux/menu.c32
    UI /syslinux/menu.c32
    TIMEOUT 600
    TOTALTIMEOUT 9000
    ONTIMEOUT localboot 0
    @@ -18,19 +19,21 @@ MENU TITLE PXE netboot server
    LABEL memtest
    MENU LABEL Boot Memtest86+ V4.20
    KERNEL misc/memtest86
    KERNEL /misc/memtest86
    APPEND -
    # get files from http://mirror.yellowfiber.net/archlinux/iso/archboot/latest/boot/
    LABEL archboot
    MENU LABEL ArchBoot
    KERNEL archboot/vmlinuz
    INITRD archboot/initrd.img
    # get files from http://mirror.centos.plus.hr/centos/6.2/os/i386/images/pxeboot/
    LABEL centos6.2
    MENU LABEL Centos 6.2 (32-bit)
    kernel centos/6.2/i386/vmlinuz
    initrd centos/6.2/i386/initrd.im
    # get the official Arch ISO file. Mount it in /mnt/arch then make a symlink
    # /mnt/arch/arch/ <- /home/tftproot/arch/
    LABEL arch
    MENU LABEL Arch Linux i686
    LINUX /arch/boot/i686/vmlinuz
    INITRD /arch/boot/i686/archiso.img
    APPEND ip=dhcp checksum=y archiso_http_srv=http://192.168.234.1/ archisobasedir=pxe/arch/
    # get files from http://mirror.centos.plus.hr/centos/6.3/os/i386/images/pxeboot/
    LABEL centos6.3
    MENU LABEL Centos 6.3 (32-bit)
    kernel centos/6.3/i386/vmlinuz
    initrd centos/6.3/i386/initrd.im
    EOF
    2 changes: 1 addition & 1 deletion run-pxe-server.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ ip link set up dev $LAN

    # start dns, dhcp, tftp, pxe server
    dnsmasq --dhcp-range=${NET}.100,${NET}.200,2h -i $LAN -z -d \
    --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/pxelinux.0
    --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/syslinux/gpxelinux.0


    # setup NAT and enable routing
  4. gdamjan revised this gist Dec 3, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion run-pxe-server.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ ip addr add ${NET}.1/24 dev $LAN
    ip link set up dev $LAN

    # start dns, dhcp, tftp, pxe server
    dnsmasq --dhcp-range=${NET}.100,${NET}.200,2h -d \
    dnsmasq --dhcp-range=${NET}.100,${NET}.200,2h -i $LAN -z -d \
    --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/pxelinux.0


  5. gdamjan revised this gist Dec 3, 2012. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions run-pxe-server.sh
    Original file line number Diff line number Diff line change
    @@ -2,16 +2,17 @@

    WAN=wlan0
    LAN=eth0
    NET=192.168.200
    NET=192.168.234


    # setup LAN network
    ip addr add ${NET}.1/24 dev $LAN
    ip link set up dev $LAN

    # start dns, dhcp, tftp, pxe server
    dnsmasq -d --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/pxelinux.0 \
    --dhcp-range=${NET}.100,${NET}.200,2h
    dnsmasq --dhcp-range=${NET}.100,${NET}.200,2h -d \
    --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/pxelinux.0


    # setup NAT and enable routing
    iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
  6. gdamjan revised this gist May 17, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ LABEL memtest
    # get files from http://mirror.yellowfiber.net/archlinux/iso/archboot/latest/boot/
    LABEL archboot
    MENU LABEL ArchBoot 2k11-R6
    MENU LABEL ArchBoot
    KERNEL archboot/vmlinuz
    INITRD archboot/initrd.img
  7. gdamjan revised this gist May 17, 2012. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -27,10 +27,10 @@ LABEL archboot
    KERNEL archboot/vmlinuz
    INITRD archboot/initrd.img
    # get files from http://mirror.centos.plus.hr/centos/6.0/os/i386/images/pxeboot/
    LABEL centos6.0
    MENU LABEL Centos 6.0 (32-bit)
    kernel centos/6.0/i386/vmlinuz
    initrd centos/6.0/i386/initrd.im
    # get files from http://mirror.centos.plus.hr/centos/6.2/os/i386/images/pxeboot/
    LABEL centos6.2
    MENU LABEL Centos 6.2 (32-bit)
    kernel centos/6.2/i386/vmlinuz
    initrd centos/6.2/i386/initrd.im
    EOF
  8. gdamjan revised this gist Oct 10, 2011. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@ ln -s /usr/lib/syslinux/gpxelinux.0 /home/tftproot/pxelinux.0
    mkdir /home/tftproot/pxelinux.cfg

    cat > /home/tftproot/pxelinux.cfg/default <<EOF
    # file names relative to /home/tftproot
    UI syslinux/menu.c32
    TIMEOUT 600
    TOTALTIMEOUT 9000
    @@ -26,5 +27,10 @@ LABEL archboot
    KERNEL archboot/vmlinuz
    INITRD archboot/initrd.img
    # get files from http://mirror.centos.plus.hr/centos/6.0/os/i386/images/pxeboot/
    LABEL centos6.0
    MENU LABEL Centos 6.0 (32-bit)
    kernel centos/6.0/i386/vmlinuz
    initrd centos/6.0/i386/initrd.im
    EOF
  9. gdamjan revised this gist Oct 10, 2011. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion run-pxe-server.sh
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,15 @@ WAN=wlan0
    LAN=eth0
    NET=192.168.200


    # setup LAN network
    ip addr add ${NET}.1/24 dev $LAN
    ip link set up dev $LAN
    iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE

    # start dns, dhcp, tftp, pxe server
    dnsmasq -d --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/pxelinux.0 \
    --dhcp-range=${NET}.100,${NET}.200,2h

    # setup NAT and enable routing
    iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
    sysctl -w net.ipv4.ip_forward=1
  10. gdamjan revised this gist Oct 10, 2011. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -20,4 +20,11 @@ LABEL memtest
    KERNEL misc/memtest86
    APPEND -
    # get files from http://mirror.yellowfiber.net/archlinux/iso/archboot/latest/boot/
    LABEL archboot
    MENU LABEL ArchBoot 2k11-R6
    KERNEL archboot/vmlinuz
    INITRD archboot/initrd.img
    EOF
  11. gdamjan created this gist Oct 10, 2011.
    23 changes: 23 additions & 0 deletions make-pxe-environment.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/sh

    mkdir /home/tftproot
    ln -s /usr/lib/syslinux /home/tftproot/syslinux
    ln -s /usr/lib/syslinux/gpxelinux.0 /home/tftproot/pxelinux.0

    mkdir /home/tftproot/pxelinux.cfg

    cat > /home/tftproot/pxelinux.cfg/default <<EOF
    UI syslinux/menu.c32
    TIMEOUT 600
    TOTALTIMEOUT 9000
    ONTIMEOUT localboot 0
    PROMPT 0
    MENU TITLE PXE netboot server
    LABEL memtest
    MENU LABEL Boot Memtest86+ V4.20
    KERNEL misc/memtest86
    APPEND -
    EOF
    14 changes: 14 additions & 0 deletions run-pxe-server.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/sh

    WAN=wlan0
    LAN=eth0
    NET=192.168.200

    ip addr add ${NET}.1/24 dev $LAN
    ip link set up dev $LAN
    iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE

    dnsmasq -d --enable-tftp --tftp-root=/home/tftproot/ --dhcp-boot=/pxelinux.0 \
    --dhcp-range=${NET}.100,${NET}.200,2h

    sysctl -w net.ipv4.ip_forward=1