Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Last active November 29, 2016 17:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/ffc78783ba91940d62f57cbdf9e285a3 to your computer and use it in GitHub Desktop.
Save cleverca22/ffc78783ba91940d62f57cbdf9e285a3 to your computer and use it in GitHub Desktop.
subnet 192.168.2.0 netmask 255.255.255.0 {
option domain-search "localnet";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
option routers 192.168.2.1;
option domain-name-servers 192.168.2.1, 8.8.8.8, 8.8.4.4;
range 192.168.2.100 192.168.2.200;
next-server 192.168.2.61;
if exists user-class and option user-class = "iPXE" {
filename "http://c2d.localnet/boot.php?mac=${net0/mac}&asset=${asset:uristring}&version=${builtin/version}";
} else {
filename = "undionly.kpxe";
}
}
clever@c2d /var/www/c2d $ nix-build -A netboot -o netboot '<nixpkgs/nixos/release.nix>' -Q -j 8
clever@c2d /var/www/c2d $ cat boot.php
<?php
switch (strtolower($_GET['mac'])) {
case '00:1c:23:16:4b:b3';
?>
#!ipxe
sanboot iscsi:192.168.2.11:::1:iqn.2016-01.laptop-root
<?php
break;
default;
case '08:00:27:15:bd:7b';
case '08:00:27:1f:4d:5a';
if ($_GET['version'] == '') {
?>
#!ipxe
chain tftp://192.168.2.61/undionly.kpxe
<?php
} else {
?>
#!ipxe
chain http://c2d.localnet/netboot/netboot.ipxe
<?php
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment