Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

dhcpd question

Reply
 
Thread Tools Display Modes
  #1  
Old 04-17-2007, 01:23 AM
Default dhcpd question




I want to hand out a user-defined option, 184.
In that option, I want to give out two ip addresses and a 6-byte field
(ip address and then "9*)

I looked at the man pages for dhcp-options and I added the two option
lines below.

It starts up fine without those two "options" lines - so it reads the
subnet and range fine.
(there is a 192.168.0/24 interface on eth1)


subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.30;
option o184 code 299 = string;
option o184 01:04:c0:a8:00:0a:02:04:c0:a8:00:0a:03:04:c0:a8:00 :0a:
04:06:c0:a8:00:38:09:aa;
}



When I comment out the first option line, it gives this error:
/etc/dhcpd.conf line 5: unknown option dhcp.o184
option o184 01:
^
Configuration file errors encountered -- exiting


When I comment out the second line, it gives this error:
/etc/dhcpd.conf line 4: option definitions may not be scoped.
option o184 code
^
Configuration file errors encountered -- exiting


I can't tell from the man pages which line I should be using, or
both. It looks like I just need the second line, but it also appears
that the man pages have a typo, i.e. shouldn't that second line have
"code 195" in it?


Here are the man pages:

DATA STRING

option new-name code new-code = string ;

An option whose type is a data string is essentially just a
collection
of bytes, and can be specified either as quoted text, like
the text
type, or as a list of hexadecimal contents seperated by
colons whose
values must be between 0 and FF. For example:

option sql-identification-token code 195 = string;
option sql-identification-token 17:23:19:a6:42:ea:99:7c:22;



Any suggestions would be appreciated.



ScottReeve
Reply With Quote
  #2  
Old 04-17-2007, 04:55 AM
Allen McIntosh
Guest
 
Posts: n/a
Default Re: dhcpd question

> subnet 192.168.0.0 netmask 255.255.255.0 {
> range 192.168.0.10 192.168.0.30;
> option o184 code 299 = string;
> option o184 01:04:c0:a8:00:0a:02:04:c0:a8:00:0a:03:04:c0:a8:00 :0a:
> 04:06:c0:a8:00:38:09:aa;
> }


> When I comment out the second line, it gives this error:
> /etc/dhcpd.conf line 4: option definitions may not be scoped.
> option o184 code
> ^


Based on a working example I have and the error message, I would suggest
moving first option statement out of the subnet block and into the
declarations at the start of the file.

Here's what worked for me (highly edited)

option fubar code 150 = ip-address ;

subnet 192.168.11.0 netmask 255.255.255.0 {
option fubar 192.168.11.1 ;
option domain-name-servers 192.168.11.1 ;
(other stuff omitted)
Reply With Quote
  #3  
Old 04-17-2007, 05:04 AM
Terence
Guest
 
Posts: n/a
Default Re: dhcpd question

The meaning of "option definitions may not be scoped" means the
definition of the variable must be made in the global section - i.e.
outside of any host { } or any other section

I also notice the way you define option 184:

> option o184 code 299 = string;
> option o184 01:04:c0:a8:00:0a:02:04:c0:a8:00:--snip- ;


- the 'o184' which you wrote is a variable definition. This can be
whatever you want... 'o184' is fine, but note it is not the option
code itself, so you can equally call it option-184 if you wanted. For
some reason you wrote 299, that should be the 184.

You also need both lines - the first defines the variable itself, the
second defines the value to assign to the variable.

So basically, in the end, you want a dhcpd.conf file that contains,
for example:

option o184 code 184 = string;

subnet 192.168.0.0 netmask 0.0.0.0 {
option 0184 01:04:c0:a8:00:0a:02:04:c0:a8:00:0a:
03:04:c0:a8:00:0a:04:06:c0:a8:00:38:09:aa;
}

- obviously you can adapt accordingly to use the host, pool etc...
declarations too; but you should get the point.


Terence

Reply With Quote
Reply

Tags
dhcpd, question

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 08:40 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.