update... work pending
This commit is contained in:
118
_extras/example_tpls/dnsmasq/ra_dhcpv6.conf.tpl
Normal file
118
_extras/example_tpls/dnsmasq/ra_dhcpv6.conf.tpl
Normal file
@@ -0,0 +1,118 @@
|
||||
{{- /*gotype: r00t2.io/gobroke/runner.TunnelResult*/ -}}
|
||||
{{- $res := . -}}
|
||||
{{- /*
|
||||
In addition to all functions from net, net/netip, and go4.org/netipx
|
||||
(with the exceptions of functions duplicated by methods which can be used by objects
|
||||
returned from the above-mentioned functions),
|
||||
the sprig func map (https://masterminds.github.io/sprig/) is also available.
|
||||
*/ -}}
|
||||
{{- /*
|
||||
Data
|
||||
*/ -}}
|
||||
{{- /*
|
||||
Arbitrary data may be assigned as JSON within the template, and parsed in using the fromJson function.
|
||||
*/ -}}
|
||||
{{- $dataMap := fromJson `{"enp1s0": {"tag": "wan"}}` -}}
|
||||
{{- /*
|
||||
Or explicitly created via sprig.
|
||||
*/ -}}
|
||||
{{- $wan_ifaces := splitList "," "enp1s0,enp2s0" -}}
|
||||
{{- /*
|
||||
Or via the various networking functionality.
|
||||
*/ -}}
|
||||
{{- $pfx := $res.TunnelAfter.Routed64 -}}
|
||||
{{- if $res.TunnelAfter.Has48 -}}
|
||||
{{- $pfx = $res.TunnelAfter.Routed48 }}
|
||||
{{- end -}}
|
||||
{{- /*
|
||||
Settings
|
||||
*/ -}}
|
||||
{{- $v4_wan := -}}
|
||||
{{- /* SLAAC */ -}}
|
||||
{{- /*
|
||||
Maximum seconds allowed between sending unsolicited multicast RAs. 4 < x < 1800
|
||||
If using Mobile Extensions, 0.07 < x 1800
|
||||
*/ -}}
|
||||
{{- $max_inter := 60 -}}
|
||||
{{- /*
|
||||
Minimum seconds allowed between sending unsolicited multicast RAs. 3 < x < (0.75 * max_inter)
|
||||
If using Mobile Extensions, 0.33 < x (e.g. 0.75 * max_inter)
|
||||
*/ -}}
|
||||
{{- $min_inter := 10 -}}
|
||||
{{- /*
|
||||
Minimum seconds between sending multicast RAs (solicited and unsolicited).
|
||||
If using Mobile Extensions, 0.03 < x
|
||||
*/ -}}
|
||||
{{- $min_delay := 3 -}}
|
||||
{{- /*
|
||||
The lifetime associated with the default router in units of seconds. 0 OR max_inter < x < 9000
|
||||
*/ -}}
|
||||
{{- $lifetime := 9000 -}}
|
||||
{{- /* DHCPv6 */ -}}
|
||||
{{- /*
|
||||
How long the lease should last until a new one is requested.
|
||||
*/ -}}
|
||||
{{- $lease_life := 21600 -}}{{- /* 6 hours == 21600 seconds */ -}}
|
||||
{{- /*
|
||||
How long the options are valid for.
|
||||
It generally makes sense to align these with $lease_life.
|
||||
It doesn't have to, but it's a good default most of the time.
|
||||
*/ -}}
|
||||
{{- $opts_life := $lease_life -}}
|
||||
{{-/*
|
||||
Config
|
||||
*/-}}
|
||||
# This file should be *included* in your dnsmasq configuration.
|
||||
# Generated by GoBroke.
|
||||
# See "dnsmasq --help dhcp6" for matching option identifers ("dhcp-option = ..., option6: <option>").
|
||||
enable-ra
|
||||
{{- range $pfxIdx, $pfx := }}
|
||||
{{- 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 %}
|
||||
# * {{ b|string }}
|
||||
{%- endfor %}
|
||||
{%- if do_listen %}
|
||||
listen-address = {{ assignment.iface_ll }}
|
||||
{%- 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.assign_objs %}
|
||||
{%- set dhcp_range = block.dhcp6_range|join(', ') -%}
|
||||
{%- if loop.index0 == 0 %}
|
||||
dhcp-range = {{ id_set }}, {{ dhcp_range }}, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}
|
||||
{%- else %}
|
||||
dhcp-range = {{ identifier }}, {{ dhcp_range }}, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- else %}
|
||||
dhcp-range = {{ id_set }}, ::, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}{#- TODO: check this. #}
|
||||
{%- 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 %}
|
||||
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user