diff options
Diffstat (limited to 'dhcp3/dhcpd.etherboot-udhcp')
-rw-r--r-- | dhcp3/dhcpd.etherboot-udhcp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/dhcp3/dhcpd.etherboot-udhcp b/dhcp3/dhcpd.etherboot-udhcp new file mode 100644 index 0000000..9a3e442 --- /dev/null +++ b/dhcp3/dhcpd.etherboot-udhcp @@ -0,0 +1,97 @@ +# This ISC dhcpd 3.x config snippet is inspired by initrd code in +# contrib area of etherboot source (dhcpd.conf.etherboot.include). + +# Usage: +# +# include "/etc/local-COMMON/dhcp3/dhcpd.etherboot"; +# include "/etc/local-COMMON/dhcp3/dhcpd.etherboot-udhcp"; +# include "/etc/local/dhcpd.conf.etherboot-pcimap.include"; # file generated by mknbi-set +# +# (...common options...) +# +# subclass "etherboot-udhcp-hosts" 00:01:02:03:04:05; +# subclass "etherboot-udhcp-hosts" 00:01:02:03:04:06 { fixed-address 192.168.1.101; another-option "bla bla"; } +# + +class "etherboot-udhcp-hosts" { + match pick-first-value (option dhcp-client-identifier, hardware); +} + +# Apply Etherboot options only for Etherboot clients +# +if substring ( option vendor-class-identifier, 0, 9 ) = "Etherboot" { + + # We must specify this value for etherboot-magic, or Etherboot will + # ignore all other options. + # + option etherboot.magic E4:45:74:68:00:00; + + # Bootfile name: derive from etherboot.kmod (calculated below) + # Use boot.nbi if no NIC_DEV_ID option present + # (i.e. if etherboot.kmod doesn't get set) + # Also pass filename back in filename field + # + option bootfile-name = pick-first-value ( + concat ( + "boot-", + config-option etherboot.kmod, + ".nbi" + ), + "boot.nbi" + ) ; + filename = config-option bootfile-name; + + # "Sensible" default values for some options + + # Mount devfs (will probably be needed for a network-boot) + option etherboot.kernel-cmdline " devfs=mount"; + + # Info message (includes client IP address, MAC address, hardware ID string, + # server IP address and name of boot file) + option etherboot.motd-4 = concat ( + "Using Etherboot to boot ", + binary-to-ascii ( 10, 8, ".", leased-address ), + " [", + binary-to-ascii ( 16, 8, ":", suffix ( hardware, 6 ) ), + "] [", + pick-first-value ( option etherboot.nic-dev-id, "unknown card" ), + "]", 0d:0a, " from ", + binary-to-ascii ( 10, 8, ".", option dhcp-server-identifier ), + " with file ", + config-option tftp-server-name, + ":", + config-option bootfile-name, + " [", + pick-first-value ( config-option etherboot.kmod, "unknown module" ), + "]", 0d:0a + ); +} + +# Some options should be set for both Etherboot and the udhcpc client +# +if ( + ( substring ( option vendor-class-identifier, 0, 9 ) = "Etherboot" ) + or + ( substring ( option vendor-class-identifier, 0, 5 ) = "udhcp" ) +) { + + # TFTP server defaults to DHCP server and is specified in both + # next-server field and tftp-server-name option field + # + option tftp-server-name = binary-to-ascii ( 10, 8, ".", config-option dhcp-server-identifier ); + server-name = config-option tftp-server-name; + next-server = config-option dhcp-server-identifier; + + # Root path defaults to root of TFTP server + option root-path = concat ( config-option tftp-server-name, ":/" ); + + # A fallback hostname, generated from the IP address + option host-name = concat ( "client_", binary-to-ascii ( 10, 8, "_", leased-address ) ); +} + +# Force some items onto parameter request list for udhcp +# +if substring ( option vendor-class-identifier, 0, 5 ) = "udhcp" { + # Forcibly add root-path to list + option dhcp-parameter-request-list = concat ( option dhcp-parameter-request-list, 11 ); +} |