Deploy VMs like never before
As a student of the dark arts of networking, my journey in the wonderful world of technology has taken an unexpected turn. While I typically delve into the intricacies of the TCP/IP stack, VLANs, or spanning tree protocol, recent events in my homelab prompted me to explore a different aspect of IT sorcery. Forced hardware updates due to a disk failure in my main Linux server opened the door to a fascinating solution: commissioning virtual machines (VMs) with unparalleled ease.
"UP is not the same as GOOD,"
as I learned from a recent demonstration of Juniper’s Mist Ai WAP controllers. This insight lingered in my mind as I found myself rescuing a server after a disk failure. Although I managed to revive it through a live install and data transfer, the experience left me yearning for a more efficient solution. Downloading and burning an ISO to a USB drive for server recovery didn't align with the standards of 'GOOD' in my homelab.
In pursuit of a more streamlined process, I embarked on a journey that led me to the world of iPXE servers. By commissioning an iPXE server and configuring my router to forward DHCP options for devices lacking boot configurations, I transformed the tedious task of rescuing servers into a seamless operation. This setup allowed me to download and install new operating systems or deploy recovery utilities over the network. No more fumbling with USB drives—provisioning a new VM is a breeze.
One notable addition to my homelab arsenal is the netboot.xyz Docker container. This ingenious solution serves DHCP options to any machine seeking a boot configuration. The container directs configuration-less machines to a list of downloadable ISOs (and other recovery utilities), enabling them to transition from a blank hard drive to a fully operational computer effortlessly. The days of wrestling with physical boot media are over.
Netboot.xyz Configuration with Docker-Compose
To integrate netboot.xyz into your homelab seamlessly, consider using Docker-Compose. Docker-Compose allows you to define and run multi-container Docker applications using a YAML file. Here's a sample configuration to get you started:
version: '3'
services:
netbootxyz:
image: netbootxyz/netboot.xyz
container_name: netbootxyz
restart: always
ports:
- "67:67/udp"
- "69:69/udp"
- "4011:4011/udp"
environment:
- DHCP_ENABLE=true
- TFTPD_ENABLE=true
- HTTPD_ENABLE=true
- MENU_URL=http://your_custom_menu_url
volumes:
- /path/to/netboot.xyz:/var/lib/tftpboot
Explanation of key parameters:
image: Specifies the Docker image to use from the netboot.xyz repository.
container_name: Names the Docker container for easy identification.
restart: Sets the restart policy to 'always' to ensure the container restarts if it goes down.
ports: Maps the necessary UDP ports for DHCP, TFTP, and HTTP.
environment: Configures various options, enabling DHCP, TFTP, and HTTP services. You can customize the menu URL.
volumes: Mounts a local directory to store netboot.xyz files.
Remember to customize the MENU_URL parameter according to your preferences.
You will need to train your router to use the netboot.xyz server as a DHCP option. There are great resources on the netbook.xyz website as well as the docker container site.
If your router is anything like mine, you will have to look at the examples provided and adapt them to your model’s configuration scheme. Sorry, I can’t be of better help. On the Edgerouter X, it was necessary to issue only 3 commands to get the job done:
edit service dhcp-server shared-network-name LAN subnet 10.0.0.0/24
set bootfile-server 10.0.0.20
set bootfile-name netboot.xyz.kpxe
With this Docker-Compose configuration, you'll have a powerful netboot.xyz server ready to streamline your VM provisioning process. Say goodbye to the frustration of tracking which ISO you have on which USB and hello to a homelab where commissioning VMs is a smooth and, dare I say, enjoyable experience. Might you have so much fun that you consider leaving the pursuit of networking altogether? I doubt it, but, hey, you never know.