key conflict message for create host by Omapi

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

key conflict message for create host by Omapi

Clodoaldo de Borba Lambiase

Hi,

I'm trying to enable duplicate MACs in different subnets for ISC DHCP- 4.3.3 with OMAPI host entries. I have two IPs with the same MAC address in different subnets.

 

After the commands below in OMSHELL I have received an error message called "key conflict". This error occurs because the MAC Address is equal. However, it should not happen in with “ip address” from different subnets.

 

Someone already encountered this behavior? Could help me?

 

Second IP address: 143.54.246.2

 

>>root@nac:/home/clodoaldo/Scripts# omshell

> server localhost

> connect

obj: <null>

> new host

obj: host

> set name="143.54.246.2"

obj: host

name = "143.54.246.2"

> set hardware-type=1

obj: host

name = "143.54.246.2"

hardware-type = 1

> set hardware-address=d6:37:64:30:39:3e

obj: host

name = "143.54.246.2"

hardware-type = 1

hardware-address = d6:37:64:30:39:3e

> create

can't open object: key conflict

obj: host

name = "143.54.246.2"

hardware-type = 1

hardware-address = d6:37:64:30:39:3e

 

 

Firt IP address: 143.54.244.2 OK

Result:

host 143.54.244.2 {

  dynamic;

  hardware ethernet d6:37:64:30:39:3e;

  fixed-address 143.54.244.2;

}

 

 

>>[hidden email] vi /etc/dhcp3/dhcpd.subnets

shared-network enfermagem {

    # Enfermagem - Campus Saúde

    subnet 143.54.246.0 netmask 255.255.255.0 {

        option domain-name-servers 143.54.2.165,143.54.2.166;

        option routers 143.54.246.1;

        default-lease-time 1209600;

        option domain-name "ufrgs.br";

    }

}

shared-network bioquimica {

    # Bioquimica - Campus Saúde

    subnet 143.54.244.0 netmask 255.255.255.0 {

       default-lease-time 1209600;

        option domain-name-servers 143.54.1.52,143.54.1.53;

        option routers 143.54.244.1;

        option domain-name "bioquimica.ufrgs.br";

    }

}

 

 

Regards,

Eng. Clodoaldo de B. Lambiase


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

Re: key conflict message for create host by Omapi

Shraddha Pandhe
Hi Clodaoldo,

I am just a user of isc-dhcpd myself. Just wondering, is it supposed to allow multiple MAC entries in the config? If so, how will it distinguish between DHCP requests?



On Tue, Oct 20, 2015 at 1:53 PM, Clodoaldo de Borba Lambiase <[hidden email]> wrote:

Hi,

I'm trying to enable duplicate MACs in different subnets for ISC DHCP- 4.3.3 with OMAPI host entries. I have two IPs with the same MAC address in different subnets.

 

After the commands below in OMSHELL I have received an error message called "key conflict". This error occurs because the MAC Address is equal. However, it should not happen in with “ip address” from different subnets.

 

Someone already encountered this behavior? Could help me?

 

Second IP address: 143.54.246.2

 

>>root@nac:/home/clodoaldo/Scripts# omshell

> server localhost

> connect

obj: <null>

> new host

obj: host

> set name="143.54.246.2"

obj: host

name = "143.54.246.2"

> set hardware-type=1

obj: host

name = "143.54.246.2"

hardware-type = 1

> set hardware-address=d6:37:64:30:39:3e

obj: host

name = "143.54.246.2"

hardware-type = 1

hardware-address = d6:37:64:30:39:3e

> create

can't open object: key conflict

obj: host

name = "143.54.246.2"

hardware-type = 1

hardware-address = d6:37:64:30:39:3e

 

 

Firt IP address: 143.54.244.2 OK

Result:

host 143.54.244.2 {

  dynamic;

  hardware ethernet d6:37:64:30:39:3e;

  fixed-address 143.54.244.2;

}

 

 

>>[hidden email] vi /etc/dhcp3/dhcpd.subnets

shared-network enfermagem {

    # Enfermagem - Campus Saúde

    subnet 143.54.246.0 netmask 255.255.255.0 {

        option domain-name-servers 143.54.2.165,143.54.2.166;

        option routers 143.54.246.1;

        default-lease-time 1209600;

        option domain-name "ufrgs.br";

    }

}

shared-network bioquimica {

    # Bioquimica - Campus Saúde

    subnet 143.54.244.0 netmask 255.255.255.0 {

       default-lease-time 1209600;

        option domain-name-servers 143.54.1.52,143.54.1.53;

        option routers 143.54.244.1;

        option domain-name "bioquimica.ufrgs.br";

    }

}

 

 

Regards,

Eng. Clodoaldo de B. Lambiase


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


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

