{
// DHCPv4 configuration starts here. This section will be read by DHCPv4 server
// and will be ignored by other components.
"Dhcp4": {
    // Add names of your network interfaces to listen on.
    "interfaces-config": {
        "interfaces": [ "enp0s8" ]
    },
    "control-socket": {
        "socket-type": "unix",
        "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
    },
    "lease-database": {
        // Memfile is the simplest and easiest backend to use. It's a in-memory
        // C++ database that stores its state in CSV file.
        "type": "memfile",
        "lfc-interval": 3600
    },
    "expired-leases-processing": {
        "reclaim-timer-wait-time": 300,
        "flush-reclaimed-timer-wait-time": 360,
        "hold-reclaimed-time": 3600,
        "max-reclaim-leases": 400,
        "max-reclaim-time": 500,
        "unwarned-reclaim-cycles": 5
    },
    "renew-timer": 900,
    "rebind-timer": 1800,
    "valid-lifetime": 3600,
    "option-data": [
        {
            "name": "domain-name-servers",
            "data": "192.168.33.1, 192.168.33.2"
        },
        {
            "name": "domain-search",
            "data": "vcf.viceroy.com, viceroy.com"
        },
        {
            "name": "boot-file-name",
            "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
        },
        {
            "name": "domain-name",
            "data": "viceroy.com"
        },
        {
            "name": "default-ip-ttl",
            "data": "0xf0"
        }
    ],
    "client-classes": [
        {
            "name": "iDRAC",
            //"test": "option[vendor-class-identifier].text == 'iDRAC'",
            "test": "substring(option[60].hex,0,5) == 'iDRAC'",
            "option-def": [ {
                    "name": "vendor-encapsulated-options",
                    "code": 43,
                    "type": "string"
                } ],
            "option-data": [ {
                    "name": "vendor-encapsulated-options",
                    "data": "-s 5 -i 192.168.33.4"
                } ]
        }
    ],
    "subnet4": [
        {
            "subnet": "192.168.33.0/24",
            "pools": [ { "pool": "192.168.33.100 - 192.168.33.200" } ],
            "option-data": [ {
                    // For each IPv4 subnet you most likely need to specify at
                    // least one router.
                    "name": "routers",
                    "data": "192.168.33.1"
                } ],
            "reservations": [
                // Testing purposes only
                {
                    "hw-address": "1a:1b:1c:1d:1e:1f",
                    "ip-address": "192.168.33.198"
                },
...
            ]
        }
    ]
},
"Logging":
{
    "loggers": [ {
        "name": "kea-dhcp4",
        "output_options": [ {
                "output": "/usr/local/var/log/kea-dhcp4.log"
        } ],
        "severity": "DEBUG",
        "debuglevel": 99
    } ]
}
}

==============
osboxes@osboxes:~/src/dhtest-master$ sudo ./dhtest -m "12:34:56:78:90:12" -o "iDRAC" -i enp0s8 -V -S 192.168.33.44
DHCP discover sent       - Client MAC : 12:34:56:78:90:12
DHCP offer received      - Offered IP : 192.168.33.101

DHCP offer details
----------------------------------------------------------
DHCP offered IP from server - 192.168.33.101
Next server IP(Probably TFTP server) - 0.0.0.0
Subnet mask - 255.255.255.0
Router/gateway - 192.168.33.1
DNS server - 192.168.33.1
DNS server - 192.168.33.2
Option no - 15, option length - 11
  OPTION data (HEX)
    76 69 63 65 72 6F 79 2E 63 6F 6D
  OPTION data (ASCII)
    viceroy.com
Lease time - 0 Days 1 Hours 0 Minutes
Option no - 53, option length - 1
  OPTION data (HEX)
    02
  OPTION data (ASCII)
   
DHCP server  - 192.168.33.44
Option no - 58, option length - 4
  OPTION data (HEX)
    00 00 03 84
  OPTION data (ASCII)
    #
Option no - 59, option length - 4
  OPTION data (HEX)
    00 00 07 08
  OPTION data (ASCII)
   
----------------------------------------------------------

DHCP request sent        - Client MAC : 12:34:56:78:90:12
DHCP ack received        - Acquired IP: 192.168.33.101

DHCP ack details
----------------------------------------------------------
DHCP offered IP from server - 192.168.33.101
Next server IP(Probably TFTP server) - 0.0.0.0
Subnet mask - 255.255.255.0
Router/gateway - 192.168.33.1
DNS server - 192.168.33.1
DNS server - 192.168.33.2
Option no - 15, option length - 11
  OPTION data (HEX)
    76 69 63 65 72 6F 79 2E 63 6F 6D
  OPTION data (ASCII)
    viceroy.com
Lease time - 0 Days 1 Hours 0 Minutes
Option no - 53, option length - 1
  OPTION data (HEX)
    05
  OPTION data (ASCII)
   
DHCP server  - 192.168.33.44
Option no - 58, option length - 4
  OPTION data (HEX)
    00 00 03 84
  OPTION data (ASCII)
    #
Option no - 59, option length - 4
  OPTION data (HEX)
    00 00 07 08
  OPTION data (ASCII)
   
----------------------------------------------------------
===============
2018-06-14 12:40:36.027 DEBUG [kea-dhcp4.packets/3193] DHCP4_BUFFER_RECEIVED received buffer from 0.0.0.0:68 to 192.168.33.44:67 over interface enp0s8
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.options/3193] DHCP4_BUFFER_UNPACK parsing buffer received from 0.0.0.0 to 192.168.33.44 over interface enp0s8
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.eval/3193] EVAL_DEBUG_OPTION Pushing option 60 with value 0x6944524143
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.eval/3193] EVAL_DEBUG_STRING Pushing text string '0'
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.eval/3193] EVAL_DEBUG_STRING Pushing text string '5'
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.eval/3193] EVAL_DEBUG_SUBSTRING Popping length 5, start 0, string 0x6944524143 pushing result 0x6944524143
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.eval/3193] EVAL_DEBUG_STRING Pushing text string 'iDRAC'
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.eval/3193] EVAL_DEBUG_EQUAL Popping 0x6944524143 and 0x6944524143 pushing result 'true'
2018-06-14 12:40:36.028 INFO  [kea-dhcp4.options/3193] EVAL_RESULT Expression iDRAC evaluated to 1
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.packets/3193] DHCP4_PACKET_RECEIVED [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: DHCPDISCOVER (type 1) received from 0.0.0.0 to 192.168.33.44 on interface enp0s8
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.packets/3193] DHCP4_QUERY_DATA [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70, packet details: local_address=192.168.33.44:67, remote_address=0.0.0.0:68, msg_type=DHCPDISCOVER (1), transid=0x50260c70,
options:
  type=053, len=001: 1 (uint8)
  type=055, len=005: 1(uint8) 28(uint8) 3(uint8) 15(uint8) 6(uint8)
  type=060, len=005: "iDRAC" (string)
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.dhcpsrv/3193] DHCPSRV_CFGMGR_SUBNET4_ADDR selected subnet 192.168.33.0/24 for packet received by matching address 192.168.33.44
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.packets/3193] DHCP4_SUBNET_SELECTED [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: the subnet with ID 1 was selected for client assignments
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.packets/3193] DHCP4_SUBNET_DATA [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: the selected subnet details: 192.168.33.0/24
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER get one host with IPv4 reservation for subnet id 1, identified by hwaddr=123456789012
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ALL_IDENTIFIER get all hosts with reservations using identifier: hwaddr=123456789012
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ALL_IDENTIFIER_COUNT using identifier hwaddr=123456789012, found 0 host(s)
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ONE_SUBNET_ID_IDENTIFIER_NULL host not found using subnet id 1 and identifier hwaddr=123456789012
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.dhcp4/3193] DHCP4_CLASS_ASSIGNED [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: client packet has been assigned to the following class(es): VENDOR_CLASS_iDRAC, iDRAC
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.ddns/3193] DHCP4_CLIENT_HOSTNAME_PROCESS [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: processing client's Hostname option
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.dhcpsrv/3193] DHCPSRV_MEMFILE_GET_HWADDR obtaining IPv4 leases for hardware address hwtype=1 12:34:56:78:90:12
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4 get one host with reservation for subnet id 1 and IPv4 address 192.168.33.101
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ALL_ADDRESS4 get all hosts with reservations for IPv4 address 192.168.33.101
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ALL_ADDRESS4_COUNT using address 192.168.33.101, found 0 host(s)
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.hosts/3193] HOSTS_CFG_GET_ONE_SUBNET_ID_ADDRESS4_NULL host not found using subnet id 1 and address 192.168.33.101
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.alloc-engine/3193] ALLOC_ENGINE_V4_OFFER_EXISTING_LEASE allocation engine will try to offer existing lease to the client [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70
2018-06-14 12:40:36.028 INFO  [kea-dhcp4.leases/3193] DHCP4_LEASE_ADVERT [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: lease 192.168.33.101 will be advertised
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.options/3193] DHCP4_PACKET_PACK [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: preparing on-wire format of the packet to be sent
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.packets/3193] DHCP4_PACKET_SEND [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: trying to send packet DHCPOFFER (type 2) from 192.168.33.44:67 to 192.168.33.101:68 on interface enp0s8
2018-06-14 12:40:36.028 DEBUG [kea-dhcp4.packets/3193] DHCP4_RESPONSE_DATA [hwtype=1 12:34:56:78:90:12], cid=[no info], tid=0x50260c70: responding with packet DHCPOFFER (type 2), packet details: local_address=192.168.33.44:67, remote_address=192.168.33.101:68, msg_type=DHCPOFFER (2), transid=0x50260c70,
options:
  type=001, len=004: 4294967040 (uint32)
  type=003, len=004: 192.168.33.1
  type=006, len=008: 192.168.33.1 192.168.33.2
  type=015, len=011: "viceroy.com" (string)
  type=051, len=004: 3600 (uint32)
  type=053, len=001: 2 (uint8)
  type=054, len=004: 192.168.33.44
  type=058, len=004: 900 (uint32)
  type=059, len=004: 1800 (uint32)




