Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Setting up a Ubuntu server to serve as a DHCP server with PXE boot support using TFTP

involves several steps. Here's a basic guide to get you started:

1. Install Required Packages:


DHCP server: sudo apt-get install isc-dhcp-server
TFTP server: sudo apt-get install tftpd-hpa
2. Configure DHCP Server:
Edit the DHCP server configuration file:

sudo nano /etc/dhcp/dhcpd.conf

Add the following configuration (modify according to your network settings):

subnet 192.168.1.0 netmask 255.255.255.0 {


range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
option domain-name-servers 8.8.8.8;
option domain-name "example.com";
filename "pxelinux.0";
next-server 192.168.1.10; # IP address of your TFTP server
}

Save and exit the file.


3. Configure TFTP Server:
Edit the TFTP server configuration file:

sudo nano /etc/default/tftpd-hpa

Modify the TFTP_DIRECTORY variable to specify the TFTP root directory:

TFTP_DIRECTORY="/var/lib/tftpboot"

Save and exit the file.


4. Create TFTP Boot Directory:
Create the TFTP root directory and make it writable:
sudo mkdir /var/lib/tftpboot
sudo chmod -R 777 /var/lib/tftpboot

Copy necessary PXE boot files into this directory. You can find these files in the
syslinux package:

sudo apt-get install syslinux pxelinux


sudo cp /usr/lib/PXELINUX/pxelinux.0 /var/lib/tftpboot/
sudo cp /usr/lib/syslinux/modules/bios/ldlinux.c32
/var/lib/tftpboot/
sudo cp /usr/lib/syslinux/modules/bios/menu.c32 /var/lib/tftpboot/

Create a directory for your PXE boot menu and configuration files:

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

Create a directory for your PXE boot menu and configuration files:

sudo chmod -R 777 /var/lib/tftpboot

5. Start and Enable Services:


Start and enable the DHCP server:

sudo systemctl start isc-dhcp-server


sudo systemctl enable isc-dhcp-server

Start and enable the TFTP server:

sudo systemctl start tftpd-hpa


sudo systemctl enable tftpd-hpa

6. Firewall Configuration:
If you have a firewall enabled (e.g., UFW), make sure to allow DHCP and TFTP
traffic:
sudo ufw allow in on <interface> from any port 67,69 to any port
68,50000:60000 proto udp

Replace <interface> with your network interface name.


7. Test PXE Boot:
Connect a client to the network and set it to boot from PXE.
The client should receive an IP address from the DHCP server and boot into the PXE
menu.

This is a basic setup to get you started. Depending on your specific requirements and network
setup, you may need to adjust configurations accordingly.

You might also like