Re: key conflict message for create host by Omapi

Joseph Bernard
In reply to this post by Clodoaldo de Borba Lambiase
Are you trying to give a record 2 IPs or 2 MAC addresses?

Thanks,
Joseph B.

Sent from my iPhone

On Oct 20, 2015, at 4:53 PM, Clodoaldo de Borba Lambiase <[hidden email]> wrote:

Hi,

I'm trying to enable duplicate MACs in different subnets for ISC DHCP- 4.3.3 with OMAPI host entries. I have two IPs with the same MAC address in different subnets.

 

After the commands below in OMSHELL I have received an error message called "key conflict". This error occurs because the MAC Address is equal. However, it should not happen in with “ip address” from different subnets.

 

Someone already encountered this behavior? Could help me?

 

Second IP address: 143.54.246.2

 

>>root@nac:/home/clodoaldo/Scripts# omshell

> server localhost

> connect

obj: <null>

> new host

obj: host

> set name="143.54.246.2"

obj: host

name = "143.54.246.2"

> set hardware-type=1

obj: host

name = "143.54.246.2"

hardware-type = 1

> set hardware-address=d6:37:64:30:39:3e

obj: host

name = "143.54.246.2"

hardware-type = 1

hardware-address = d6:37:64:30:39:3e

> create

can't open object: key conflict

obj: host

name = "143.54.246.2"

hardware-type = 1

hardware-address = d6:37:64:30:39:3e

 

 

Firt IP address: 143.54.244.2 OK

Result:

host 143.54.244.2 {

  dynamic;

  hardware ethernet d6:37:64:30:39:3e;

  fixed-address 143.54.244.2;

}

 

 

>>[hidden email] vi /etc/dhcp3/dhcpd.subnets

shared-network enfermagem {

    # Enfermagem - Campus Saúde

    subnet 143.54.246.0 netmask 255.255.255.0 {

        option domain-name-servers 143.54.2.165,143.54.2.166;

        option routers 143.54.246.1;

        default-lease-time 1209600;

        option domain-name "ufrgs.br";

    }

}

shared-network bioquimica {

    # Bioquimica - Campus Saúde

    subnet 143.54.244.0 netmask 255.255.255.0 {

       default-lease-time 1209600;

        option domain-name-servers 143.54.1.52,143.54.1.53;

        option routers 143.54.244.1;

        option domain-name "bioquimica.ufrgs.br";

    }

}

 

 

Regards,

Eng. Clodoaldo de B. Lambiase

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

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

Re: key conflict message for create host by Omapi

Simon Hobson
In reply to this post by Clodoaldo de Borba Lambiase
Clodoaldo de Borba Lambiase <[hidden email]> wrote:

> I'm trying to enable duplicate MACs in different subnets for ISC DHCP- 4.3.3 with OMAPI host entries. I have two IPs with the same MAC address in different subnets.

It sounds like you are trying to do via OMAPI the equivalent of this in the config file

host "blah1" { hardware ethernet aa:bb:cc:dd:ff ; ip address 192.168.1.123 ; }
host "blah2" { hardware ethernet aa:bb:cc:dd:ff ; ip address 192.168.2.123 ; }

IIRC this doesn't work.

What you can do though is this :
host "blah" { hardware ethernet aa:bb:cc:dd:ff ; ip address 192.168.1.123, 192.168.2.123 ; }
ie provide a list of IP addresses for the host - and if one of those addresses matches the subnet then it is used, otherwise it just creates a "known host" which (subject ot any allow/deny restrictions) will get a dynamic address.

So you might see if you can set a list of IPs via OMAPI.

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

Re: key conflict message for create host by Omapi

Graham Clinch
On 21/10/2015 08:13, Simon Hobson wrote:

> Clodoaldo de Borba Lambiase <[hidden email]> wrote:
>
>> I'm trying to enable duplicate MACs in different subnets for ISC DHCP- 4.3.3 with OMAPI host entries. I have two IPs with the same MAC address in different subnets.
>
> It sounds like you are trying to do via OMAPI the equivalent of this in the config file
>
> host "blah1" { hardware ethernet aa:bb:cc:dd:ff ; ip address 192.168.1.123 ; }
> host "blah2" { hardware ethernet aa:bb:cc:dd:ff ; ip address 192.168.2.123 ; }
>
> IIRC this doesn't work.

Drifting gently away from the original request, just noting that
multiple host records (in different subnets) with the same hardware
address *does* work (at least in 4.2) when configured through the
configuration files.  I've not tried it via OMAPI.

=-=-=
subnet 148.88.141.0 netmask 255.255.255.0 {
    option routers 148.88.141.1;
}

# static_allocation_id=18460
host 148.88.141.167 {
    fixed-address 148.88.141.167;
    hardware ethernet 00:13:44:00:05:0c;
}

[...]

subnet 148.88.186.0 netmask 255.255.254.0 {
    option routers 148.88.186.1;
}

# static_allocation_id=24416
host 148.88.186.71 {
    fixed-address 148.88.186.71;
    hardware ethernet 00:13:44:00:05:0c;
}
=-=-=

From a cursory skim of server/omapi.c, it does appear that the omapi
server tries to find any lease with the same hardware address and
doesn't restrict it to being within the same subnet.

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

Re: key conflict message for create host by Omapi

Simon Hobson
Graham Clinch <[hidden email]> wrote:

> Drifting gently away from the original request, just noting that
> multiple host records (in different subnets) with the same hardware
> address *does* work (at least in 4.2) when configured through the
> configuration files.  I've not tried it via OMAPI.
>
> =-=-=
> subnet 148.88.141.0 netmask 255.255.255.0 {
>    option routers 148.88.141.1;
> }
>
> # static_allocation_id=18460
> host 148.88.141.167 {
>    fixed-address 148.88.141.167;
>    hardware ethernet 00:13:44:00:05:0c;
> }
>
> [...]
>
> subnet 148.88.186.0 netmask 255.255.254.0 {
>    option routers 148.88.186.1;
> }
>
> # static_allocation_id=24416
> host 148.88.186.71 {
>    fixed-address 148.88.186.71;
>    hardware ethernet 00:13:44:00:05:0c;
> }

Bear in mind that you *WILL* get strange effects if you put host statements within a subnet declaration. When the client connects to a different subnet, it'll still match the host declarations (so is still a "known host"), but while it'll get a dynamic IP appropriate to the subnet it is in, it'll inherit options like "router" from (one of) the subnet(s) where the host declaration(s) have been put.

Hence the standard advice - do *NOT* put host statements anywhere but the global scope.

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

Re: key conflict message for create host by Omapi

Graham Clinch
On 21/10/2015 13:58, Simon Hobson wrote:

>> =-=-=
>> subnet 148.88.141.0 netmask 255.255.255.0 {
>>    option routers 148.88.141.1;
>> }
>>
>> # static_allocation_id=18460
>> host 148.88.141.167 {
>>    fixed-address 148.88.141.167;
>>    hardware ethernet 00:13:44:00:05:0c;
>> }
>>
>> [...]
>>
>> subnet 148.88.186.0 netmask 255.255.254.0 {
>>    option routers 148.88.186.1;
>> }
>>
>> # static_allocation_id=24416
>> host 148.88.186.71 {
>>    fixed-address 148.88.186.71;
>>    hardware ethernet 00:13:44:00:05:0c;
>> }
>
> Bear in mind that you *WILL* get strange effects if you put host statements within a subnet declaration. When the client connects to a different subnet, it'll still match the host declarations (so is still a "known host"), but while it'll get a dynamic IP appropriate to the subnet it is in, it'll inherit options like "router" from (one of) the subnet(s) where the host declaration(s) have been put.
>
> Hence the standard advice - do *NOT* put host statements anywhere but the global scope.

Hm?  Am I missing something, or was that just a general warning?  The
hosts are defined in the same 'global' scope as the subnets.  Given the
configuration above (though 1000x longer..), we don't see hosts being
given the wrong router addresses when they visit other subnets.

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

Re: key conflict message for create host by Omapi

Simon Hobson
Graham Clinch <[hidden email]> wrote:

> ?  Am I missing something, or was that just a general warning?

Sorry, my mistake - I'd misread your post as having put the host declarations inside the subnet declarations.

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

Re: key conflict message for create host by Omapi

Shraddha Pandhe
Hi Graham,

<< multiple host records (in different subnets) with the same hardware
<< address *does* work (at least in 4.2) 


Just wondering, how will dhcp request/response work in this case? Based on my understanding, host config lookup happens solely on the basis of mac address. But if two hosts have same mac address, how will the server decide?

Am I missing something?


On Wed, Oct 21, 2015 at 10:58 AM, Simon Hobson <[hidden email]> wrote:
Graham Clinch <[hidden email]> wrote:

> ?  Am I missing something, or was that just a general warning?

Sorry, my mistake - I'd misread your post as having put the host declarations inside the subnet declarations.

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


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

Re: key conflict message for create host by Omapi

glenn.satchell
The address has to match the subnet where the request came from. So
consider a laptop that can be connected to many subnets. If there is a
valid host statement it will use that address, otherwise it uses the
dynamic range, and classes etc.

regards,
-glenn

On Thu, October 22, 2015 5:20 am, Shraddha Pandhe wrote:

