routerbox/utils/he_ipv6/tpl/dnsmasq.include.j2

55 lines
2.2 KiB
Plaintext
Raw Normal View History

2020-05-18 04:59:00 -04:00
{%- import '_common.j2' as common_opts with context -%}
2020-05-15 18:01:03 -04:00
# This file should be *included* in your dnsmasq configuration.
2020-05-18 04:59:00 -04:00
# Generated by he_ipv6.
# See "dnsmasq --help dhcp6" for matching option identifers ("dhcp-option = ..., option6: <option>").
enable-ra
{% for assignment in assignments %}
{%- set assign_loop = loop -%}
{%- set ra_opts = [] -%}
{%- if assignment.ra_tag -%}
{%- set id_set = 'tag:' + assignment.ra_tag -%}
{%- set identifier = id_set -%}
{%- set do_listen = false -%}
{%- else -%}
{%- set id_set = 'set:' + assignment.iface -%}
{%- set identifier = 'tag:' + assignment.iface -%}
{%- set do_listen = true -%}
{%- endif -%}
{%- if assignment.ra_dhcp is false -%}
{%- do ra_opts.append('ra-only') -%}
{%- if assignment.ra_other is true -%}
{%- do ra_opts.append('ra-stateless') -%}
{%- endif -%}
{%- endif -%}
{%- do ra_opts.append('slaac') -%}
{%- do ra_opts.append('ra-names') -%}
# {{ assignment.iface }} assignment
# Assignment blocks:
{%- for b in assignment.iface_blocks %}
2020-05-18 07:11:59 -04:00
# * {{ b|string }} {{ assignment.dhcp6_ranges[assign_loop.index0] }}
{%- endfor %}
2020-05-18 04:59:00 -04:00
{%- if do_listen %}
2020-05-18 06:21:48 -04:00
listen-address = {{ assignment.iface_ll }}
2020-05-18 04:59:00 -04:00
{%- endif %}
ra-param = {{ assignment.iface }}, mtu:{{ common_opts.mtu }}, high, {{ common_opts.min_delay }}, {{ common_opts.lifetime }}
{%- if assignment.ra_dhcp %}
{%- for block in assignment.iface_blocks %}
{%- if loop.index0 == 0 %}
2020-05-18 04:59:00 -04:00
dhcp-range = {{ id_set }}, {{ assignment.dhcp6_ranges[assign_loop.index0]|join(', ') }}, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}
{%- else %}
dhcp-range = {{ identifier }}, {{ assignment.dhcp6_ranges[assign_loop.index0]|join(', ') }}, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}
2020-05-18 06:56:19 -04:00
{%- endif %}
2020-05-18 04:59:00 -04:00
{%- endfor %}
{%- else %}
dhcp-range = {{ id_set }}, ::, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}{#- TODO: check this. #}
2020-05-18 04:59:00 -04:00
{%- endif %}
dhcp-option = {{ identifier }}, option6:information-refresh-time, {{ common_opts.opts_life }}
{%- if assignment.ra_dns %}
dhcp-option = {{ identifier }}, option6:dns-server, [{{ assignment.iface_ll }}]
{%- endif %}
{%- if assignment.ra_domains %}
dhcp-option = {{ identifier }}, option6:domain-search, {{ assignment.ra_domains|join(',') }}
{%- endif %}
2020-05-15 18:01:03 -04:00
2020-05-18 04:59:00 -04:00
{% endfor %}