summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-server/dhcpdv6.conf.tmpl
blob: 45d629928789d3e5b216d05076d2c24883e587ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
### Autogenerated by dhcpv6_server.py ###

# For options please consult the following website:
# https://www.isc.org/wp-content/uploads/2017/08/dhcp43options.html

log-facility local7;
{% if preference is defined and preference is not none %}
option dhcp6.preference {{ preference }};
{% endif %}

{% if global_parameters is defined and global_parameters.name_server is defined and global_parameters.name_server is not none %}
option dhcp6.name-servers {{ global_parameters.name_server | join(', ') }};
{% endif %}

# Shared network configration(s)
{% if shared_network_name is defined and shared_network_name is not none %}
{%   for network, network_config in shared_network_name.items() if network_config.disable is not defined %}
shared-network {{ network | replace('_','-') }} {
{%     if network_config.common_options is defined and network_config.common_options is not none %}
{%       if network_config.common_options.info_refresh_time is defined and network_config.common_options.info_refresh_time is not none %}
    option dhcp6.info-refresh-time {{ network_config.common_options.info_refresh_time }};
{%       endif %}
{%       if network_config.common_options.domain_search is defined and network_config.common_options.domain_search is not none %}
    option dhcp6.domain-search "{{ network_config.common_options.domain_search | join('", "') }}";
{%       endif %}
{%       if network_config.common_options.name_server is defined and network_config.common_options.name_server is not none %}
    option dhcp6.name-servers {{ network_config.common_options.name_server | join(', ') }};
{%       endif %}
{%     endif %}
{%     if network_config.subnet is defined and network_config.subnet is not none %}
{%       for subnet, subnet_config in network_config.subnet.items() %}
    subnet6 {{ subnet }} {
{%         if subnet_config.address_range is defined and subnet_config.address_range is not none %}
{%           if subnet_config.address_range.prefix is defined and subnet_config.address_range.prefix is not none %}
{%             for prefix, prefix_config in subnet_config.address_range.prefix.items() %}
        range6 {{ prefix }} {{ "temporary" if prefix_config.temporary is defined }};
{%             endfor %}
{%           endif %}
{%           if subnet_config.address_range.start is defined and subnet_config.address_range.start is not none %}
{%             for address, address_config in subnet_config.address_range.start.items() %}
        range6 {{ address }} {{ address_config.stop }};
{%             endfor %}
{%           endif %}
{%         endif %}
{%         if subnet_config.domain_search is defined and subnet_config.domain_search is not none %}
        option dhcp6.domain-search "{{ subnet_config.domain_search | join('", "') }}";
{%         endif %}
{%         if subnet_config.lease_time is defined and subnet_config.lease_time is not none %}
{%           if subnet_config.lease_time.default is defined and subnet_config.lease_time.default is not none %}
        default-lease-time {{ subnet_config.lease_time.default }};
{%           endif %}
{%           if subnet_config.lease_time.maximum is defined and subnet_config.lease_time.maximum is not none %}
        max-lease-time {{ subnet_config.lease_time.maximum }};
{%           endif %}
{%           if subnet_config.lease_time.minimum is defined and subnet_config.lease_time.minimum is not none %}
        min-lease-time {{ subnet_config.lease_time.minimum }};
{%           endif %}
{%         endif %}
{%         if subnet_config.name_server is defined and subnet_config.name_server is not none %}
        option dhcp6.name-servers {{ subnet_config.name_server | join(', ') }};
{%         endif %}
{%         if subnet_config.nis_domain is defined and subnet_config.nis_domain is not none %}
        option dhcp6.nis-domain-name "{{ subnet_config.nis_domain }}";
{%         endif %}
{%         if subnet_config.nis_server is defined and subnet_config.nis_server is not none %}
        option dhcp6.nis-servers {{ subnet_config.nis_server | join(', ') }};
{%         endif %}
{%         if subnet_config.nisplus_domain is defined and subnet_config.nisplus_domain is not none %}
        option dhcp6.nisp-domain-name "{{ subnet_config.nisplus_domain }}";
{%         endif %}
{%         if subnet_config.nisplus_server is defined and subnet_config.nisplus_server is not none %}
        option dhcp6.nisp-servers {{ subnet_config.nisplus_server | join(', ') }};
{%         endif %}
{%         if subnet_config.sip_server is defined and subnet_config.sip_server is not none %}
{%           set server_ip = [] %}
{%           set server_fqdn = [] %}
{%           for address in subnet_config.sip_server %}
{%             if address | is_ipv6 %}
{%               set server_ip = server_ip.append(address) %}
{%             else %}
{%               set server_fqdn = server_fqdn.append(address) %}
{%             endif %}
{%           endfor %}
{%           if server_ip is defined and server_ip | length > 0 %}
        option dhcp6.sip-servers-addresses {{ server_ip | join(', ') }};
{%           endif %}
{%           if server_fqdn is defined and server_fqdn | length > 0 %}
        option dhcp6.sip-servers-names "{{ server_fqdn | join('", "') }}";
{%           endif %}
{%         endif %}
{%         if subnet_config.sntp_server is defined and subnet_config.sntp_server is not none %}
        option dhcp6.sntp-servers {{ subnet_config.sntp_server | join(', ') }};
{%         endif %}
{%         if subnet_config.prefix_delegation is defined and subnet_config.prefix_delegation.start is defined and subnet_config.prefix_delegation.start is not none %}
{%           for prefix, prefix_config in subnet_config.prefix_delegation.start.items() %}
        prefix6 {{ prefix }} {{ prefix_config.stop }} /{{ prefix_config.prefix_length }};
{%           endfor %}
{%         endif %}
{%         if subnet_config.static_mapping is defined and subnet_config.static_mapping is not none %}

        # begin configuration of static client mappings
{%           for host, host_config in subnet_config.static_mapping.items() if host_config.disable is not defined %}
        host {{ network | replace('_','-') }}_{{ host | replace('_','-') }} {
{%             if host_config.identifier is defined and host_config.identifier is not none %}
            host-identifier option dhcp6.client-id {{ host_config.identifier }};
{%             endif %}
{%             if host_config.ipv6_address is defined and host_config.ipv6_address is not none %}
            fixed-address6 {{ host_config.ipv6_address }};
{%             endif %}
{%             if host_config.ipv6_prefix is defined and host_config.ipv6_prefix is not none %}
            fixed-prefix6 {{ host_config.ipv6_prefix }};
{%             endif %}
        }
{%           endfor %}
{%         endif %}
    }
{%       endfor %}
{%     endif %}
    on commit {
        set shared-networkname = "{{ network | replace('_','-') }}";
    }
}
{%   endfor %}
{% endif %}