step by step configure pxeboot server in Ubuntu | PXE network boot server

Linuxtopic
1




PXE stand for Preboot eXecution Environment it works on Client-Server architecture and allows unattended or automated OS installation over the Network



Point to be noted :



This PXE Boot server configuration in Ubuntu 16.4,  

PXE network boot server with Configure dnsmasq with DHCP and dnsmasq without dhcp,

pxe boot server we add centos 7 boot entry in default pxelinux.cfg directory via NFS and http, 

We configure pxe boot with clonezilla iso and zip

CentOS iso pxeboot entry, Installing CentOS, Debian using network booting





Server IP = 172.17.199.199


Host name = pxeboot.linuxtopic.com


OS = Ubuntu 16



Video Tutorial in English :









Step 1:




Network Configure




vi  /etc/network/interfaces




auto eth0


iface eth0 inet static


       address 172.17.199.199


       netmask 255.255.0.0


    gateway 172.17.0.1




Note : Reboot DVC for network change




Step 2:





Install required packages





apt-get install pxelinux syslinux dnsmasq




Step 3:





Configure dnsmasq as existing dhcp on network





cp /etc/dnsmasq.conf /etc/dnsmasq.conf-bk




Option 1 :  Configure dnsmasq as existing dhcp on network




vi /etc/dnsmasq.conf




# DNS Options


port=0


interface=eth0,lo






# DHCP Options


dhcp-range=172.17.0.1,proxy


dhcp-option=vendor:PXEClient,6,2b


dhcp-no-override






# PXE


dhcp-boot=pxelinux.0






#pxe-prompt="Press F8 for menu.", 10


pxe-service=X86PC, "www.linuxtopic.com", pxelinux






# TFTP Options


enable-tftp


tftp-root=/var/lib/tftpboot




configure pxe boot server, clonezilla, pxeboot server, network boot, network booting, pxe, boot from network, boot on network, network boot linux, network boot server, network boot windows 10, network boot ubuntu, network boot windows 7, network boot windows 7 diskless, how does pxe boot work, pxe boot server windows




Option 2 :  Configure dnsmasq with dhcp server




# DNS Options


port=0


interface=eth0,lo






# DHCP range-leases


dhcp-range= eth0,172.17.199.200,172.17.199.250,255.255.0.0,1h


# Gateway


dhcp-option=3,172.17.199.199


# DNS


dhcp-option=6,172.17.199.199, 8.8.8.8


# Broadcast Address


dhcp-option=28,172.17.255.255


# NTP Server


dhcp-option=42,0.0.0.0






# PXE


dhcp-boot=pxelinux.0


pxe-service=x86PC, "Linuxtopic.com", pxelinux






# Enable TFTP


enable-tftp


tftp-root=/var/lib/tftpboot




configure pxe boot server, clonezilla, pxeboot server, network boot, network booting, pxe, boot from network, boot on network, network boot linux, network boot server, network boot windows 10, network boot ubuntu, network boot windows 7, network boot windows 7 diskless, how does pxe boot work, pxe boot server windows






Explain :






port=0   -  disable dns


interface=eth0,lo   - Interfaces that the server should listen and provide services






dhcp-rang=172.17.20.100,proxy   -  existing dhcp server ip  


OR


dhcp-range= eth0,172.17.199.200,172.17.199.250,255.255.0.0,1h  - Dhcp IP Range


dhcp-option=3,172.17.199.199  - define gateway


dhcp-option=6,172.17.199.199, 8.8.8.8  - Define DNS


dhcp-option=28,172.17.255.255  - Broadcast Address


dhcp-option=42,0.0.0.0 - NTP Server






dhcp-option=vendor:PXEClient,6,2b    - download the boot file immediately by disable multicast and broadcast discovery.


dhcp-boot=pxelinux.0    -


pxe-service=X86PC, "www.linuxtopic.com", pxelinux    -  Use x86PC for 32-bit/64-bit architectures and enter a menu description prompt under string quotes. Other values types can be: Intel_Lean_Client, IA32_EFI, _EFI, Alpha, Arc_x86, BC_EFI, Xscale_EFI and X86-64_EFI, PC98, IA64


enable-tftp    -  Enables the build-in TFTP server.


tftp-root=/var/lib/tftpboot   -  the location for all netbooting files.






Step 4:





Create tftpboot directory and copy required file




mkdir /var/lib/tftpbootmkdir /var/lib/tftpboot/pxelinux.cfg




cp /usr/lib/PXELINUX/pxelinux.0 /var/lib/tftpboot/




cp /usr/lib/syslinux/modules/bios/menu.c32 /var/lib/tftpboot/




cp /usr/lib/syslinux/modules/bios/ldlinux.c32 /var/lib/tftpboot/




cp /usr/lib/syslinux/modules/bios/libmenu.c32 /var/lib/tftpboot/




cp /usr/lib/syslinux/modules/bios/libutil.c32 /var/lib/tftpboot/




cp /usr/lib/syslinux/modules/bios/libcom32.c32 /var/lib/tftpboot/




cp /usr/lib/syslinux/modules/bios/vesamenu.c32 /var/lib/tftpboot/








ls -l /var/lib/tftpboot/








Step 4:





Create default  file and add menu entry




vi /var/lib/tftpboot/pxelinux.cfg/default




default vesamenu.c32


prompt 0


timeout 50






# Local Hard Disk pxelinux.cfg default entry


LABEL 1


   MENU LABEL ^1) Boot local hard drive


   MENU AUTOBOOT


   MENU DEFAULT


   LOCALBOOT 0




configure pxe boot server, clonezilla, pxeboot server, network boot, network booting, pxe, boot from network, boot on network, network boot linux, network boot server, network boot windows 10, network boot ubuntu, network boot windows 7, network boot windows 7 diskless, how does pxe boot work, pxe boot server windows





Step 5:  





Download Clonezilla zip File from official website and extract




https://clonezilla.org/downloads/download.php?branch=stable









Create Directory and Copy clonezilla zip




mkdir /var/lib/tftpboot/clonezilla
cd  /var/lib/tftpboot/clonezilla
unzip clonezilla-live-2.5.5-38-amd64.zip




Step 6:





Create PXE Boot Entry for Image





vi /tftpboot/pxelinux.cfg/default




default vesamenu.c32


prompt 0


timeout 50






# Local Hard Disk pxelinux.cfg default entry


LABEL 1


MENU LABEL ^1) Boot local hard drive


MENU AUTOBOOT


MENU DEFAULT


LOCALBOOT 0






# Clonezilla pxelinux.cfg default entry


LABEL 2


   MENU LABEL ^2) Clonezilla Live


   KERNEL clonezilla/live/vmlinuz


   APPEND ramdisk_size=32768 initrd=clonezilla/live/initrd.img boot=live union=overlay username=user config components noswap edd=on nomodeset noeject locales=en_US.UTF-8 keyboard-layouts=NONE net.ifnames=0 ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash  fetch=tftp://172.17.199.199/clonezilla/live/filesystem.squashfs


# CentOS 7 pxelinux.cfg default entry


LABEL 3


   MENU LABEL ^3) Install CentOS 7 - NFS


   kernel data/centos7_64Bit/images/pxeboot/vmlinuz


   append initrd=data/centos7_64Bit/images/pxeboot/initrd.img inst.stage2=nfs:172.17.199.199:/var/lib/tftpboot/data/centos7_64Bit quiet






# CentOS 7 pxelinux.cfg default entry


LABEL 4


   MENU LABEL ^4) Install CentOS 7 - HTTP


   KERNEL data/centos7_64Bit/images/pxeboot/vmlinuz


   APPEND initrd=data/centos7_64Bit/images/pxeboot/initrd.img method=http://172.17.199.199/pxeboot/centos7_64Bit devfs=nomount




configure pxe boot server, clonezilla, pxeboot server, network boot, network booting, pxe, boot from network, boot on network, network boot linux, network boot server, network boot windows 10, network boot ubuntu, network boot windows 7, network boot windows 7 diskless, how does pxe boot work, pxe boot server windows




Optional Step 7:





Boot From Clonezilla ISO




Download clonezilla iso file   from https://clonezilla.org/downloads.php




cd /var/lib/tftpboot/


wget https://gensho.ftp.acc.umu.se/mirror/osdn.net/clonezilla/69273/clonezilla-live-2.5.5-38-amd64.iso -O clonezilla2.5.iso







Add Following Entry in default 


vi /tftpboot/pxelinux.cfg/default

# Clonezilla ISO pxelinux.cfg default entry



LABEL 5
MENU LABEL ^5) Clonezilla Live from ISO
root (hd0,0)
kernel memdisk
append iso initrd=clonezilla-live-2.5.0-5-amd64.iso raw



configure pxe boot server, clonezilla, pxeboot server, network boot, network booting, pxe, boot from network, boot on network, network boot linux, network boot server, network boot windows 10, network boot ubuntu, network boot windows 7, network boot windows 7 diskless, how does pxe boot work, pxe boot server windows





Step 8: 





Restart dnsmasq service and flush iptables


systemctl restart dnsmasq

Iptables -F



Your Server is Ready Now you can Boot client from LAN by select first boot device “Network” in BIOS Setting








Post a Comment

1Comments

  1. Hi, this post was so useful.
    I tried to simulate this structure, but I had a problem. When I try to install a Debian 10, after the client starts the installation, the client prompt aks for a installation media. I tried all initrd and kernel images, but it doesn't work. What could be the problem? Am I missing some argument?

    ReplyDelete
Post a Comment

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!