summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-server/dhcpdv6.conf.j2
blob: 43327859e255dee08cf9e2e69f0e52b5e7cee099 (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
125
126
127
128
129
130
131
132
### 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 vyos_defined %}
option dhcp6.preference {{ preference }};
{% endif %}

{% if global_parameters.name_server is vyos_defined %}
option dhcp6.name-servers {{ global_parameters.name_server | join(', ') }};
{% endif %}
{% if vsio_cisco_tftp %}
option space cisco;
option cisco.tftp-servers code 1 = array of ip6-address;
option vsio.cisco code 9 = encapsulate cisco;
{% endif %}

# Shared network configration(s)
{% if shared_network_name is vyos_defined %}
{%     for network, network_config in shared_network_name.items() if network_config.disable is not vyos_defined %}
shared-network {{ network }} {
{%         if network_config.common_options is vyos_defined %}
{%             if network_config.common_options.info_refresh_time is vyos_defined %}
    option dhcp6.info-refresh-time {{ network_config.common_options.info_refresh_time }};
{%             endif %}
{%             if network_config.common_options.domain_search is vyos_defined %}
    option dhcp6.domain-search "{{ network_config.common_options.domain_search | join('", "') }}";
{%             endif %}
{%             if network_config.common_options.name_server is vyos_defined %}
    option dhcp6.name-servers {{ network_config.common_options.name_server | join(', ') }};
{%             endif %}
{%         endif %}
{%         if network_config.subnet is vyos_defined %}
{%             for subnet, subnet_config in network_config.subnet.items() %}
    subnet6 {{ subnet }} {
{%                 if subnet_config.address_range is vyos_defined %}
{%                     if subnet_config.address_range.prefix is vyos_defined %}
{%                         for prefix, prefix_config in subnet_config.address_range.prefix.items() %}
        range6 {{ prefix }} {{ "temporary" if prefix_config.temporary is vyos_defined }};
{%                         endfor %}
{%                     endif %}
{%                     if subnet_config.address_range.start is vyos_defined %}
{%                         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 vyos_defined %}
        option dhcp6.domain-search "{{ subnet_config.domain_search | join('", "') }}";
{%                 endif %}
{%                 if subnet_config.lease_time is vyos_defined %}
{%                     if subnet_config.lease_time.default is vyos_defined %}
        default-lease-time {{ subnet_config.lease_time.default }};
{%                     endif %}
{%                     if subnet_config.lease_time.maximum is vyos_defined %}
        max-lease-time {{ subnet_config.lease_time.maximum }};
{%                     endif %}
{%                     if subnet_config.lease_time.minimum is vyos_defined %}
        min-lease-time {{ subnet_config.lease_time.minimum }};
{%                     endif %}
{%                 endif %}
{%                 if subnet_config.name_server is vyos_defined %}
        option dhcp6.name-servers {{ subnet_config.name_server | join(', ') }};
{%                 endif %}
{%                 if subnet_config.nis_domain is vyos_defined %}
        option dhcp6.nis-domain-name "{{ subnet_config.nis_domain }}";
{%                 endif %}
{%                 if subnet_config.nis_server is vyos_defined %}
        option dhcp6.nis-servers {{ subnet_config.nis_server | join(', ') }};
{%                 endif %}
{%                 if subnet_config.nisplus_domain is vyos_defined %}
        option dhcp6.nisp-domain-name "{{ subnet_config.nisplus_domain }}";
{%                 endif %}
{%                 if subnet_config.nisplus_server is vyos_defined %}
        option dhcp6.nisp-servers {{ subnet_config.nisplus_server | join(', ') }};
{%                 endif %}
{%                 if subnet_config.sip_server is vyos_defined %}
{%                     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 vyos_defined and server_ip | length > 0 %}
        option dhcp6.sip-servers-addresses {{ server_ip | join(', ') }};
{%                     endif %}
{%                     if server_fqdn is vyos_defined and server_fqdn | length > 0 %}
        option dhcp6.sip-servers-names "{{ server_fqdn | join('", "') }}";
{%                     endif %}
{%                 endif %}
{%                 if subnet_config.sntp_server is vyos_defined %}
        option dhcp6.sntp-servers {{ subnet_config.sntp_server | join(', ') }};
{%                 endif %}
{%                 if subnet_config.prefix_delegation.start is vyos_defined %}
{%                     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 vyos_defined %}

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