Cool Solution - Setting DHCP-Options
From Univention Wiki
Some systems, such as VOIP Phones or door keys require additional options as part of their DHCP Lease. These can be set via the UDM Commandline interface. The purpose of this article is to describe how to set these up in UCS.
The Entries in the DHCP configuration consist of two parts which are the triplet of option Name, Code and the actual value. The triplet is the same across all DHCP subnets and most, such as the time-servers pointer, are standardized and inbuilt into UCS. The value, however, can be different across the different subnets. The predefined options don't have to be redefined. Their Names and Specifications can be found on the dhcp-options Manual page (Section: Standard Dhcpv4 Options) and the IETF Internet standards it builds on.
Custom option code triplets can be set via UCR. It is recommended to use a global policy to ensure a consistent setting across all servers.
The variables are formed like
The possible types can again be found on the dhcp-options Manual page (Section: Defining New Options).
Let us use the 'time-servers', 'ntp-servers' and 'shoretel-handset' options as an example. 'time-servers' and 'ntp-servers' are standard options and there is no need to redefine the code values. To set the vendor option for the ShoreTel VOIP phones on a single server, issue the following command:
ucr set dhcpd/options/shoretel-handset/156=string
Setting the Value
The value of the options is set via the LDAP. Currently, this is only possible from the command line. First, you need to find the subnet which you would like to change.
udm dhcp/dhcp list
The result will be a list of DHCP objects.
root@ucs-2788:~# udm dhcp/service list DN: cn=univention.intranet,cn=dhcp,dc=univention,dc=intranet ARG: None service: univention.intranet
We need the DN to modify the object and set the options with the following command
udm dhcp/service modify --dn '<DN of the service>' --append option='time-servers <IP UCS-Master>' \ --append option='ntp-servers <IP UCS-Master>' --append option='shoretel-handset "<config>"'
Please pay attention to the quoting. The DHCP configuration requires strings, like for the ShoreTel config, to be enclosed in ". In my example, this would result in the following command
udm dhcp/service modify --dn 'cn=univention.intranet,cn=dhcp,dc=univention,dc=intranet' --append option='time-servers 10.200.10.10' \ --append option='ntp-servers 10.200.10.10' --append option='shoretel-handset "ftpservers=10.200.10.15,country=1,language=1,layer2tagging=1,vlanid=2"'
Please be aware that the time-servers and ntp-servers variables should be set to a UCS Domain Controller, to ensure Kerberos is working correctly.