# # Gateway DHCP server configuration (Salt managed) # {%- set sites = salt['pillar.get']('sites', {}) %} {%- set te = salt['pillar.get']('te', {}) %} {%- set node_config = salt['pillar.get']('nodes:' ~ grains['id']) %} {%- set te_prefixes = salt['ffho_net.get_te_prefixes'](te, grains['id'], 'v4') %} # The ddns-updates-style parameter controls whether or not the server will # attempt to do a DNS update when a lease is confirmed. We default to the # behavior of the version 2 packages ('none', since DHCP v2 didn't # have support for DDNS.) ddns-update-style none; log-facility local7; default-lease-time 600; max-lease-time 3600; # Use Anycast DNS server(s) option domain-name-servers 10.132.251.53; {% for site in node_config.get ('sites', [])|sort %} {%- set site_config = sites.get (site) %} {%- set site_prefix = site_config.get ('prefix_v4') %} {%- set brige_ips = salt['ffho_net.get_node_iface_ips'] (node_config, 'br-' ~ site) %} # {{ site }} / {{ site_config.get ('name') }} subnet {{ site_prefix.split ('/')[0] }} netmask {{ salt['ffho_net.cidr_to_dotted_mask'](site_prefix) }} { pool { # monitor: 75% 90% Y {{ grains['nodename'] }}/{{ site }} DHCP pool # Use our own IP as gateway for our clients option routers {{ brige_ips['v4'][0] }}; # Range(s) of IPs to lease to clients {%- for prefix in te_prefixes|sort %} {%- if salt['ffho_net.is_subprefix'] (site_prefix, prefix) %} {%- set prefix_config = te_prefixes.get (prefix) %} {%- if 'dhcp_range' in prefix_config %} range {{ prefix_config.get ('dhcp_range') }}; {%- endif %} {%- endif %} {%- endfor %} } } {% endfor %}