using option 82 to assign a static ip-address

Nico De Ranter nico.deranter at esaturnus.com
Sun Dec 16 15:09:57 UTC 2012


substring = substring fomr charcter x to character y (not y characters
long).  So substring( ... 2,7) is 6 bytes long, substring( ..., 5,5) is 1
character long as expected.  I'm actually using the same substrings in my
log statement (not included below) and it prints exactly the parts I want.

Why am I converting to ascii? Because that's what I found in an example. I
tried without converting but then I didn't seem to get a match. :-).  I'm
not so worried about performance as there will be about 100 clients max
anyway.

As you can see at the bottom of my initial mail I'm actually reasonably
sure the class definition is correct as I also have a log statement (not
included below) which logs a message when the right client does a dhcp
request. If a change anything in the class definition or remove the 'allow
...' from the pool or if another client tries to do dhcp it doesn't log.
So it seems the dhcp server does properly match the client's option 82 info
and MAC address, it just doesn't seem to do anything with it.

Please do correct me if I'm wrong.

Nico

On Sun, Dec 16, 2012 at 2:47 PM, Sten Carlsen <stenc at s-carlsen.dk> wrote:

>
> On 16/12/12 14:17, Nico De Ranter wrote:
>
>
> Hi,
>
>
>
> I'm trying to use DHCP option 82 to assign a different address to a host
> depending on which network port it is connected to.
> I'vve created the following section in my config:
>
> ############
> stash-agent-options true;
> ...
> subnet 10.103.0.0 netmask 255.255.255.0
> {
>         option routers 10.103.0.1;
>         class "OK1Endo" {
>                 match if  binary-to-ascii(16, 8, ":", substring(option
> agent.remote-id, 2, 7)) = "84:78:ac:84:e5:80"
>
> How will a substring of length 7 match 6 hex values? Is there any reason
> to convert into ascii?
>
>                          and     binary-to-ascii (16, 8, ":", hardware) =
> "1:0:14:2d:40:f:15"
>
> binary-to-ascii will, as far as I can see, return a string of the form
> xx:xx:xx:xx ....
> How can that match x:x:xx:xx:xx:x:xx - note one or two digits.
>
>                         and     binary-to-ascii (16, 8, ":",
> substring(option agent.circuit-id, 5, 5)) = "e";
>
> Substring of length 5 should match one letter?
>
>         }
>         pool {
>                 filename "pxelinux.0";
>                 next-server 10.103.0.202;
>                 option mobile-ip-home-agent 10.103.0.202;
>                 option log-servers 10.103.0.202;
>                 option tz "Europe/Brussels";
>                 use-host-decl-names on;
>                 allow members of "OK1Endo";
>                 range 10.103.0.220 10.103.0.220;
>         }
>   }
> ###########
>
> I'm sure the class definition is correct and the pool matches as I also
> added a log statement which only seems to trigger if the client matches the
> pool (if I change the class definition or remove the 'allow members' I
> don't see the logs appearing in the log files anymore).
>
> However the dhcpd server doesn't seem to send any reply to the host: in
> tcpdump I see a bootp/dhcp request from the clients MAC but no replies from
> the server.  If I replace the 'pool' section with a simple 'host'
> definition the server responds immediately.
>
> Any ideas what I'm doing wrong?
>
> Note: I'm using a very old version of dhcpd (3.1.1) which unfortunately I
> cannot upgrade at the moment.
>
> Thanks in advance,
>
> Nico
>
> --
> Nico De Ranter
>
> Operations Engineer
>
>
>  eSATURNUS
>
> T. +32 16 40 12 82
>
> M. +32 497 91 53 78
>
> www.esaturnus.com
>
>
>  <http://www.esaturnus.com/>
>
>
>  <http://vcard.esaturnus.com/>
>
>
>
>
> _______________________________________________
> dhcp-users mailing listdhcp-users at lists.isc.orghttps://lists.isc.org/mailman/listinfo/dhcp-users
>
>
> --
> Best regards
>
> Sten Carlsen
>
> No improvements come from shouting:
>        "MALE BOVINE MANURE!!!"
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
>



-- 
Nico De Ranter

Operations Engineer


eSATURNUS

T. +32 16 40 12 82

M. +32 497 91 53 78

www.esaturnus.com


<http://www.esaturnus.com/>


 <http://vcard.esaturnus.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20121216/63aa9384/attachment-0001.html>


More information about the dhcp-users mailing list