$(section\name) syntax for INI file variables

Since version 2.0 of the DHCP Server the $(section\name) syntax can be used in the INI file. This helps to keep the INI file simple and prevents repeating information such as IP addresses in many places. Here is an example of a typical INI file:

[Settings]
IPBIND_1=192.168.17.2
IPPOOL_1=192.168.17.2-50
AssociateBindsToPools=1

[DNS-Settings]
EnableDNS=1

[General]
SUBNETMASK=255.255.255.0
DNS_1=192.168.17.2

A clean and simple INI file with one IP pool and DNS enabled. If the IPBIND_1 interface ever changes, then one would need to change the IP address 192.168.17.2 in three places. No big deal but can be avoided with the following INI file utilizing the $(section\name) syntax:

[Settings]
IPBIND_1=192.168.17.2
IPPOOL_1=$(Settings\IPBIND_1)-50
AssociateBindsToPools=1

[DNS-Settings]
EnableDNS=1

[General]
SUBNETMASK=255.255.255.0
DNS_1=$(IPBIND_1)

If the interface ever changes then only IPBIND_1 needs to be edited. $(IPBIND_1) is equivalent to $(Settings\IPBIND_1). Settings is sort of the default section. $(section\name) can be used for everything in the INI file. It can even be used for INI file entries that the DHCP Server doesn’t even know. Here is an example showing the usage for directories:

[Settings]
BaseDir="d:\dhcpsrv" ; dhcpsrv.exe resides here 
IPBIND_1=192.168.17.2
IPPOOL_1=$(Settings\IPBIND_1)-50
AssociateBindsToPools=1
Trace=1
TraceFile="$(BaseDir)\dhcptrc.txt" ; trace file

[DNS-Settings]
EnableDNS=1

[General]
SUBNETMASK=255.255.255.0
DNS_1=$(IPBIND_1)

[TFTP-Settings]
EnableTFTP=1
Root="$(BaseDir)\wwwroot" ; use wwwroot for http and tftp 

[HTTP-Settings]
EnableHTTP=1
Root="$(BaseDir)\wwwroot" ; use wwwroot for http and tftp 

This way the base dírectory of DHCP Server can be changed easily in one single place and the trace file and all the other entries that refer to files are always correct.