<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Cèdric,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Have you tried having each shared-network/subnet in its own include file.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Then include a file with "members of" statements within that?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ie:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="color:#000000;background-color:#ffffff;font-family:Menlo, Monaco, 'Courier New', monospace;font-weight:normal;font-size:12px;line-height:18px">
<span><span>dhcpd.conf:</span></span>
<div><span> class </span><span style="color:#a31515">"allocation-class-1"</span><span> {</span></div>
<div><span> match pick-first-value (option dhcp-client-identifier, hardware)</span><span style="color:#008000">;</span></div>
<div><span> }</span></div>
<br>
<div><span> class </span><span style="color:#a31515">"allocation-class-2"</span><span> {</span></div>
<div><span> match pick-first-value (option dhcp-client-identifier, hardware)</span><span style="color:#008000">;</span></div>
<div><span> }</span></div>
<br>
<div><span> allow members of </span><span style="color:#a31515">"allocation-class-1"</span><span style="color:#008000">;</span></div>
<div><span> allow members of </span><span style="color:#a31515">"allocation-class-1"</span><span style="color:#008000">;</span></div>
<br>
<div><span> class </span><span style="color:#a31515">"allocation-class-1"</span><span> {</span></div>
<div><span> match pick-first-value (option dhcp-client-identifier, hardware)</span><span style="color:#008000">;</span></div>
<div><span> }</span></div>
<br>
<div><span> class </span><span style="color:#a31515">"allocation-class-2"</span><span> {</span></div>
<div><span> match pick-first-value (option dhcp-client-identifier, hardware)</span><span style="color:#008000">;</span></div>
<div><span> }</span></div>
<div><span> subclass </span><span style="color:#a31515">"allocation-class-1"</span><span> 1:8:0:2b:4c:39:ad</span><span style="color:#008000">;</span></div>
<div><span> subclass </span><span style="color:#a31515">"allocation-class-2"</span><span> 1:8:0:2b:a9:cc:e3</span><span style="color:#008000">;</span></div>
<div><span> subclass </span><span style="color:#a31515">"allocation-class-1"</span><span> 1:0:0:c4:aa:29:44</span><span style="color:#008000">;</span></div>
<br>
<div><span> include </span><span style="color:#a31515">"subnet-1.include"</span><span style="color:#008000">;</span></div>
<div><span>...</span></div>
<br>
<div><span>subnet-1.include:</span></div>
<div><span>shared-network </span><span style="color:#a31515">"SN1"</span><span> {</span></div>
<div><span> subnet 10.0.0.0 netmask 255.255.255.0 {</span></div>
<div><span> option routers 10.0.0.1</span><span style="color:#008000">;</span></div>
<div><span> pool { </span></div>
<div><span> </span><span style="color:#008000">#include "access-1.include";</span></div>
<div><span> range 10.0.0.10 10.0.0.254</span><span style="color:#008000">; } }</span></div>
<div><span>}</span></div>
<br>
<div><span>access-2.include:</span></div>
<div><span>allow members of </span><span style="color:#a31515">"allocation-class-1"</span><span style="color:#008000">;</span></div>
<div><span>allow members of </span><span style="color:#a31515">"allocation-class-2"</span><span style="color:#008000">;</span></div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This appears to work</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kind Regards Peter</div>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div></div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> dhcp-users <dhcp-users-bounces@lists.isc.org> on behalf of BASSAGET Cédric <cedric.bassaget.ml@gmail.com><br>
<b>Sent:</b> 09 November 2021 09:21<br>
<b>To:</b> dhcp-users@lists.isc.org <dhcp-users@lists.isc.org><br>
<b>Subject:</b> include in pool</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hello.
<div>I have to configure a dhcp server wich will act as master for dozens of relays.</div>
<div>My basic pool config includes a lot of "allow members of" statements, like this :</div>
<div><br>
</div>
<div><br>
</div>
<div>subnet 192.168.2.0 netmask 255.255.255.0 {<br>
option routers 192.168.2.1;<br>
#option domain-name-servers 192.168.2.1;<br>
#option bootfile-name = "snom821.htm";<br>
pool {<br>
range 192.168.2.100 192.168.2.200;<br>
### Assign who is going to use this pool<br>
allow members of "voip-mac-address-prefix";<br>
# allow localhost for NRPE<br>
# allow members of "localhost";<br>
# Aastra<br>
allow members of "Aastra6730i";<br>
allow members of "Aastra6731i";<br>
allow members of "Aastra6739i";<br>
allow members of "Aastra6751i";<br>
allow members of "Aastra6753i";<br>
allow members of "Aastra6755i";<br>
allow members of "Aastra6757i";<br>
# Snom<br>
allow members of "Snom300";<br>
allow members of "Snom320";<br>
allow members of "Snom360";<br>
allow members of "Snom370";<br>
allow members of "Snom820";<br>
</div>
<div> ....</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div>As I have to create dozens of pools, I tried to put all these "allow members of ..." in a file called "allowed_members.include", and replace my pool def by :</div>
<div><br>
</div>
<div>subnet 192.168.2.0 netmask 255.255.255.0 {<br>
option routers 192.168.2.1;<br>
pool {<br>
</div>
<div> include "path/to/allowed_members.include";</div>
<div> }</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>but it does not work, it throws a config error when testing config.</div>
<div><br>
</div>
<div>So my questions are :</div>
<div>- is there a way to do an "include" inside a pool ?</div>
<div>- is there another way to declare multiple pools for each relay ? (all relays will have the same config)</div>
<div><br>
</div>
<div>The aim of this is to have a small and comprehensible dhcpd.conf file.</div>
<div><br>
</div>
<div><br>
</div>
<div>Regards,</div>
<div>Cédric</div>
<div><br>
</div>
</div>
</div>
</body>
</html>