Created
December 3, 2024 11:06
-
-
Save zajdee/fec7e051f12f5ea2d9d3d7e297265983 to your computer and use it in GitHub Desktop.
ISC DHCPv6 config for the network boot, including support for a DHCPv6 relay request logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN DHCP Header | |
# ---------- | |
# dhcpd6.conf | |
# ---------- | |
default-lease-time 2592000; | |
preferred-lifetime 604800; | |
option dhcp-renewal-time 3600; | |
option dhcp-rebinding-time 7200; | |
allow leasequery; | |
# ---------- | |
# Options | |
# ---------- | |
option dhcp6.info-refresh-time 21600; | |
option dhcp6.vendor-class-identifier code 16 = string; | |
option dhcp6.vendor-class code 16 = {integer 32, integer 16, string}; | |
option dhcp6.user-class code 15 = string; | |
option dhcp6.bootfile-url code 59 = string; | |
option dhcp6.client-arch-type code 61 = array of unsigned integer 16; | |
# Beware. this will log mac addresses without leading zeros, e.g. e6:c9:e:ea:1:75 | |
log(info,concat( | |
"DHCP6-RELAY", | |
", interface-id: ", pick-first-value(v6relay(1, option dhcp6.interface-id),""), | |
", link-layer-addr: ", v6relay(1, (binary-to-ascii(16, 8, ":", option dhcp6.client-linklayer-addr))) | |
)); | |
# This doesn't print the MACs at all | |
#log(info,concat( | |
# "DHCP6-RELAY", | |
# ", interface-id: ", pick-first-value(v6relay(1, option dhcp6.interface-id),""), | |
# ", link-layer-addr: ", | |
# concat ( | |
# suffix (concat ("0", binary-to-ascii (16, 8, "", substring(option dhcp6.client-linklayer-addr,1,1))),2), ":", | |
# suffix (concat ("0", binary-to-ascii (16, 8, "", substring(option dhcp6.client-linklayer-addr,2,1))),2), ":", | |
# suffix (concat ("0", binary-to-ascii (16, 8, "", substring(option dhcp6.client-linklayer-addr,3,1))),2), ":", | |
# suffix (concat ("0", binary-to-ascii (16, 8, "", substring(option dhcp6.client-linklayer-addr,4,1))),2), ":", | |
# suffix (concat ("0", binary-to-ascii (16, 8, "", substring(option dhcp6.client-linklayer-addr,5,1))),2), ":", | |
# suffix (concat ("0", binary-to-ascii (16, 8, "", substring(option dhcp6.client-linklayer-addr,6,1))),2) | |
# ) | |
# )); | |
# END DHCP Header | |
# | |
# BEGIN iPXE SECTION | |
if exists dhcp6.user-class and | |
substring(option dhcp6.user-class, 2, 4) = "iPXE" { | |
option dhcp6.bootfile-url "http://tftp.server.com/secret/script.ipxe"; | |
} else if option dhcp6.client-arch-type = 00:06 { | |
option dhcp6.bootfile-url "tftp://tftp.server.com/secret/ipxe32.efi"; | |
} else if option dhcp6.client-arch-type = 00:07 { | |
option dhcp6.bootfile-url "tftp://tftp.server.com/secret/ipxe.efi"; | |
} else if option dhcp6.client-arch-type = 00:0f { | |
option dhcp6.vendor-class 0 10 "HTTPClient"; | |
option dhcp6.bootfile-url "http://tftp.server.com/secret/ipxe32.efi"; | |
} else if option dhcp6.client-arch-type = 00:10 { | |
option dhcp6.vendor-class 0 10 "HTTPClient"; | |
option dhcp6.bootfile-url "http://tftp.server.com/secret/ipxe.efi"; | |
} else { | |
# Support a hypothetical BIOS system that can PXE boot over IPv6 | |
option dhcp6.bootfile-url "tftp://tftp.server.com/secret/undionly.kpxe"; | |
} | |
# END iPXE SECTION | |
# DHCP6 Pools | |
subnet6 2001:db8:dead::/48 { | |
#pool6 | |
#{ | |
# range6 2001:db8:dead::ffff 2001:db8:dead::ffff; | |
#} | |
# NAT64 recursive server - replace with your own one if needed | |
option dhcp6.name-servers 2001:4860:4860::6464; | |
} | |
# If using DHCPv6 relay, the `hardware ethernet` stanza depends on the switch | |
# to provide the OPTION_CLIENT_LINKLAYER_ADDR (option 79) according to | |
# https://datatracker.ietf.org/doc/html/rfc6939 | |
# | |
# On Arista switches, this is configured using | |
# > ipv6 dhcp relay option link-layer address | |
# The rest of the DHCPv6 config on Arista is just: | |
# interface <l3interfacename> | |
# ipv6 dhcp relay destination 2001:db8:dead::beef | |
# where 2001:db8:dead::beef is your DHCPv6 server address | |
# | |
host server-001-uplink1 { | |
hardware ethernet e6:de:ad:be:ef:74; | |
fixed-address6 2001:db8:dead::10:3; | |
ddns-hostname "server-001-uplink1"; | |
} | |
host server-001-uplink2 { | |
hardware ethernet e6:de:ad:be:ef:75; | |
fixed-address6 2001:db8:dead::10:5; | |
ddns-hostname "server-001-uplink2"; | |
} | |
host server-002-uplink1 { | |
hardware ethernet e6:0b:ad:ca:fe:74; | |
fixed-address6 2001:db8:dead::11:3; | |
ddns-hostname "server-002-uplink1"; | |
} | |
host server-002-uplink2 { | |
hardware ethernet e6:0b:ad:ca:fe:75; | |
fixed-address6 2001:db8:dead::11:5; | |
ddns-hostname "server-002-uplink2"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment