DHCP Custom Options Issue

ucs-4
dhcp

#1

Hello, All,
I am trying to follow the tutorial provided in this link.
https://wiki.univention.de/index.php/Cool_Solution_-_Setting_DHCP-Options
But I when executing the udm dhcp/service modify command I am getting a message that says No modificaion.
Currently I have three UCS servers, one Master and two slaves. Each Slave has its own DHCP range configured within UCS. I have tried running the command on both the master and slaves with the same result. I am not sure what the issue is and i am hoping someone can maybe point me in the right direction.
Thanks!


#2

Hi,

could you post exactly the command you are typing? And what you have done before?
What is the output of
udm dhcp/service list


#3

Hey, Knebb,
Thanks for replying. Here is what I get when plugin udm dhcp/service list. This is on the master server.

DN: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,dc=intranet
  service: coldwell-banker-heritage.intranet

The command I am trying to run is as follows.

udm dhcp/service modify --dn 'cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,dc=intranet' --append option='ntp-servers 192.168.50.35'

When I do it gives me the following reply.

No modification: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,dc=intranet

If I perform those same commands on the slave server I get the same exact results.

I am not sure where to go from here, so any help is greatly appreciated.


#4

Hmmmm… well, all looks good so far. Strange.

ucr search dhcpd ?
udm dhcp/dhcp list ?

But the dhcp service itself is running fine and provides IP addresses to the clients?


#5

Hey,

the command you’ve mentioned works just fine on my test system — but that’s only a bare-bones DHCP installation without additional subnets or pool objects.

Can you please post the full output of univention-ldapsearch -b cn=dhcp,$(ucr get ldap/base) '(!(objectClass=univentionDhcpHost))' ? I’d like to try to replicate your setup as closely as possible (static host entries shouldn’t make a difference, though, hence the exclusion filter in my command). Thanks.

Kind regards,
mosu


#6

Knebb,
Here are the results of the commands. This is all done from my Master server. Both of my slave servers have the dhcp service running and is serving ip addresses without issue.

ucr search dhcpd

dhcpd/options/shoretel-handset/156: string

That contains the eventual custom phone string for my VOIP system.

udm dhcp/dhcp list

DN: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,dc=intranet

Mosu,

Here is the output you have requested.

Start of Log

# extended LDIF
#
# LDAPv3
# base <cn=dhcp,dc=coldwell-banker-heritage,dc=intranet> with scope subtree
# filter: (!(objectClass=univentionDhcpHost))
# requesting: ALL
#

# dhcp, coldwell-banker-heritage.intranet
dn: cn=dhcp,dc=coldwell-banker-heritage,dc=intranet
objectClass: organizationalRole
objectClass: univentionObject
univentionObjectType: container/cn
description: Containing all DHCP Objects as per default Settings
cn: dhcp

# coldwell-banker-heritage.intranet, dhcp, coldwell-banker-heritage.intranet
dn: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,d
 c=intranet
univentionObjectType: dhcp/service
cn: coldwell-banker-heritage.intranet
objectClass: top
objectClass: univentionDhcpService
objectClass: univentionObject

# ucs-corp, coldwell-banker-heritage.intranet, dhcp, coldwell-banker-heritage.i
 ntranet
dn: cn=ucs-corp,cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banke
 r-heritage,dc=intranet
objectClass: top
objectClass: univentionObject
objectClass: dhcpServer
dhcpServiceDN: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker
 -heritage,dc=intranet
univentionObjectType: dhcp/server
cn: ucs-corp

# 192.168.6.0, coldwell-banker-heritage.intranet, dhcp, coldwell-banker-heritag
 e.intranet
dn: cn=192.168.6.0,cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-ba
 nker-heritage,dc=intranet
univentionObjectType: dhcp/subnet
dhcpRange: 192.168.6.26 192.168.6.254
cn: 192.168.6.0
dhcpNetMask: 24
objectClass: top
objectClass: univentionDhcpSubnet
objectClass: univentionObject
objectClass: univentionPolicyReference
univentionPolicyReference: cn=springf,cn=dns,cn=dhcp,cn=policies,dc=coldwell-b
 anker-heritage,dc=intranet
univentionPolicyReference: cn=springf,cn=routing,cn=dhcp,cn=policies,dc=coldwe
 ll-banker-heritage,dc=intranet

