DHCP match priority | docsis.org

You are here

DHCP match priority

6 posts / 0 new
Last post
fckgw
DHCP match priority

Good day everyone,

I wonder one thing about DHCP:

I use static defininitions for each cable modem / MTA in DHCP configuration.

I'd like to add definition (class), that for each CM's model, first DHCP check if software is correct (opt-43),
and than:
- if it's different than expected - modem gets a config that tell him to make a SW upgrade
- if it's correct - modem get's his normal,"operational" config defined in static binding and logs normally.

Problem is, that if I use classes and static bindings - statics always got highest prio and SW is not
upgraded (it does not mach a class).

Is it possible to change that priority ?

I'd like to avoid changing configs (adding upgrade option to it), cause I use common configs for different
cable modems (different vendors)

Or, is there maby any othet possibility to achieve this ?

Capm
cm config

You can do that in the cable modem config file.

kwesibrunee
This is how I do this:

This is how I do this:

First define vendorOptions near the top of your dhcpd conf file add:

# Map option 43 values for Docsis modems
option space vendorOptions;
option vendorOptions.deviceType code 2 = string;
option vendorOptions.serialNumber code 4 = string;
option vendorOptions.hardwareVersion code 5 = string;
option vendorOptions.softwareVersion code 6 = string;
option vendorOptions.bootRomVersion code 7 = string;
option vendorOptions.oui code 8 = string;
option vendorOptions.modelNumber code 9 = string;
option vendorOptions.docsisVendor code 10 = string;
option vendorOptions-pkt code 43 = encapsulate vendorOptions;

In your DHCP config setup your groups (service levels) like this

group HSOffice1 {
set speed = "HOF1";
}

group HSOffice2 {
set speed = "HOF2";
}

group HSOffice3 {
set speed = "HOF3";
}

group HSOffice4 {
set speed = "HOF4";
}
group HSOffice5 {
set speed = "HOF5";
}

group HSOffice6 {
set speed = "HOF6";
}

Then in my subnet declaration I use

# Setup config File name
# docsis file version is either docsis1.0, docsis1.1, docsis2.0 or docsis3.0
if (substring(option vendor-class-identifier,0,6) = "docsis") {
set docsisversion = substring(option vendor-class-identifier,0,9);
} else {
set docsisversion = "docsis1.0";
}
# we only officially support 3 modem vendors Arris, Motorola and Cisco everything else gets a vendor name of Other
if ((substring(option vendorOptions.docsisVendor, 0 ,5) = "Motor") or (substring(option vendorOptions.docsisVendor, 0 ,5) = "Cisco") or (substring(option vendorOptions.docsisVendor, 0 ,5) = "Arris")) {
set vendorname = substring(option vendorOptions.docsisVendor, 0 ,5);
} else {
set vendorname = "Other";
}
# Motorola models and some Arris modems require a model specific config file to do the upgrading
set model = option vendorOptions.modelNumber;
if (model = "SB5100" or model = "SB5101" or model = "SB5101U" or model ="SB5101NU" or model ="SB5120" or model = "SBG900" or model = "SBG940" or model = "SBG941" or model = "SBG1000" or model ="SB6120" or model = "SB6121" or model ="SB6141" or model = "SBG6580" or model ="TG852G" or model = "TG862G" or model = "DG860A") {
set modeltype = concat(model, "/");
} else {
set modeltype = "";
}
# Not many docsis 1.0 modems left a docsis 1.0 config file name is in format: docsis1.0/HOF1.bin
if (docsisversion = "docsis1.0") {
set docsisfile = concat(docsisversion, "/", speed, ".bin");
} else {
# Docsis 1.1+ modems get the config file with the format of: docsisx.x/Vendor/Model/HOF1.bin
set docsisfile = concat(docsisversion, "/", vendorname, "/", modeltype, speed, ".bin");
}
# finally we send the filename to the modem
filename = docsisfile;
option bootfile-name = docsisfile;
# unset the variables
unset docsisversion;
unset vendorname;
unset model;
#unset docsisfile;
unset speed;
unset modeltype;

And finally in your host declaration you add

host nh4bad1145035e7f10 {
# Static definitions here
hardware ethernet 00:1a:ea:4e:5e:0c;
group "HSOffice1";
}

I then wrote a script that generates about 1000 config files per site with the appropriate options set it is too large to post here but I can get it to you on request

karthik537
The concept of using group

The concept of using group inside the host declaration helped me a lot. Thanks a lot!
But the concept of using "set variable=string;" is not working for me.

I have declared the set variable in group and then declared the group in the host as below.
But still when assigned the variable to the "option bootfile-name" it didnt work.

group abc{
set fs = "sample.tar";
}

host 03435 {
hardware ethernet 00:1a:ea:4e:5e:0c;
fixed-address 10.10.10.1;
group "abc";
option boot-filename = fs;
}
unset fs;

Please help me...

kwesibrunee
What version of dhcpd are you

What version of dhcpd are you using?
I have variables working in dhcp-4.1.1-38.P1.el6.centos.x86_64 not sure when variables were introduced but should work in 4.1.x or greater for sure.

you may add a
log (info, fs);

line in to troubleshoot....

If your just doing boot-filename

why not just do
group abc{
option boot-filename = "sample.tar";
}
host 03435 {
hardware ethernet 00:1a:ea:4e:5e:0c;
fixed-address 10.10.10.1;
group "abc";
}

Why do you need the variable?

karthik537
Thanks a ton for your reply!

Thanks a ton for your reply! :-)

My dhcp version is dhcp-4.2.4.P2-0.20.1 and x86_64 GNU/Linux

I have already used the way you said to use directly "option boot-filename" in the group.
But I like to see the variables working.

BTW, I have used the log function as you said as below.
host 03435 {
hardware ethernet 00:1a:ea:4e:5e:0c;
fixed-address 10.10.10.1;
group "abc";
log(info,fs);
option bootfile-name = fs;
log(info, bootfile-name);
}

I got "sample.tar" in the log 2 times.
This says that the variable fs contains "sample.tar" as well as option bootfile-name.
But the strange thing is that, in this way of assigning the bootfile-name, it is not getting loaded in the target.
So,I have captured the tcpdump and observed in DHCP response packet that there is no option 67 Bootfile-name in Bootstrap Protocol.

Whereas, if I specify "option bootfile-name "sample.tar";", it is loading in the target.
In this case, in the tcpdump, in the DHCP response packet, option 67 Bootfile-name has "sample.tar"

Not able to get where is the problem.

BR,
Karteek

Log in or register to post comments