using option 82 to assign a static ip-address

Sten Carlsen stenc at s-carlsen.dk
Sun Dec 16 22:10:29 UTC 2012


For the third substring, I see you get an "e", but if the original 
string is 6 letters, that would be the result as well, substring should 
return the next length characters or until the end of the string 
counting from the offset point.

The other possible difference might be the binary-to-ascii conversion, 
if that is not in the log section.

On 16/12/12 21:02, Nico De Ranter wrote:
>
>
> On Sun, Dec 16, 2012 at 6:04 PM, Peter Rathlev <peter at rathlev.dk 
> <mailto:peter at rathlev.dk>> wrote:
>
>     On Sun, 2012-12-16 at 16:09 +0100, Nico De Ranter wrote:
>     > 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.
>
>     It's substring(string, offset, length). Take a look at man
>     dhcp-eval to
>     confirm. I only run dhcp-4.x but as far as I can see via Google it was
>     the same in 3.1.1.
>
>
> strange, I had to increase the first substring from 6 to 7 otherwise 
> the last character wouldn't match.
>
>     >
>     > 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.
>
>     Not converting to ASCII means better performance but also that you
>     don't
>     have to worry about single or double digit bytes as Sten pointed
>     out. It
>     can work fine with the conversion though.
>     >
>     > 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.
>
>     What does syslog messages from dhcpd say? Does it log the DISCOVER?
>     Maybe it says something about why it doesn't hand out a lease.
>
> Yep, it does log the discover. But that's about all it logs
>
> [Dec 16 21:52:22][info][mgt][dhcpd][-]:  Lease for 84:78:ac:84:e5:80 
> remote id e hardware 1:0:14:2d:40:f:15
> [Dec 16 21:52:22][info][mgt][dhcpd][-]:  DHCPDISCOVER from 
> 00:14:2d:40:0f:15 via eth0: unknown client
>
> The first line is my log statement.  If I change anything in the class 
> so it doesn't match anymore I get something like this in stead (I only 
> want to use static addresses)
>
> [Dec 16 21:51:08][err][mgt][dhcpd][-]:  DHCPDISCOVER from 
> 00:1b:21:28:7f:66 via eth0: network 10.103.0/24: no free leases
>
> 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://www.esaturnus.com/>
>
>
>   <http://vcard.esaturnus.com/>
>
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-- 
Best regards

Sten Carlsen

No improvements come from shouting:

        "MALE BOVINE MANURE!!!"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20121216/5d2c1923/attachment.html>


More information about the dhcp-users mailing list