[Kea-users] use of option 82, relay4[1].hex

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

[Kea-users] use of option 82, relay4[1].hex

agiimaa.b

Hello All,

i'm trying to configure Kea 1.5 to tie clients to their locations (because customers shouldn't move their equipment to any other location).

 My sample configuration is below:

   "client-classes": [
  {
      "name": "opt82",
      "test": "relay4.[1].hex == 485754435096C50A",
  }
  ],

  "subnet4": [
    {
        "pools": [
            {
              "pool":  "192.168.0.3 - 192.168.0.200",
              "client-class": "opt82"
           }

           
And returning error is:
DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/usr/local/etc/kea/kea-dhcp4.conf': expression: [relay4[1].hex == 485754435096C50A] error: <string>:1.18-29: Invalid value in 485754435096. Allowed range: 0..4294967295 at (/usr/local/etc/kea/kea-dhcp4.conf: 15:11)

Question is:
    * how can i express the switch's circuit-id?

    * any other suggestion on solution?
    
Any reply would be appreciated,    
Thank you

The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

-------------------------------------------------------------------------------------------------------------------------------------

Энэхүү и-мэйл болон хавсралт дахь мэдээлэл нь тодорхой хүнд хаяглагдсан бөгөөд нууцлалтай мэдээлэл агуулж байж болзошгүй тул бусдад дамжуулах, олон нийтэд тараах, өөр бусад зорилгоор ашиглахыг хориглоно. Хэрэв та уг и-мэйлийг санамсаргүй байдлаар хүлээн авсан бол и-мэйл илгээгчид мэдэгдэж, хуулбар баримт үлдээлгүй устгана уу.


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

Re: [Kea-users] use of option 82, relay4[1].hex

Tomek Mrugalski
On 23/05/2019 09:41, agiimaa.b wrote:
>  "test": "relay4.[1].hex == 485754435096C50A",
485754435096C50A is being interpreted as decimal number.
Try this: relay4.[1].hex == 0x485754435096C50A

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

[Kea-users] using flex_id for combined reservation identifiers

agiimaa.b
In reply to this post by agiimaa.b

Hello,


I'm trying to identify and reserve a host by combination of "mac address AND circuit id" with no luck.

How should I express it? Any reply would be appreciated, Thank you


MAC address: e8:37:7a:00:00:00

Circuit ID: 4857544394969D21


...

  "reservations": [

     {
        "flex-id": "0x4857544394969D21 0xe8377a000000",
        "ip-address": "10.215.160.101"
    } ],
...

   "hooks-libraries": [
        {
            "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
            "parameters": {
                //"identifier-expression": "concat(relay4[1].hex, substring(pkt4.mac, ':'))",
                "identifier-expression": "concat(relay4[1].hex, hexstring(pkt4.mac, ':'))",
                "replace-client-id": "false"
            }
        }
    ],



The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

-------------------------------------------------------------------------------------------------------------------------------------

Энэхүү и-мэйл болон хавсралт дахь мэдээлэл нь тодорхой хүнд хаяглагдсан бөгөөд нууцлалтай мэдээлэл агуулж байж болзошгүй тул бусдад дамжуулах, олон нийтэд тараах, өөр бусад зорилгоор ашиглахыг хориглоно. Хэрэв та уг и-мэйлийг санамсаргүй байдлаар хүлээн авсан бол и-мэйл илгээгчид мэдэгдэж, хуулбар баримт үлдээлгүй устгана уу.


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

Re: [Kea-users] using flex_id for combined reservation identifiers

agiimaa.b

My sample configuration is below:

 

"reservations": [
    {
       "flex-id": "'0x4857544394969D21d4:cf:f9:ff:dd:bb'",
       "ip-address": "10.215.160.101"
   }


 ],

   "hooks-libraries": [
       {
           "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
           "parameters": {
                "identifier-expression": "concat(relay4[1].hex, hexstring(pkt4.mac, ':'))"
            }
       }
   ],



Kea log is below:

INFO  [kea-dhcp4.flex-id-hooks/21510] FLEX_ID_EXPRESSION_EVALUATED Expression evaluated for packet to "4857544394969D21d4:cf:f9:ff:dd:bb" (size: 33)

INFO  [kea-dhcp4.leases/21510] DHCP4_LEASE_ALLOC [hwtype=1 d4:cf:f9:ff:dd:bb], cid=[01:d4:cf:f9:ff:dd:bb], tid=0x5545542e: lease 10.215.160.50 has been allocated

If reservation works correctly, the host should have address 10.215.160.101.
But it's not reserved, but getting lease from pool.
what am I missing here, pls correct me.

BR,


From: agiimaa.b
Sent: Thursday, November 21, 2019 10:26 AM
To: [hidden email]
Subject: using flex_id for combined reservation identifiers
 

Hello,


I'm trying to identify and reserve a host by combination of "mac address AND circuit id" with no luck.

How should I express it? Any reply would be appreciated, Thank you


MAC address: e8:37:7a:00:00:00

Circuit ID: 4857544394969D21


...

  "reservations": [

     {
        "flex-id": "0x4857544394969D21 0xe8377a000000",
        "ip-address": "10.215.160.101"
    } ],
...

   "hooks-libraries": [
        {
            "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
            "parameters": {
                //"identifier-expression": "concat(relay4[1].hex, substring(pkt4.mac, ':'))",
                "identifier-expression": "concat(relay4[1].hex, hexstring(pkt4.mac, ':'))",
                "replace-client-id": "false"
            }
        }
    ],



The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

-------------------------------------------------------------------------------------------------------------------------------------

Энэхүү и-мэйл болон хавсралт дахь мэдээлэл нь тодорхой хүнд хаяглагдсан бөгөөд нууцлалтай мэдээлэл агуулж байж болзошгүй тул бусдад дамжуулах, олон нийтэд тараах, өөр бусад зорилгоор ашиглахыг хориглоно. Хэрэв та уг и-мэйлийг санамсаргүй байдлаар хүлээн авсан бол и-мэйл илгээгчид мэдэгдэж, хуулбар баримт үлдээлгүй устгана уу.


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

Re: [Kea-users] using flex_id for combined reservation identifiers

TroYy
If your hook evaluated your expression as "4857544394969D21d4:cf:f9:ff:dd:bb"
then try to add reservation something like this

"reservations": [
    {
       "flex-id": "4857544394969D21d4:cf:f9:ff:dd:bb",
       "ip-address": "10.215.160.101"
   }

Also check if your flex-id identifier is enabled for quering:

"host-reservation-identifiers": ["duid", "*flex-id*"],



--
Sent from: http://kea-users.7364.n8.nabble.com/
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] using flex_id for combined reservation identifiers

agiimaa.b

thank you TroYy,

it worked


BR


From: Kea-users <[hidden email]> on behalf of TroYy <[hidden email]>
Sent: Thursday, November 21, 2019 5:51 PM
To: [hidden email]
Subject: Re: [Kea-users] using flex_id for combined reservation identifiers
 
If your hook evaluated your expression as "4857544394969D21d4:cf:f9:ff:dd:bb"
then try to add reservation something like this

"reservations": [
    {
       "flex-id": "4857544394969D21d4:cf:f9:ff:dd:bb",
       "ip-address": "10.215.160.101"
   }

Also check if your flex-id identifier is enabled for quering:

"host-reservation-identifiers": ["duid", "*flex-id*"],



--
Sent from: http://kea-users.7364.n8.nabble.com/


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

The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

-------------------------------------------------------------------------------------------------------------------------------------

Энэхүү и-мэйл болон хавсралт дахь мэдээлэл нь тодорхой хүнд хаяглагдсан бөгөөд нууцлалтай мэдээлэл агуулж байж болзошгүй тул бусдад дамжуулах, олон нийтэд тараах, өөр бусад зорилгоор ашиглахыг хориглоно. Хэрэв та уг и-мэйлийг санамсаргүй байдлаар хүлээн авсан бол и-мэйл илгээгчид мэдэгдэж, хуулбар баримт үлдээлгүй устгана уу.


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

Re: [Kea-users] using flex_id for combined reservation identifiers

agiimaa.b
In reply to this post by TroYy

Hello,


Now i'm trying to configure mysql host reservation. But no luck. Where could be my mistake?

Here is my configurations:


 "host-reservation-identifiers": [ "circuit-id", "hw-address", "flex-id" ],
  "reservation-mode": "global",

  "hosts-database": {
      "type": "mysql",
      "name": "kea",
      "host": "",
      "user": "myuser",
      "password": "mypass"
  },

    "hooks-libraries": [
        {
            "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
            "parameters": {
                "identifier-expression": "concat(relay4[1].hex, hexstring(pkt4.mac, ''))"
            }
        }
    ], 

MySQL insert statement:

START TRANSACTION;
SET @ipv4_reservation='10.10.10.10;
SET @identifier_type='flex-id';
SET @identifier_value='4857544315C6342Fd4cff9ffddbb';
SET @dhcp4_subnet_id=1;
SET @next_server='10.10.10.1';
SET @server_hostname='kea.test.com';
SET @boot_file_name='bootfile.efi';

INSERT INTO hosts (dhcp_identifier,
                   dhcp_identifier_type,
                    dhcp4_subnet_id,
                   ipv4_address,
                   dhcp4_next_server,
                   dhcp4_server_hostname,
                   dhcp4_boot_file_name)
VALUES (UNHEX(REPLACE(@identifier_value, ':', '')),
(SELECT type FROM host_identifier_type WHERE name=@identifier_type),
        @dhcp4_subnet_id,
        INET_ATON(@ipv4_reservation),
        INET_ATON(@next_server),
        @server_hostname,
        @boot_file_name);

COMMIT;

Kea Log: 

INFO  [kea-dhcp4.flex-id-hooks/17331] FLEX_ID_EXPRESSION_EVALUATED Expression evaluated for packet to "4857544315C6342Fd4cff9ffddbb" (size: 28)
WARN  [kea-dhcp4.alloc-engine/17331] ALLOC_ENGINE_V4_ALLOC_FAIL [hwtype=1 d4:cf:f9:ff:dd:bb], cid=[01:d4:cf:f9:ff:dd:bb], tid=0x55455494: failed to al
locate an IPv4 address after 0 attempt(s)

BR,
Agiimaa  B.

From: Kea-users <[hidden email]> on behalf of TroYy <[hidden email]>
Sent: Thursday, November 21, 2019 5:51 PM
To: [hidden email]
Subject: Re: [Kea-users] using flex_id for combined reservation identifiers
 
If your hook evaluated your expression as "4857544394969D21d4:cf:f9:ff:dd:bb"
then try to add reservation something like this

"reservations": [
    {
       "flex-id": "4857544394969D21d4:cf:f9:ff:dd:bb",
       "ip-address": "10.215.160.101"
   }

Also check if your flex-id identifier is enabled for quering:

"host-reservation-identifiers": ["duid", "*flex-id*"],



--
Sent from: http://kea-users.7364.n8.nabble.com/


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

The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

-------------------------------------------------------------------------------------------------------------------------------------

Энэхүү и-мэйл болон хавсралт дахь мэдээлэл нь тодорхой хүнд хаяглагдсан бөгөөд нууцлалтай мэдээлэл агуулж байж болзошгүй тул бусдад дамжуулах, олон нийтэд тараах, өөр бусад зорилгоор ашиглахыг хориглоно. Хэрэв та уг и-мэйлийг санамсаргүй байдлаар хүлээн авсан бол и-мэйл илгээгчид мэдэгдэж, хуулбар баримт үлдээлгүй устгана уу.


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

Re: [Kea-users] using flex_id for combined reservation identifiers

agiimaa.b


Anyone can help on expression of flex-id in mysql?


From: agiimaa.b
Sent: Wednesday, December 4, 2019 2:46 PM
To: [hidden email]
Subject: Re: [Kea-users] using flex_id for combined reservation identifiers
 

Hello,


Now i'm trying to configure mysql host reservation. But no luck. Where could be my mistake?

Here is my configurations:


 "host-reservation-identifiers": [ "circuit-id", "hw-address", "flex-id" ],
  "reservation-mode": "global",

  "hosts-database": {
      "type": "mysql",
      "name": "kea",
      "host": "",
      "user": "myuser",
      "password": "mypass"
  },

    "hooks-libraries": [
        {
            "library": "/usr/local/lib/hooks/libdhcp_flex_id.so",
            "parameters": {
                "identifier-expression": "concat(relay4[1].hex, hexstring(pkt4.mac, ''))"
            }
        }
    ], 

MySQL insert statement:

START TRANSACTION;
SET @ipv4_reservation='10.10.10.10;
SET @identifier_type='flex-id';
SET @identifier_value='4857544315C6342Fd4cff9ffddbb';
SET @dhcp4_subnet_id=1;
SET @next_server='10.10.10.1';
SET @server_hostname='kea.test.com';
SET @boot_file_name='bootfile.efi';

INSERT INTO hosts (dhcp_identifier,
                   dhcp_identifier_type,
                    dhcp4_subnet_id,
                   ipv4_address,
                   dhcp4_next_server,
                   dhcp4_server_hostname,
                   dhcp4_boot_file_name)
VALUES (UNHEX(REPLACE(@identifier_value, ':', '')),
(SELECT type FROM host_identifier_type WHERE name=@identifier_type),
        @dhcp4_subnet_id,
        INET_ATON(@ipv4_reservation),
        INET_ATON(@next_server),
        @server_hostname,
        @boot_file_name);

COMMIT;

Kea Log: 

INFO  [kea-dhcp4.flex-id-hooks/17331] FLEX_ID_EXPRESSION_EVALUATED Expression evaluated for packet to "4857544315C6342Fd4cff9ffddbb" (size: 28)
WARN  [kea-dhcp4.alloc-engine/17331] ALLOC_ENGINE_V4_ALLOC_FAIL [hwtype=1 d4:cf:f9:ff:dd:bb], cid=[01:d4:cf:f9:ff:dd:bb], tid=0x55455494: failed to al
locate an IPv4 address after 0 attempt(s)

BR,
Agiimaa  B.

From: Kea-users <[hidden email]> on behalf of TroYy <[hidden email]>
Sent: Thursday, November 21, 2019 5:51 PM
To: [hidden email]
Subject: Re: [Kea-users] using flex_id for combined reservation identifiers
 
If your hook evaluated your expression as "4857544394969D21d4:cf:f9:ff:dd:bb"
then try to add reservation something like this

"reservations": [
    {
       "flex-id": "4857544394969D21d4:cf:f9:ff:dd:bb",
       "ip-address": "10.215.160.101"
   }

Also check if your flex-id identifier is enabled for quering:

"host-reservation-identifiers": ["duid", "*flex-id*"],



--
Sent from: http://kea-users.7364.n8.nabble.com/
kea-users.7364.n8.nabble.com
Kea Users forum and mailing list archive. Kea is an open source project from Internet Systems Consortium (ISC). This list is for discussion about installing and managing the Kea software suite for...


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

The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

-------------------------------------------------------------------------------------------------------------------------------------

Энэхүү и-мэйл болон хавсралт дахь мэдээлэл нь тодорхой хүнд хаяглагдсан бөгөөд нууцлалтай мэдээлэл агуулж байж болзошгүй тул бусдад дамжуулах, олон нийтэд тараах, өөр бусад зорилгоор ашиглахыг хориглоно. Хэрэв та уг и-мэйлийг санамсаргүй байдлаар хүлээн авсан бол и-мэйл илгээгчид мэдэгдэж, хуулбар баримт үлдээлгүй устгана уу.


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