Same MAC - diffrent IP depending on the contex (class)?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Same MAC - diffrent IP depending on the contex (class)?

Robert Socha
Hi,

I wonder if it's possible to achieve this in ISC DHCP:

- I have static hosts only (only known clients - no dynamic assignments)
- I need to assign different addresses to host depending on if it's boot
client (PXE or UEFI), or if it's OS (linux,windows,etc) DHCP client discover
    ( I need that because we use RFC3021 or /32 route-able IP
assignments to customer services and this addresses are not supported by
UEFI firmware).

So something like this (in pseudo config) or as idea:


# arch-type  -> option 93
if(if exists arch-type) {
        # Private/netboot subnet
        host N000c290e741d {
                hardware ethernet 00:0c:29:0e:74:1d;
          fixed-address 100.120.120.2;
                option routers 100.120.120.1;
                option subnet-mask 255.255.255.252;
        }
} else {
        # This for "public" network - discovers from "not boot agent"
        host O000c290e741d  {
          hardware ethernet 00:0c:29:0e:74:1d;
                fixed-address 10.255.255.11;
                option routers 10.255.255.10;
                if option vendor-class-identifier="MSFT 5.0" {
                 option subnet-mask 255.255.255.255;
                } else {
                 option subnet-mask 255.255.255.254;
                }
        }
}

