2018-10-02 09:12:23 +03:00
option domain-name " { { s t a c k . d o m a i n } } " ;
option domain-name-servers { % for ns in stack.nameservers % } { { ns } } { % if not loop.last % } , { % endif % } { % endfor % } ;
2019-06-29 14:06:35 +03:00
{ % if dhcp.bind_address is defined % }
local-address { { dhcp.bind_address } } ;
{ % endif % }
2018-10-02 09:12:23 +03:00
default-lease-time 600 ;
max-lease-time 7200 ;
ddns-update-style none ;
authoritative ;
class " v m s " {
match if substring ( option vendor-class-identifier , 0 , 4 ) = " S U N W " ;
}
class " p x e " {
match if substring ( option vendor-class-identifier , 0 , 9 ) = " P X E C l i e n t " ;
}
class " i p p h " {
match if ( option vendor-class-identifier = " c c p . a v a y a . c o m "
or option vendor-class-identifier = " A T A 1 8 6 "
or substring ( option vendor-class-identifier , 0 , 28 ) = " C i s c o S y s t e m s , I n c . I P P h o n e " ) ;
}
option option -66 code 66 = text ;
2019-06-29 14:06:35 +03:00
{ % if dhcp.network_ranges is defined % }
{ % for start_net , opts in dhcp.network_ranges.iteritems ( ) % }
{ % set nets = start_net | net_range_to_list ( opts.count ) % }
{ % for n in nets % }
{ % set addr = n.split ( ' / ' ) [ 0 ] % }
{ % set mask = n | ipaddr ( ' netmask ' ) % }
{ % set fto = n.split ( ' . ' ) [ : 3 ] | join ( ' . ' ) % }
{ % set range = fto ~ " . " ~ opts.ip_range_start ~ " " ~ fto ~ " . " ~ opts.ip_range_end % }
subnet { { addr } } netmask { { n | ipaddr ( ' netmask ' ) } } {
option routers { { fto } } . { { opts.default_last_octet } } ;
option domain-name-servers { { opts.nameservers | join ( ' , ' ) } } ;
pool {
range { { range } } ;
}
}
{ % endfor % }
{ % endfor % }
{ % endif % }
{ % if dhcp.networks is defined % }
2018-10-02 09:12:23 +03:00
{ % for addr , net in dhcp.networks.iteritems ( ) % }
{ % if net.hosts is defined % }
{ % for h in net.hosts % }
host { { net.vlan } } - { { h.name } } {
hardware ethernet { { h.mac } } ;
fixed-address { { h.ipv4 } } ;
}
{ % endfor % }
{ % endif % }
subnet { { addr.split ( ' / ' ) [ 0 ] } } netmask { { addr | ipaddr ( ' netmask ' ) } } {
option routers { { net.default } } ;
option domain-name-servers { { net.nameservers | join ( ' , ' ) } } ;
{ % if " b o o t p " in net.keys ( ) % }
option option -66 " { { n e t . b o o t p . t f t p } } / y e a l i n k / " ;
{ % endif % }
{ % if " p x e " in net.keys ( ) % }
next-server { { net.pxe [ ' next-server ' ] } } ;
filename " { { n e t . p x e . f i l e n a m e } } " ;
{ % endif % }
pool {
range { { net.range } } ;
}
}
{ % endfor % }
2019-06-29 14:06:35 +03:00
{ % endif % }