Changes between Version 14 and Version 15 of HostReservationsHowTo


Ignore:
Timestamp:
May 24, 2017, 4:40:46 PM (6 months ago)
Author:
wlodekwencel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HostReservationsHowTo

    v14 v15  
    8888The reservation will be made for an address of ''192.0.2.4'' and hostname of ''myhost.example.org''. In addition, host specific values of "sadder", "sname" and "file" will be assigned. The identifier type ''hw-address'' indicates that the client is identified by its MAC address. The ''identifier_value'' specifies the MAC address of the client. The ''dhcp4_subnet_id'' must match the identifier of the subnet to which the client is connected. The subnet identifier can be explicitly specified as a parameter of a subnet declaration within the Kea configuration file. This identifier should be used here.
    8989
    90 Different identifier types can also be used to create reservations. All supported identifier names can be retrieved from the ''dhcp_identifier_type'' table. Note however, that some of them may be specific to DHCPv4 or DHCPv6 only. For example: ''circuit-id'' and ''client-id' are specific to DHCPv4 and must not be used for DHCPv6 reservations.
     90Different identifier types can also be used to create reservations. All supported identifier names can be retrieved from the ''dhcp_identifier_type'' table. Note however, that some of them may be specific to DHCPv4 or DHCPv6 only. For example: ''circuit-id'' and ''client-id'' are specific to DHCPv4 and must not be used for DHCPv6 reservations.
     91
     92IMPORTANT NOTE: If Flexible Identifier Library is loaded to gain ability to create your own reservation identifiers and ''flex-id'' can be used as ''identifier_type''. In this case statement will be slightly different. In MySQL {{{VALUES (UNHEX(REPLACE(@identifier_value, ':', ''))}}} will be replaced by {{{VALUES (@identifier_value}}} full example:
     93
     94{{{
     95START TRANSACTION;
     96SET @ipv4_reservation='192.0.2.4';
     97SET @hostname = 'myhost.example.org';
     98SET @identifier_type='flex-id';
     99SET @identifier_value='value-of-your-decision';
     100SET @dhcp4_subnet_id=1;
     101SET @next_server='10.0.0.1';
     102SET @server_hostname='server-name.example.org';
     103SET @boot_file_name='bootfile.efi';
     104
     105INSERT INTO hosts (dhcp_identifier,
     106                   dhcp_identifier_type,
     107                   dhcp4_subnet_id,
     108                   ipv4_address,
     109                   hostname,
     110                   dhcp4_next_server,
     111                   dhcp4_server_hostname,
     112                   dhcp4_boot_file_name)
     113VALUES (@identifier_value,
     114        (SELECT type FROM host_identifier_type WHERE name=@identifier_type),
     115        @dhcp4_subnet_id,
     116        INET_ATON(@ipv4_reservation),
     117        @hostname,
     118        INET_ATON(@next_server),
     119        @server_hostname,
     120        @boot_file_name);
     121
     122COMMIT;
     123}}}
     124
     125And this is the change in the corresponding PostgreSQL statement: {{{VALUES (DECODE(REPLACE(:'identifier_value', ':', ''), 'hex'),}}} to {{{VALUES (:'identifier_value',}}}
     126
     127{{{
     128START TRANSACTION;
     129\set ipv4_reservation '192.0.2.4'
     130\set hostname   'myhost.example.org'
     131\set identifier_type 'flex-id'
     132\set identifier_value 'value-of-your-decision'
     133\set dhcp4_subnet_id 1
     134\set next_server '10.0.0.1'
     135\set server_hostname 'server-name.example.org'
     136\set boot_file_name 'bootfile.efi'
     137
     138INSERT INTO hosts (dhcp_identifier,
     139                   dhcp_identifier_type,
     140                   dhcp4_subnet_id,
     141                   ipv4_address,
     142                   hostname,
     143                   dhcp4_next_server,
     144                   dhcp4_server_hostname,
     145                   dhcp4_boot_file_name)
     146VALUES (:'identifier_value',
     147        (SELECT type FROM host_identifier_type WHERE name=:'identifier_type'),
     148        :dhcp4_subnet_id,
     149        (SELECT (:'ipv4_reservation'::inet - '0.0.0.0'::inet)),
     150        :'hostname',
     151        (SELECT (:'next_server'::inet - '0.0.0.0'::inet)),
     152        :'server_hostname',
     153        :'boot_file_name');
     154
     155COMMIT;
     156}}}
    91157
    92158In order to test that the reservation has been successfully added the following MySQL SELECT query can be used: