matchstring in dhcpd

Lonnie Olson lists at kittypee.com
Thu Sep 5 09:47:21 MDT 2013


You can use functions like matchstring to apply different options to a
class of devices.  One similar example I use is for my VoIP phones.
It matches on the vendor part of the MAC address to identify which
devices are phones.

## Setup Phone options
if binary-to-ascii(16,8,"-",substring(hardware,1,3)) = "8-0-f" {
  option phone-tftp-server 10.49.2.21;
  option phone-rtc-address 10.49.2.21;
  option phone-dhcp-server "MITEL IP PHONE";
  option phone-Vlan-ID 0x14;
  option phone-qos-priority 0x6;
}

Your example however seems tied directly to a specific device instead
of a class of devices.  This is much easier and more clean to specify
using a specific host stanza like this:

host pinky {
  hardware ethernet b8:27:eb:4e:a9:9a;
  fixed-address 10.49.220.45;
}

Just put one of these host stanzas inside your subnet stanza to assign
a specific IP (or any other DHCP options) to a specific device.  You
can have as many of these as you want.  I would suggest picking IP
addresses for these that are outside of the dynamic range, as well.


On Thu, Sep 5, 2013 at 1:25 AM, Dan Egli <ddavidegli at gmail.com> wrote:
> Hey all, here's a quick one. Does anyone know a list of strings that the
> dhcpd matchstring function can parse? I know that a common thing is
> searching for the PXE identifier: matchstring(option,
> vendor-class-identifier, 0, 9) = "PXEClient", but besides
> vendor-class-identifier what can I match against? I'm wondering if there's
> a way I could setup a specific Class of machine, so that if, for example,
> the DHCP client is the computer in my front room it gets an IP in one range
> where as if it's a computer in the back of the house it gets an IP from a
> whole different range (either different subnet, or different portion of the
> same subnet). I'd rather not have to use multiple network adapters to
> accomplish this and matchstring looks like it could be the answer, but I
> don't know what else I can match against besides vendor-class-identifier.
> Really great would be if I could somehow match a model number of the
> motherboard or network adapter. Either a list, or just a URL where I could
> find such a list is most welcome.
>
>
>
> Thanks!
>
>
> --- Dan
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */


More information about the PLUG mailing list