Option 82 Sub-option 5

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

Option 82 Sub-option 5

kraishak
Hi All,

I have been trying to understand the option 82 sub option 5 (agent.link-selection) working prototype, I have been searching in the forums and many of them suggest as below

class "BD-1Net" { match if(binary-to-ascii(10, 8, ".", option agent.link-selection) = "192.168.1.0"); }

 shared-network BD-1Net
 {
  subnet 192.168.1.0 netmask 255.255.255.0
{
  option routers 192.168.1.1;
  option subnet-mask 255.255.255.0;
pool {
 allow members of "BD-1Net";
 range 192.168.1.101 192.168.1.110;
 }
 }
}
I have a doubt of why to add a shared-network line statement in the config though it has only one subnet, Is it mandatory to add that shared-network statement?
I tried testing without adding the shared-network statement line and it works fine, but before I use in my prod I want to know full details,
 
Any help would be appreciated 
Thanks

_______________________________________________
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: Option 82 Sub-option 5

Simon Hobson
Kraishak Mahtha <[hidden email]> wrote:

>
> Hi All,
>
> I have been trying to understand the option 82 sub option 5 (agent.link-selection) working prototype, I have been searching in the forums and many of them suggest as below
>
> class "BD-1Net" { match if(binary-to-ascii(10, 8, ".", option agent.link-selection) = "192.168.1.0"); }
>
>  shared-network BD-1Net
>  {
>   subnet 192.168.1.0 netmask 255.255.255.0
> {
>   option routers 192.168.1.1;
>   option subnet-mask 255.255.255.0;
> pool {
>  allow members of "BD-1Net";
>  range 192.168.1.101 192.168.1.110;
>  }
>  }
> }
> I have a doubt of why to add a shared-network line statement in the config though it has only one subnet, Is it mandatory to add that shared-network statement?
> I tried testing without adding the shared-network statement line and it works fine, but before I use in my prod I want to know full details,

Yes, if there is only one subnet then the shared-network is optional. AFAIK in this situation it will provide no additional features.

BTW - it's not necessary to use binary-to-ascii, you can (I think) compare the raw data :
match if( option agent.link-selection = 0xc0a80100 );
which is less processing though less readable.

Simon

_______________________________________________
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: Option 82 Sub-option 5

glenn.satchell


On 2021-06-18 20:37, Simon Hobson wrote:

> Kraishak Mahtha <[hidden email]> wrote:
>>
>> Hi All,
>>
>> I have been trying to understand the option 82 sub option 5
>> (agent.link-selection) working prototype, I have been searching in the
>> forums and many of them suggest as below
>>
>> class "BD-1Net" { match if(binary-to-ascii(10, 8, ".", option
>> agent.link-selection) = "192.168.1.0"); }
>>
>>  shared-network BD-1Net
>>  {
>>   subnet 192.168.1.0 netmask 255.255.255.0
>> {
>>   option routers 192.168.1.1;
>>   option subnet-mask 255.255.255.0;
>> pool {
>>  allow members of "BD-1Net";
>>  range 192.168.1.101 192.168.1.110;
>>  }
>>  }
>> }
>> I have a doubt of why to add a shared-network line statement in the
>> config though it has only one subnet, Is it mandatory to add that
>> shared-network statement?
>> I tried testing without adding the shared-network statement line and
>> it works fine, but before I use in my prod I want to know full
>> details,
>
> Yes, if there is only one subnet then the shared-network is optional.
> AFAIK in this situation it will provide no additional features.
>
> BTW - it's not necessary to use binary-to-ascii, you can (I think)
> compare the raw data :
> match if( option agent.link-selection = 0xc0a80100 );
> which is less processing though less readable.
>
> Simon

According to the dhcp-eval man page, string representation can be one of
two forms:

     string

          A  string,  enclosed  in quotes, may be specified as a data
expression, and returns the text between the quotes, encoded in ASCII.  
The backslash ('\') character is treated specially, as in C pro‐
          gramming: '\t' means TAB, '\r' means carriage return, '\n'
means newline, and '\b' means bell.  Any octal value can be specified
with '\nnn', where nnn is any positive octal number less than 0400.
          Any hexadecimal value can be specified with '\xnn', where nn is
any positive hexadecimal number less than or equal to 0xff.

     colon-separated hexadecimal list

          A list of hexadecimal octet values, separated by colons, may be
specified as a data expression.

In this case you could use this format to compare the raw data:

     match if ( option agent.link-selection = c0:a8:01:00 );

Although I also think "\xc0\xa8\x01\x00" would work but this is
definitely harder to read :)

Personally,unless you have thousands of things trying to match the
string, the binary-to-ascii() method you're using seems the easiest to
read.

regards,
Glenn

_______________________________________________
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: Option 82 Sub-option 5

kraishak
In reply to this post by kraishak
Hi all,
How to use the option 82 sub option 5 for host elements, Adding the allow-members of the defined class(allow members of "BD-1Net";) is giving syntax validation for host section statement,
    host host0001{
                 hardware ethernet aa:bb:cc:dd:33:44;
                 fixed-address 4.0.0.3;
                default-lease-time 3600;
                #allow members of "BD-1Net";
        }
Do we have any separate host-identifier for this option?

Any help would be much appreciated
Thanks