Classifying traffic according to options passed in a host statement

Brian Raaen braaen at zcorum.com
Thu Oct 25 20:10:42 UTC 2007


For everyone's information I have found a solution that works, and requires 
few changes.  My supervisor and I dug through the archives and found some 
other things.  I did not know that you could create variables on the fly, but 
apparently you can as this config works.

This is in the global level.



#dhcpd.conf
# == DOCSIS 1.0 ==
class "docsis 1.0" {
        match if ( substring ( option vendor-class-identifier, 0 , 9 ) 
="docsis1.0" ) or
                 ( substring ( option vendor-class-identifier, 0 , 10 ) 
= "docsis1.0" );
        set docsis-version = "10";
}

# == DOCSIS 1.1 ==
class "docsis 1.1" {
        match if ( substring ( option vendor-class-identifier, 0 , 9 ) 
="docsis1.1" ) or
                 ( substring ( option vendor-class-identifier, 0 , 10 ) 
= "docsis1.1" );
        set docsis-version = "11";
}

# == DOCSIS 2.0 ==
class "docsis 2.0" {
        match if ( substring ( option vendor-class-identifier, 0 , 9 ) 
="docsis2.0" ) or
                 ( substring ( option vendor-class-identifier, 0 , 10 ) 
= "docsis2.0" );
        set docsis-version = "20";
}

include "/etc/dhcpd/modems.conf";




Then I have this in the modems.conf file



#modems.conf
host 003054fffb7e {set modem-config = "153651202sc"; hardware ethernet 
00:30:54:ff:fb:7e;}
host 0000cac6eb42 {set modem-config = "153651202sc"; hardware ethernet 
00:00:ca:c6:eb:42;}
host 000103B17FD6       {set modem-config = "51212802s";        hardware 
ethernet 00:01:03:B1:7F:D6;}




and last I have this in the subnet



#dhcpd.conf - subnet
 filename = concat( modem-config, docsis-version, ".cfg" );



On Thursday 25 October 2007 07:26, Brian Raaen wrote:
> Dear Simon,
> 	Actually I do need to use host for two different reasons.  The first reason 
> is that we have situations where we assign static ip addresses to the 
modems.  
> The second reason is that my company required that my solution did not break 
> the current framework that our provisioning software uses to add modem.  The 
> program our software developers created writes the host statement to a 
> modem.conf file where the modems are tracked.  I checked with the software 
> guy and he said it may not be too difficult to modify the code to use 
> something like 'option modem-conf' in the place of 'filename'.  I had 
thought 
> of using groups, but that would require additional logic in the provisioning 
> software. 
> 
> -- 
> Brian Raaen
> Network Engineer
> braaen at zcorum.com
> 
> On Wednesday 24 October 2007 16:42, Simon Hobson wrote:
> > Brian Raaen wrote:
> > >I am trying to work with our cable modem provisioning system to set up a 
> way
> > >that docsis 1.0, 1.1, and 2.0 would get the correct config files without
> > >having to be statically assigned.  Currently we provision cable modems 
> using
> > >host statements like the following
> > >
> > >host 0000cac6eb42 {filename "153651202sc.cfg"; hardware ethernet
> > >00:00:ca:c6:eb:42;}
> > >host 000103B17FD6 {filename "51212802s.cfg";      hardware ethernet
> > >00:01:03:B1:7F:D6;}
> > >
> > >I need to give it an option other than filename, that the server will use 
> to
> > >evaluate the option.  I tried creating an option called modem-conf like 
the
> > >following
> > >
> > >host 0000cac6eb42       {option modem-config "153651202sc.cfg"; hardware
> > >ethernet 00:00:ca:c6:eb:42;}
> > >host 000103B17FD6       {option modem-config "51212802s.cfg";   hardware
> > >ethernet 00:01:03:B1:7F:D6;}
> > >
> > >and then apply different configs in the subnet using the following code
> > >
> > >if substring (option modem-config, 0, 15)  = "153651202sc.cfg" {
> > >
> > >	if substring (option vendor-class-identifier, 0 , 9) = "docsis2.0" {
> > >		filename = "153651202sc20.cfg";
> > >
> > >	} else if substring (option vendor-class-identifier, 0 , 9) = 
> > >"docsis1.1" {
> > >		filename = "153651202sc11.cfg";
> > >
> > >	} else {
> > >		filename = "153651202sc10.cfg";
> > >
> > >	}
> > >}
> > >
> > >
> > >however all the modems are getting the subnet default file. instead to 
> getting
> > >the different speed files.  I am not sure how I can read the host options 
> to
> > >make assignment decisions.  I would appreciate any help I can get.
> > 
> > OK, do you NEED the host statements ?
> > 
> > Would the classes and subclasses by mac address example in the man 
> > page (man dhcpd.conf) work for you ? Specifically, if all you use the 
> > host statements for is to passing options (such as filename) to a 
> > client, then this could be done through a class. For each client, you 
> > specify which class it should be in, and it gets the options 
> > specified in the class definition.
> > 
> > 
> >
> 
> 
> 

-- 
Brian Raaen
Network Engineer
braaen at zcorum.com
Tel 678-507-5000x5574


More information about the dhcp-users mailing list