Document running on Mac/Windows in Vagrant

This commit is contained in:
Sam Mesterton-Gibbons 2020-05-18 18:56:16 +01:00
parent 438d7e6e07
commit 11909d351c

View file

@ -18,8 +18,8 @@ use when I want to run a Linux installer/memtest/Clonezilla etc, but I don't
need to permanently run a DHCP and TFTP server - most of the time my router is
just fine.
## How do I run it?
Run something like:
## How do I run it on Linux?
On Linux you can run something like:
```bash
docker run --net=host --cap-add=NET_ADMIN -e DHCP_RANGE_START=192.168.0.1 samdbmg/dhcp-netboot.xyz
```
@ -33,10 +33,34 @@ a nice menu of live disks, installers and utilities to run, which will be
downloaded from the Internet as needed.
### Why do I need `--net=host`?
To play DHCP server, the container needs listen to broadcasts on the target
network, which doesn't seem to work with port forwarding.
To play DHCP server, the container needs to have an interface on the target
network, rather than the Docker internal bridge.
### Firewall
## What about Mac/Windows?
On Mac and Windows Docker is usually a VM running in the background, and the
client is set up to (mostly) transparently pass commands through to that VM and
deal with forwarded ports and the like.
Unfortunately that doesn't work here, because then your Docker host doesn't have
an address on the network it is acting as DHCP server for. However all is not
lost, because a Vagrantfile is provided here to let you run the container in a
Virtualbox VM. By default a simple `vagrant up` will only start the demo (see
[below](##Demo)), but you can specify the machine to start instead:
```
DHCP_RANGE_START=192.168.0.1 vagrant up netboot
vagrant ssh netboot -c 'docker logs -f samdbmg-dhcp-netboot.xyz'
```
**Note:** You might be prompted to select which network the VM should connect to, choose
the one matching the IP address you gave.
It will boot an Ubuntu VM, install Docker on it and then fetch and start the
container. The second command will SSH you into the VM and start tailing the
netboot containers logs.
For this to work on Windows using Hyper-V as a backend, you'll need to use an
Administrator command prompt.
## Firewall
Don't forget, if you've got a firewall running on your system you'll need to
allow UDP traffic to ports 67 (DHCP), 69 (TFTP) and 4011 (PXE), along with
TCP port 80 (HTTP) for the built in webserver. For `ufw`, try:
@ -56,7 +80,7 @@ run it:
cd vagrant-demo
./run-demo.sh 192.168.0.1
```
You might be prompted to select which network the VM should connect to, choose
**Note:** You might be prompted to select which network the VM should connect to, choose
the one matching the IP address you gave.
You should see something like (also at slightly better quality
@ -66,6 +90,16 @@ You should see something like (also at slightly better quality
*Note that the Virtualbox Extension Pack might be needed for PXE boot to work,
and it's configured with 3GB RAM so that live disks ISOs can be downloaded.*
### Running the demo on Mac/Windows with Virtualbox
Run `DHCP_RANGE_START=192.168.0.1 vagrant up netboot demo`.
You'll probably be prompted twice for the network to attach to.
### Running the demo on Windows with Virtualbox
Unfortunately the PXE boot box used for the demo is only built for Virtualbox,
if you're using Hyper-V you'll have to create yourself a VM and configure it
to boot from the network (disable Secure Boot too, probably).
## Building Locally
Should be as simple as `docker build .`