# ucs-springf, coldwell-banker-heritage.intranet, dhcp, coldwell-banker-heritag
 e.intranet
dn: cn=ucs-springf,cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-ba
 nker-heritage,dc=intranet
objectClass: top
objectClass: univentionObject
objectClass: dhcpServer
dhcpServiceDN: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker
 -heritage,dc=intranet
univentionObjectType: dhcp/server
cn: ucs-springf

# 192.168.20.0, coldwell-banker-heritage.intranet, dhcp, coldwell-banker-herita
 ge.intranet
dn: cn=192.168.20.0,cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-b
 anker-heritage,dc=intranet
objectClass: top
objectClass: univentionDhcpSubnet
objectClass: univentionObject
objectClass: univentionPolicyReference
univentionObjectType: dhcp/subnet
cn: 192.168.20.0
dhcpNetMask: 24
univentionPolicyReference: cn=default-settings,cn=boot,cn=dhcp,cn=policies,dc=
 coldwell-banker-heritage,dc=intranet
univentionPolicyReference: cn=default-settings,cn=dns,cn=dhcp,cn=policies,dc=c
 oldwell-banker-heritage,dc=intranet
univentionPolicyReference: cn=default-settings,cn=routing,cn=dhcp,cn=policies,
 dc=coldwell-banker-heritage,dc=intranet
dhcpRange: 192.168.20.20 192.168.20.220

# search result
search: 3
result: 0 Success

# numResponses: 7
# numEntries: 6

End of Log

I appreciate you both taking the time to help me.


#7

Hey,

thanks. I just realized something: I explicitly enabled the option “allow custom options” in the DHCP service object on my server. As soon as I disable it, the udm dhcp/service modify command says no modification for me, too.

Unfortunately I don’t see a way to query or change that property from the command line at the moment, neither with the umc command nor with an ldapsearch or ldapmodify. The property doesn’t seem to be stored in the LDAP directory at all.

So please log in to the UMC, go to “DHCP”, edit the service object, switch to the “options” tab and activate “allow custom options”. While you’re there you can enter your ntp-servers option — or just go back to the command line and try your udm command again.

Kind regards,
mosu


#8

Mosu,
Once again you have solved the issue. I didn’t even know we could do the custom options from within the GUI to boot. So that makes thing easier for others to manage it.

I appreciate you taking the time to assist me with this.


#9

Great! And you’re quite welcome.


#10

Hey,

I just love mysteries and figuring out how things work, even though your original problem’s already been solved. I’ve dug a bit further. Toggling that checkbox in the GUI does have an affect in the LDAP directory: it adds the object class dhcpOptions to the object. That is observable through a regular LDAP search (e.g. via univention-ldapsearch -b cn=dhcp,$(ucr get ldap/base) objectclass=univentionDhcpService), but it isn’t observable through udm dhcp/service list.

Warning: now it gets a bit confusing.

As for udm: you can actually enable that through a call to udm dhcp/service modify. The UMC and therefore the udm tool allows for optional features to be enabled via object classes; the aforementioned checkbox in the UMC is one of those. The udm equivalent is called options (those are UMC/udm options, not DHCP options!). In order to enable a specific option, you add the parameter --option NameOfTheOptionToEnable on the call to udm … modify ….

For DHCP options the udm option is called options. Did I mention that this might be confusing? :grin:

So the following call will enable said udm option (= “toggle the checkbox in the UMC”) and set the DHCP options:

udm dhcp/service modify --dn cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,dc=intranet --option options --append option='ntp-servers 192.168.50.35'

I haven’t found a way to remove that UMC/udm option (= to uncheck the checkbox) solely with the udm command line tool, though. One could remove the object class via a direct call to ldapmodify with an LDIF file such as this, of course (after removing all DHCP options & statements from the object, of course, or remove those in the same LDIF file, too):

dn: cn=coldwell-banker-heritage.intranet,cn=dhcp,dc=coldwell-banker-heritage,dc=intranet
changetype: modify
delete: objectclass
objectclass: dhcpOptions

Kind regards,
mosu


#11

Thanks for the detailed explanation and the info. I like knowing how to make these changes via command line. So this will help me tremendously to script future installs out.