DHCP Server config:
/etc/dhcp/dhcpd.conf
:
allow booting;
allow bootp;
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;
option routers 10.0.0.1;
ddns-update-style none;
use-host-decl-names on;
option domain-name-servers 194.204.159.1, 194.204.152.34;
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 194.204.159.1, 194.204.152.34;
#Range of IPs to dynamically assign. Optional.
range 10.0.0.240 10.0.0.245 ;
default-lease-time 120;
max-lease-time 120;
#Next line should be whatever server hosts PXE files.
#Uncomment next line for TFTP running in chrooted environment.
filename "pxelinux.0";
#Uncomment next line for TFTP running not in chroot environment.
#filename "/var/lib/tftpboot/pxelinux.0";
group {
host new_host {
hardware ethernet 08:00:27:07:80:FE;
option routers 10.0.0.1;
fixed-address 10.0.0.241;
}
}
#end optional part
}
Set the interfaces that you want to use in /etc/default/isc-dhcp-server
:
...
INTERFACES="eth1"
...
TFTP Server config:
apt-get install tftpd-hpa
/etc/default/tftpd-hpa:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="10.0.0.1:69"
TFTP_OPTIONS="--secure"
Here is a tree of tftp folder:
/srv/tftp
├── initrd.img-3.13-0.bpo.1-amd64
├── initrd.img-3.2.0-4-amd64
├── install.img
├── mboot.c32
├── menu.c32
├── pxelinux.0
├── pxelinux.cfg
│ ├── 01-08-00-27-07-80-fe
│ └── default
├── vmlinuz
├── vmlinuz-3.13-0.bpo.1-amd64
├── vmlinuz-3.2.0-4-amd64
└── xen.gz
Example config /srv/tftp/pxelinux.cfg/default
:
#default Debian
default menu.c32
menu title Boot Menu
prompt 10
timeout 10
label Debian
kernel vmlinuz-3.13-0.bpo.1-amd64
append rw initrd=initrd.img-3.13-0.bpo.1-amd64 root=/dev/nfs ip=dhcp nfsroot=10.0.0.1:/srv/nfsroot_generic
label XenServer
menu label XenServer
kernel mboot.c32
#append xen.gz -- vmlinuz ip=dhcp root=/dev/nfs nfsmount=10.0.0.1:/srv/iso/ iso_filename=XenServer-6.2.0-install-cd.iso
append xen.gz dom0_max_vcpus=4 dom0_mem=1024M console=vga --- vmlinuz xencons=hvc console=hvc0 console=tty0 answerfile=http://10.0.0.1/file.xml install --- install.img