Files
mgmt/examples/lang/dhcp1.mcl
James Shubin 388d08e245 engine: resources: Add a dhcp range resource
This adds the ability to offer a dhcp lease to someone when we don't
know their mac address in advance.

This also uses the extended autogrouping API to keep the internal API
simpler.
2024-03-20 17:45:06 -04:00

32 lines
804 B
Plaintext

#$iface = "lo" # replace with your desired interface like eth0
$iface = "enp0s31f6"
net $iface {
state => "up",
addrs => ["192.168.42.1/24",],
}
dhcp:server ":67" {
interface => $iface, # required for now
leasetime => "60s", # increase this for normal production
dns => ["8.8.8.8", "1.1.1.1",], # pick your own better ones!
routers => ["192.168.42.1",],
Depend => Net[$iface], # TODO: add autoedges
}
dhcp:range "192.168.42.0/24" {
skip => ["192.168.42.1/24",], # skip this host
}
dhcp:host "hostname1" {
mac => "00:11:22:33:44:55", # replace with your own!
ip => "192.168.42.101/24", # cidr notation is required
}
dhcp:host "hostname2" {
mac => "ba:98:76:54:32:11", # replace with your own!
ip => "192.168.42.102/24",
nbp => "tftp://192.168.42.1/pxelinux.0", # for bios clients
}