For setting up PXE Server, you need to install dnsmasq to provide the DHCP/TFTP server and to edit the dnsmasq.conf file.
Run the following command:
kali@kali:~$ sudo apt install -y dnsmasq
...
kali@kali:~$
kali@kali:~$ sudo vim /etc/dnsmasq.conf
kali@kali:~$
In dnsmasq.conf, enable DHCP, TFTP and PXE booting and set the dhcp-range to match your environment( for example, 195.154.144.100-200).
You can also define your gateway and DNS servers with the dhcp-option directive as shown below(if needed):
interface=eth0
dhcp-range=195.154.144.100,195.154.144.200,12h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/tftpboot/
dhcp-option=3,195.154.144.1
dhcp-option=6,8.8.8.8,8.8.4.4
The dnsmasq service requires to be restarted for the changes to take effect. For this, run the following command:
kali@kali:~$ sudo systemctl restart dnsmasq
kali@kali:~$
Then, create a directory to hold the Kali Linux Netboot image and download the image, that wants to serve. Use the below-given command:
kali@kali:~$ sudo mkdir -p /tftpboot/
kali@kali:~$
# 64-bit:
kali@kali:~$ sudo wget http://http.kali.org/kali/dists/kali-rolling/main/installer-amd64/current/images/netboot/netboot.tar.gz -P /tftpboot/
# 32-bit:
kali@kali:~$ sudo wget http://http.kali.org/kali/dists/kali-rolling/main/installer-i386/current/images/netboot/netboot.tar.gz -P /tftpboot/
kali@kali:~$ sudo tar -zxpf /tftpboot/netboot.tar.gz -C /tftpboot
kali@kali:~$
kali@kali:~$ sudo rm -f /tftpboot/netboot.tar.gz
kali@kali:~$
Then, boot the target system and configure it to boot from the network. It should get an IP address from your PXE server and begin booting Kali Linux.
Once it is completed, you can customize your system.