I looking for solution with static assignments (not dynamic pool's) for
netboot network (we some logic behind this assigned IP's)

Best regards
--
Robert Socha

_______________________________________________
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Same MAC - diffrent IP depending on the contex (class)?

Robert Socha
Hi,

I was unable to find solution for my problem, so I implemented it in
source code.
I added "match if" directive to host definition which allows me to do
something like this:

option client-architecture code 93 = unsigned integer 16;

class "is-netboot" {
         match if exists client-architecture and (not (option
user-class="iPXE"));
}


host O000C29EF4070 {
    hardware ethernet 00:0C:29:EF:40:70;
    fixed-address 20.20.20.20;
    option routers 10.10.10.10;
    option subnet-mask 255.255.255.255;
}

host N000C29EF4070 {
    match if "is-netboot";
    hardware ethernet 00:0C:29:EF:40:70;
    fixed-address 100.64.4.2;
    option routers 100.64.4.1;
    option subnet-mask 255.255.255.252;
}

I also added support for globbing for include directive:

include "/etc/dhcp/host/*.conf"
include "/etc/dhcp/host/*/*.conf"

to recursively include files from folder and subfolders.

Best regards


W dniu 07.08.2020 o 23:02, Robert Socha pisze:

> Hi,
>
> I wonder if it's possible to achieve this in ISC DHCP:
>
> - I have static hosts only (only known clients - no dynamic assignments)
> - I need to assign different addresses to host depending on if it's boot
> client (PXE or UEFI), or if it's OS (linux,windows,etc) DHCP client
> discover
>     ( I need that because we use RFC3021 or /32 route-able IP
> assignments to customer services and this addresses are not supported by
> UEFI firmware).
>
> So something like this (in pseudo config) or as idea:
>
>
> # arch-type  -> option 93
> if(if exists arch-type) {
>      # Private/netboot subnet
>      host N000c290e741d {
>              hardware ethernet 00:0c:29:0e:74:1d;
>              fixed-address 100.120.120.2;
>              option routers 100.120.120.1;
>              option subnet-mask 255.255.255.252;
>      }
> } else {
>      # This for "public" network - discovers from "not boot agent"
>      host O000c290e741d  {
>              hardware ethernet 00:0c:29:0e:74:1d;
>              fixed-address 10.255.255.11;
>              option routers 10.255.255.10;
>              if option vendor-class-identifier="MSFT 5.0" {
>                      option subnet-mask 255.255.255.255;
>              } else {
>                      option subnet-mask 255.255.255.254;
>              }
>      }
> }
>
> I looking for solution with static assignments (not dynamic pool's) for
> netboot network (we some logic behind this assigned IP's)
>
> Best regards


--
Robert Socha
_______________________________________________
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Same MAC - diffrent IP depending on the contex (class)?

glenn.satchell
Hi Robert,

That's one way to do it.

The other way would be to create a class and two pools for each host. In
the pools have a single IP address in the range. The class would select
based on PXE and ethernet. This would be ok for a few clients, but if
you have hundreds it might not scale well.

regards,
-glenn

On 2020-08-13 22:54, Robert Socha wrote:

> Hi,
>
> I was unable to find solution for my problem, so I implemented it in
> source code.
> I added "match if" directive to host definition which allows me to do
> something like this:
>
> option client-architecture code 93 = unsigned integer 16;
>
> class "is-netboot" {
>         match if exists client-architecture and (not (option
> user-class="iPXE"));
> }
>
>
> host O000C29EF4070 {
>    hardware ethernet 00:0C:29:EF:40:70;
>    fixed-address 20.20.20.20;
>    option routers 10.10.10.10;
>    option subnet-mask 255.255.255.255;
> }
>
> host N000C29EF4070 {
>    match if "is-netboot";
>    hardware ethernet 00:0C:29:EF:40:70;
>    fixed-address 100.64.4.2;
>    option routers 100.64.4.1;
>    option subnet-mask 255.255.255.252;
> }
>
> I also added support for globbing for include directive:
>
> include "/etc/dhcp/host/*.conf"
> include "/etc/dhcp/host/*/*.conf"
>
> to recursively include files from folder and subfolders.
>
> Best regards
>
>
> W dniu 07.08.2020 o 23:02, Robert Socha pisze:
>> Hi,
>>
>> I wonder if it's possible to achieve this in ISC DHCP:
>>
>> - I have static hosts only (only known clients - no dynamic
>> assignments)
>> - I need to assign different addresses to host depending on if it's
>> boot client (PXE or UEFI), or if it's OS (linux,windows,etc) DHCP
>> client discover
>>     ( I need that because we use RFC3021 or /32 route-able IP
>> assignments to customer services and this addresses are not supported
>> by UEFI firmware).
>>
>> So something like this (in pseudo config) or as idea:
>>
>>
>> # arch-type  -> option 93
>> if(if exists arch-type) {
>>      # Private/netboot subnet
>>      host N000c290e741d {
>>              hardware ethernet 00:0c:29:0e:74:1d;
>>              fixed-address 100.120.120.2;
>>              option routers 100.120.120.1;
>>              option subnet-mask 255.255.255.252;
>>      }
>> } else {
>>      # This for "public" network - discovers from "not boot agent"
>>      host O000c290e741d  {
>>              hardware ethernet 00:0c:29:0e:74:1d;
>>              fixed-address 10.255.255.11;
>>              option routers 10.255.255.10;
>>              if option vendor-class-identifier="MSFT 5.0" {
>>                      option subnet-mask 255.255.255.255;
>>              } else {
>>                      option subnet-mask 255.255.255.254;
>>              }
>>      }
>> }
>>
>> I looking for solution with static assignments (not dynamic pool's)
>> for netboot network (we some logic behind this assigned IP's)
>>
>> Best regards
_______________________________________________
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Same MAC - diffrent IP depending on the contex (class)?

Robert Socha
Hi,

Thank you :)

But:

 >>> I looking for solution with static assignments (not dynamic pool's)
 >>> for netboot network (we some logic behind this assigned IP's)

With my patch DHCP is stateless (so I can use HA via load balancer).

Best regards


W dniu 14.08.2020 o 04:09, [hidden email] pisze:

> Hi Robert,
>
> That's one way to do it.
>
> The other way would be to create a class and two pools for each host. In
> the pools have a single IP address in the range. The class would select
> based on PXE and ethernet. This would be ok for a few clients, but if
> you have hundreds it might not scale well.
>
> regards,
> -glenn
>
> On 2020-08-13 22:54, Robert Socha wrote:
>> Hi,
>>
>> I was unable to find solution for my problem, so I implemented it in
>> source code.
>> I added "match if" directive to host definition which allows me to do
>> something like this:
>>
>> option client-architecture code 93 = unsigned integer 16;
>>
>> class "is-netboot" {
>>         match if exists client-architecture and (not (option
>> user-class="iPXE"));
>> }
>>
>>
>> host O000C29EF4070 {
>>    hardware ethernet 00:0C:29:EF:40:70;
>>    fixed-address 20.20.20.20;
>>    option routers 10.10.10.10;
>>    option subnet-mask 255.255.255.255;
>> }
>>
>> host N000C29EF4070 {
>>    match if "is-netboot";
>>    hardware ethernet 00:0C:29:EF:40:70;
>>    fixed-address 100.64.4.2;
>>    option routers 100.64.4.1;
>>    option subnet-mask 255.255.255.252;
>> }
>>
>> I also added support for globbing for include directive:
>>
>> include "/etc/dhcp/host/*.conf"
>> include "/etc/dhcp/host/*/*.conf"
>>
>> to recursively include files from folder and subfolders.
>>
>> Best regards
>>
>>
>> W dniu 07.08.2020 o 23:02, Robert Socha pisze:
>>> Hi,
>>>
>>> I wonder if it's possible to achieve this in ISC DHCP:
>>>
>>> - I have static hosts only (only known clients - no dynamic assignments)
>>> - I need to assign different addresses to host depending on if it's
>>> boot client (PXE or UEFI), or if it's OS (linux,windows,etc) DHCP
>>> client discover
>>>     ( I need that because we use RFC3021 or /32 route-able IP
>>> assignments to customer services and this addresses are not supported
>>> by UEFI firmware).
>>>
>>> So something like this (in pseudo config) or as idea:
>>>
>>>
>>> # arch-type  -> option 93
>>> if(if exists arch-type) {
>>>      # Private/netboot subnet
>>>      host N000c290e741d {
>>>              hardware ethernet 00:0c:29:0e:74:1d;
>>>              fixed-address 100.120.120.2;
>>>              option routers 100.120.120.1;
>>>              option subnet-mask 255.255.255.252;
>>>      }
>>> } else {
>>>      # This for "public" network - discovers from "not boot agent"
>>>      host O000c290e741d  {
>>>              hardware ethernet 00:0c:29:0e:74:1d;
>>>              fixed-address 10.255.255.11;
>>>              option routers 10.255.255.10;
>>>              if option vendor-class-identifier="MSFT 5.0" {
>>>                      option subnet-mask 255.255.255.255;
>>>              } else {
>>>                      option subnet-mask 255.255.255.254;
>>>              }
>>>      }
>>> }
>>>
>>> I looking for solution with static assignments (not dynamic pool's)
>>> for netboot network (we some logic behind this assigned IP's)
>>>
>>> Best regards
> _______________________________________________
> ISC funds the development of this software with paid support
> subscriptions. Contact us at https://www.isc.org/contact/ for more
> information.
>
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users


--
Robert Socha
_______________________________________________
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Same MAC - diffrent IP depending on the contex (class)?

glenn.satchell
Hi Robert,

Fair enough. Although as there's only one possible IP per client you
could have the same config on more than one dhcp server and each would
only hand out the same address to each client. So you wouldn't need
failover, for example.

Your solution, while elegant and solving your problem, leaves you with
some technical debt because you need to port the source code
modification every time you want to update the dhcpd version. I guess
that's relatively minor as it's not necessarily something that would be
done often.

regards,
-glenn

On 2020-08-14 17:59, Robert Socha wrote:

> Hi,
>
> Thank you :)
>
> But:
>
>>>> I looking for solution with static assignments (not dynamic pool's)
>>>> for netboot network (we some logic behind this assigned IP's)
>
> With my patch DHCP is stateless (so I can use HA via load balancer).
>
> Best regards
>
>
> W dniu 14.08.2020 o 04:09, [hidden email] pisze:
>> Hi Robert,
>>
>> That's one way to do it.
>>
>> The other way would be to create a class and two pools for each host.
>> In the pools have a single IP address in the range. The class would
>> select based on PXE and ethernet. This would be ok for a few clients,
>> but if you have hundreds it might not scale well.
>>
>> regards,
>> -glenn
>>
>> On 2020-08-13 22:54, Robert Socha wrote:
>>> Hi,
>>>
>>> I was unable to find solution for my problem, so I implemented it in
>>> source code.
>>> I added "match if" directive to host definition which allows me to do
>>> something like this:
>>>
>>> option client-architecture code 93 = unsigned integer 16;
>>>
>>> class "is-netboot" {
>>>         match if exists client-architecture and (not (option
>>> user-class="iPXE"));
>>> }
>>>
>>>
>>> host O000C29EF4070 {
>>>    hardware ethernet 00:0C:29:EF:40:70;
>>>    fixed-address 20.20.20.20;
>>>    option routers 10.10.10.10;
>>>    option subnet-mask 255.255.255.255;
>>> }
>>>
>>> host N000C29EF4070 {
>>>    match if "is-netboot";
>>>    hardware ethernet 00:0C:29:EF:40:70;
>>>    fixed-address 100.64.4.2;
>>>    option routers 100.64.4.1;
>>>    option subnet-mask 255.255.255.252;
>>> }
>>>
>>> I also added support for globbing for include directive:
>>>
>>> include "/etc/dhcp/host/*.conf"
>>> include "/etc/dhcp/host/*/*.conf"
>>>
>>> to recursively include files from folder and subfolders.
>>>
>>> Best regards
>>>
>>>
>>> W dniu 07.08.2020 o 23:02, Robert Socha pisze:
>>>> Hi,
>>>>
>>>> I wonder if it's possible to achieve this in ISC DHCP:
>>>>
>>>> - I have static hosts only (only known clients - no dynamic
>>>> assignments)
>>>> - I need to assign different addresses to host depending on if it's
>>>> boot client (PXE or UEFI), or if it's OS (linux,windows,etc) DHCP
>>>> client discover
>>>>     ( I need that because we use RFC3021 or /32 route-able IP
>>>> assignments to customer services and this addresses are not
>>>> supported by UEFI firmware).
>>>>
>>>> So something like this (in pseudo config) or as idea:
>>>>
>>>>
>>>> # arch-type  -> option 93
>>>> if(if exists arch-type) {
>>>>      # Private/netboot subnet
>>>>      host N000c290e741d {
>>>>              hardware ethernet 00:0c:29:0e:74:1d;
>>>>              fixed-address 100.120.120.2;
>>>>              option routers 100.120.120.1;
>>>>              option subnet-mask 255.255.255.252;
>>>>      }
>>>> } else {
>>>>      # This for "public" network - discovers from "not boot agent"
>>>>      host O000c290e741d  {
>>>>              hardware ethernet 00:0c:29:0e:74:1d;
>>>>              fixed-address 10.255.255.11;
>>>>              option routers 10.255.255.10;
>>>>              if option vendor-class-identifier="MSFT 5.0" {
>>>>                      option subnet-mask 255.255.255.255;
>>>>              } else {
>>>>                      option subnet-mask 255.255.255.254;
>>>>              }
>>>>      }
>>>> }
>>>>
>>>> I looking for solution with static assignments (not dynamic pool's)
>>>> for netboot network (we some logic behind this assigned IP's)
>>>>
>>>> Best regards
>> _______________________________________________
>> ISC funds the development of this software with paid support
>> subscriptions. Contact us at https://www.isc.org/contact/ for more
>> information.
>>
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.

dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users