Storing client identifier in server for use during later leases

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Storing client identifier in server for use during later leases

Vipul Agarwal
I want to store client identifier in the server so that the server can refer to that value later on while trying to lease IP addresses to other clients.  
Each client sends out an identifier and if another client shows up with the same identifier, I assign them hostnames based on that identifier. ( Only 2 different identifiers are possible so I only need to store two identifiers).

This is what I added to the server to store this.

#space to store the identifiers
option space local code width 2 length width 2;
option local.identifier1 code 1 = unsigned integer 8;
option local.identifier2 code 2 = unsigned integer 8;

#Custom option identifier sent by the client
option identifier code 189 = unsigned integer 8;
option switch code 190 = unsigned integer 8;

/// Storing  based on what client sent
class "acs"
{
  match if option dhcp-client-identifier = "ACS";

if option switch = 1
{
        option host-name "acs-01";
        option local.identifier1 = option identifier;
}
elsif option switch = 2
{
        option host-name "acs-02";
        option local.identifier2 =  option identifier;
}
else
{
        option host-name "bos-cart-unknown";
}
}


#Matching if the identifier matches or not.
class "sra"
{
  match if option dhcp-client-identifier = "SRA";

# If what was sent matches what currently is
if option local.identifier1 = option identifier
{
        option host-name "sra-01";
}
elsif option local.identifier2 = option identifier
{
        option host-name "sra-02";
}
else
{
        option host-name "bos-sra-unknown";
}
}

However this doesn't work and the second client always gets the hostname bos-sra-unknown.

Please let me know if I am doing something wrong here / there is a different way to approach this.

Thanks
vipul 

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