Server configuration using conditional evaluation

Thomas Köller thomas at koeller.dyndns.org
Sat Feb 11 14:28:06 UTC 2023


Hi,

in my DHCP server configuration I have these lines:

host raspi-400 {
   host-identifier option dhcp6.client-id 
00:02:00:00:99:5c:df:c4:9e:c6:7c:c1:7f:3e;
   switch (binary-to-ascii(16, 32, ".", substring(option dhcp6.ia-na, 0, 
4))) {
     case "0":
       fixed-address6 fd46:1ffa:d8e0::9;
       option host-name "raspi-400";
       break;
     case "2":
       fixed-address6 fd46:1ffa:d8e0:1::9;
       option host-name "raspi-400-sshvpn";
       break;
   }
}

The intention is to return different data to the client, based on the 
IAID received. However, I apparently got the syntax wrong, although I 
cannot spot any mistake:

[root at sarkovy ~]# dhcpd -6 -cf /etc/dhcp/dhcpd6.conf -t
Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
lease_id_format is: hex
/etc/dhcp/dhcpd6.conf line 80: right brace expected.
       fixed-address6
        ^
/etc/dhcp/dhcpd6.conf line 83: case statement in inappropriate scope.
     case
      ^
/etc/dhcp/dhcpd6.conf line 87: expecting a declaration
   }
    ^
Configuration file errors encountered -- exiting

This version of ISC DHCP is based on the release available
on ftp.isc.org. Features have been added and other changes
have been made to the base software release in order to make
it work better with this distribution.

Please report issues with this software via:
https://bugzilla.redhat.com/

exiting.

Can anybody explain what's wrong?

Thomas


More information about the dhcp-users mailing list