> Hi Graham,
>
> << multiple host records (in different subnets) with the same hardware
> << address *does* work (at least in 4.2)
>
>
> Just wondering, how will dhcp request/response work in this case? Based on
> my understanding, host config lookup happens solely on the basis of mac
> address. But if two hosts have same mac address, how will the server
> decide?
>
> Am I missing something?
>
>
> On Wed, Oct 21, 2015 at 10:58 AM, Simon Hobson <[hidden email]>
> wrote:
>
>> Graham Clinch <[hidden email]> wrote:
>>
>> > ?  Am I missing something, or was that just a general warning?
>>
>> Sorry, my mistake - I'd misread your post as having put the host
>> declarations inside the subnet declarations.
>>
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users


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

Re: key conflict message for create host by Omapi

Simon Hobson
Glenn Satchell <[hidden email]> wrote:

> The address has to match the subnet where the request came from. So
> consider a laptop that can be connected to many subnets. If there is a
> valid host statement it will use that address, otherwise it uses the
> dynamic range, and classes etc.

I was wondering about a more subtle issue, but consultation of the man page resolved that :
> When dhcpd tries to find a host declaration for a client, it first looks for a host declaration which has a fixed-address declaration that lists an IP address that is valid for the subnet or shared network on which the client is booting. If it doesn't find any such entry, it tries to find an entry which has no fixed-address declaration.

So it would appear that if the host is in a subnet where none of the fixed-address options match, then those host statements themselves don't match. Thus there is no issue over which options get applied (should you apply other options within the host declaration).



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

Re: key conflict message for create host by Omapi

glenn.satchell
On Thu, October 22, 2015 9:19 pm, Simon Hobson wrote:

> Glenn Satchell <[hidden email]> wrote:
>
>> The address has to match the subnet where the request came from. So
>> consider a laptop that can be connected to many subnets. If there is a
>> valid host statement it will use that address, otherwise it uses the
>> dynamic range, and classes etc.
>
> I was wondering about a more subtle issue, but consultation of the man
> page resolved that :
>> When dhcpd tries to find a host declaration for a client, it first looks
>> for a host declaration which has a fixed-address declaration that lists
>> an IP address that is valid for the subnet or shared network on which
>> the client is booting. If it doesn't find any such entry, it tries to
>> find an entry which has no fixed-address declaration.
>
> So it would appear that if the host is in a subnet where none of the
> fixed-address options match, then those host statements themselves don't
> match. Thus there is no issue over which options get applied (should you
> apply other options within the host declaration).

The host statement *does* match, for example the host is still a "known"
host. It's a match based on "hardware ethernet". It's just that the
fixed-address does not match the subnet.

regards,
-glenn

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

Re: key conflict message for create host by Omapi

Clodoaldo de Borba Lambiase
In reply to this post by Clodoaldo de Borba Lambiase
Hi,

I've tested the inclusion of the two different IPs with the same MAC address and It works fine like someone told here before. But, when I try do it by OMAPI protocol I receive the "key conflict" error message.
It seems that DHCP restricts more by OMAPI than via dhcpd.conf.

To solve this I *disabled* the "key conflict" test at the code. My php script already consists the IP/MAC before include by Omapi and I don't worry about incorrect inclusions.

Unfortunately, I think that is not the best way to solve this.
The best way would be apply the same DHCP behavior, during the reading of the dhcp.conf file, to the IP inclusion via OMAPI.

PS: I need use the same MAC in different subnets because our clients connect notebooks and other devices in many places.

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

Re: key conflict message for create host by Omapi

dave c
What are you setting the "key" to in your OMAPI call? If you are using the MAC Address or the
customer name, there's your problem right there.

I suggest you use the MAC and the IP address for the KEY so that it's unique per instance. The
MAC address is a field specified elsewhere in the OMAPI call.

The KEY can be anything, as long as it's unique.

BTW, disabling the unique key check on a database is never a good idea. There will be areas that
do a select based upon the key and expect one and only one answer to come back.

Dave

On 10/22/15 10:47, Clodoaldo de Borba Lambiase wrote:

> Hi,
>
> I've tested the inclusion of the two different IPs with the same MAC address and It works fine like someone told here before. But, when I try do it by OMAPI protocol I receive the "key conflict" error message.
> It seems that DHCP restricts more by OMAPI than via dhcpd.conf.
>
> To solve this I *disabled* the "key conflict" test at the code. My php script already consists the IP/MAC before include by Omapi and I don't worry about incorrect inclusions.
>
> Unfortunately, I think that is not the best way to solve this.
> The best way would be apply the same DHCP behavior, during the reading of the dhcp.conf file, to the IP inclusion via OMAPI.
>
> PS: I need use the same MAC in different subnets because our clients connect notebooks and other devices in many places.
>
> Clodoaldo
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>

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