Skip to content

Instantly share code, notes, and snippets.

@robzr
Last active May 17, 2023 08:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robzr/357ba47c242f558975030ba41b072620 to your computer and use it in GitHub Desktop.
Save robzr/357ba47c242f558975030ba41b072620 to your computer and use it in GitHub Desktop.
Polycom VoIP phone provisioning using ISC DHCPD classes

Provisioning Polycom VoIP phones using ISC DHCPD

Using ISC DHCPD's concept of classes, we have a simple and powerful way of provisioning Polycom VoIP phones.

In the main body of the dhcpd.conf file (outside of any subnet declarations), we are going to define a couple custom Polycom options, then define the class, and match statements - which determine when the class is applied to DHCP clients. The class definition is also a good place to include some global options that will be applied to all Polycom clients, regardless of what subnet they end up on.

For the purposes of these examples, we're going to pretend our TFTP server is 10.0.1.2, and we are going to provision our phones to boot up on VLAN42 (10.0.42.0/24).

# Custom options used by Polycom clients
option polycom-vlan             code 128 = text;
option polycom-config-url       code 160 = text;

# Define the Polycom class, match based on Polycom's MAC OUIs or Vendor ID
class "polycom-phones"          {
  match if (substring(hardware, 1, 3) = 00:04:f2)
        or (substring(hardware, 1, 3) = 64:16:7f)
        or (substring(option vendor-class-identifier, 0, 4) = 00:00:36:3d);

  # These options will be applied to all Polycom phones
  next-server                   10.0.1.2;
  option tftp-server-name       "10.0.1.2";
  option polycom-config-url     "ftp://user:password@10.0.1.2";

  # Log to make debugging easier
  log(info, "Detected polycom-phone");
}

If we are using VLAN provisioning, can now match this class in subnet declarations and redirect the Polycom phone to a different VLAN (and corresponding subnet) using this syntax:

# Redirect phone to VLAN42
class "polycom-phones" {
  option polycom-vlan "VLAN-A=42;";
}

Finally, in our subnet declaration where our Polycom phones will reside, we can setup a custom pool just for them:

# Pool for Polycom clients
pool { 
  range 10.0.42.30 10.0.42.239;
  allow members of "polycom-phones";
}

# Pool for non-Polycom clients
pool { 
  range 10.0.42.240 10.0.42.249;
  deny members of "polycom-phones";
}

TODO: Add vendor option parsing to parse phone model, id, etc out of vendor-class-identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment