Skip to content

Commit 1e511d2

Browse files
committed
Update README for dnsmasq example
Removes deprecated isc-dhcp-server example
1 parent d785a12 commit 1e511d2

File tree

1 file changed

+46
-36
lines changed

1 file changed

+46
-36
lines changed

README.md

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -123,62 +123,72 @@ Container images are configured using parameters passed at runtime (such as thos
123123

124124
## DHCP Configurations
125125

126-
This image requires the usage of a DHCP server in order to function properly. If you have an existing DHCP server, usually you will need to make some small adjustments to make your DHCP server forward requests to the netboot.xyz container. You will need to typically set your `next-server` and `boot-file-name` parameters in the DHCP configuration. This tells DHCP to forward requests to the TFTP server and then select a boot file from the TFTP server.
126+
The netboot.xyz Docker image requires the usage of a DHCP server in order to function properly. If you have an existing DHCP server, usually you will need to make some small adjustments to make your DHCP server forward requests to the netboot.xyz container. The main settings in your DHCP or router that you will typically need to set are:
127127

128-
### Examples
128+
* `tftp-server` also known as `next-server`, this option tells the client where to look for the boot file
129+
* `boot-file-name`, this option tells the client which boot file to load
129130

130-
These are a few configuration examples for setting up a DHCP server. The main configuration you will need to change are `next-server` and `filename/boot-file-name`. `Next-server` tells your client to check for a host running tftp and retrieve a boot file from there. Because the docker image is hosting a tftp server, the boot files are pulled from it and then it will attempt to load the iPXE configs directly from the host. You can then modify and adjust them to your needs. See [booting from TFTP](https://netboot.xyz/docs/booting/tftp/) for more information.
131+
## Examples
131132

132-
#### isc-dhcp-server
133+
The following are some configuration examples for setting up a DHCP server to get started. The main configuration you will need to change are `SERVER_IP_ADDRESS` so that DHCP can direct the client to the server running the netboot.xyz Docker container. Because the Docker image is hosting a dnsmasq TFTP server, the boot files are pulled from it and then it will attempt to load the iPXE configs directly from the host. You can then modify and adjust them to your needs. See [booting from TFTP](https://netboot.xyz/docs/booting/tftp/) for more information.
133134

134-
To install the DHCP server under Debian and Ubuntu run:
135+
### Setting up dnsmasq
136+
137+
To install dnsmasq as your DHCP server for Debian and Ubuntu, run:
135138

136139
```shell
137-
sudo apt install isc-dhcp-server
140+
sudo apt install dnsmasq
138141
```
139142

140-
You must edit two files to configure `isc-dhcp-server`. Edit `/etc/default/isc-dhcp-server` and configure at least one of the INTERFACES variables with the name of the interface you want to run the DHCP server on:
143+
For Redhat-based systems, run:
141144

142145
```shell
143-
INTERFACESv4="eth0"
146+
sudo dnf install dnsmasq
144147
```
145148

146-
You'll also need a `/etc/dhcp/dhcpd.conf` looking something like this:
149+
Set up your configuration file `/etc/dnsmasq.conf` with the following settings:
147150

148151
```shell
149-
option arch code 93 = unsigned integer 16;
150-
151-
subnet 192.168.0.0 netmask 255.255.255.0 {
152-
range 192.168.0.34 192.168.0.254; # Change this range as appropriate for your network
153-
next-server 192.168.0.33; # Change this to the address of your DHCP server
154-
option subnet-mask 255.255.255.0;
155-
option routers 192.168.0.1; # Change this to the address of your router
156-
option broadcast-address 192.168.0.255;
157-
option domain-name "mynetwork.lan"; # This is optional
158-
option domain-name-servers 1.1.1.1;
159-
if exists user-class and ( option user-class = "iPXE" ) {
160-
filename "http://boot.netboot.xyz/menu.ipxe";
161-
} elsif option arch = encode-int ( 16, 16 ) {
162-
filename "http://boot.netboot.xyz/ipxe/netboot.xyz.efi";
163-
option vendor-class-identifier "HTTPClient";
164-
} elsif option arch = 00:07 {
165-
filename "netboot.xyz.efi";
166-
} else {
167-
filename "netboot.xyz.kpxe";
168-
}
169-
}
170-
```
152+
# /etc/dnsmasq.conf
171153

172-
Now you can try starting the DHCP server:
154+
# Set the DHCP Range and lease time
155+
dhcp-range=192.168.1.100,192.168.1.200,255.255.255.0,12h
173156

174-
```shell
175-
sudo systemctl start isc-dhcp-server
157+
# Set the default gateway
158+
dhcp-option=option:router,192.168.1.1
159+
160+
# Set tne DNS servers
161+
dhcp-option=option:dns-server,8.8.8.8,8.8.4.4
162+
163+
# Standard PC BIOS
164+
dhcp-match=set:bios,60,PXEClient:Arch:00000
165+
dhcp-boot=tag:bios,netboot.xyz.kpxe,,SERVER_IP_ADDRESS
166+
167+
# 64-bit x86 EFI
168+
dhcp-match=set:efi64,60,PXEClient:Arch:00007
169+
dhcp-boot=tag:efi64,netboot.xyz.efi,,SERVER_IP_ADDRESS
170+
171+
# 64-bit x86 EFI (obsolete)
172+
dhcp-match=set:efi64-2,60,PXEClient:Arch:00009
173+
dhcp-boot=tag:efi64-2,netboot.xyz.efi,,SERVER_IP_ADDRESS
174+
175+
# 64-bit UEFI for arm64
176+
dhcp-match=set:efi64-3,60,PXEClient:Arch:0000B
177+
dhcp-boot=tag:efi64-3,netboot.xyz-arm64.efi,,SERVER_IP_ADDRESS
176178
```
177179

178-
To make the dhcp server start automatically on boot:
180+
A breakdown of the configuration:
181+
182+
- `dhcp-range` sets the range of IP addresses and lease times that will be assigned to clients.
183+
- `dhcp-option` sets the default gateway and DNS servers.
184+
- `dhcp-boot` sets the boot file for different architectures, the `SERVER_IP_ADDRESS` should be replaced with the IP address of the host running the Docker container.
185+
- `dhcp-match` sets the match criteria for different architectures.
186+
187+
Once the dnsmasq configuration is set, you can enable and start the service:
179188

180189
```shell
181-
sudo systemctl enable isc-dhcp-server
190+
sudo systemctl enable dnsmasq
191+
sudo systemctl start dnsmasq
182192
```
183193

184194
## netboot.xyz boot file types

0 commit comments

Comments
 (0)