使用kali作为服务器
1 安装dnsmasq
# apt update
# apt-get install dnsmasq -y
2 编辑dnsmasq配置文件
# vi /etc/dnsmasq.conf
# Network interface to handle;指定网络接口
interface=eth0
# DHCP options;DHCP选项
# IP range to allocate;分配的IP范围
dhcp-range=192.168.101.100,192.168.101.200,12h
# Gateway to announce to clients;指定网关
dhcp-option=option:router,192.168.101.1
# DNS servers to announce to clients;DNS服务器
dhcp-option=option:dns-server,8.8.8.8,8.8.4.4
# Boot file to announce to clients;使用dnsmasq内置的TFTP服务,以及指定引导文件
dhcp-boot=pxelinux.0
# TFTP options ;TFTP选项
enable-tftp
# Directory hosting files to serve ;TFTP文件目录
tftp-root=/tftpboot/
3 下载引导文件指tftp目录
# mkdir /tftpboot
# cd /tftpboot
# wget http://http.kali.org/dists/kali-rolling/main/installer-amd64/current/images/netboot/gtk/netboot.tar.gz
# tar xf netboot.tar.gz
# ls -l
4 启动dnsmasq
systemctl start dnsmasq.service
5 配置计算机的PXE
在计算机BIOS中配置PXE;开机后自动加载服务器中的kali安装程序
#该方法基于网络下载系统资源,要确保DHCP配置无误以及网络可用
可以使用web服务器发布预设文件来完成自动安装,文档:https://kali.training/4-installing-kali-linux/unattended-installations/