forked from metal3-io/ironic-image
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdnsmasq.conf.j2
More file actions
84 lines (74 loc) · 2.82 KB
/
dnsmasq.conf.j2
File metadata and controls
84 lines (74 loc) · 2.82 KB
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
interface={{ env.PROVISIONING_INTERFACE }}
bind-dynamic
enable-tftp
tftp-root=/shared/tftpboot
log-queries
dhcp-leasefile=/data/dnsmasq/dnsmasq.leases
# Configure listening for DNS (0 disables DNS)
port={{ env.DNS_PORT }}
{%- if env.DHCP_RANGE | length %}
log-dhcp
dhcp-range={{ env.DHCP_RANGE }}
{% endif %}
{%- if env["DNS_IP"] is undefined %}
# Disable DNS over provisioning network
dhcp-option=6
{% else %}
dhcp-option=option{% if ":" in env["DNS_IP"] %}6{% endif %}:dns-server,{{ env["DNS_IP"] }}
{% endif %}
{# Network boot options for IPv4 and IPv6 #}
{%- if env.IPV == "4" or env.IPV is undefined %}
# IPv4 Configuration:
dhcp-match=ipxe,175
{# Set the router or disable it. Setting router is IPv4 specific, in v6 there #}
{# are router advertisements that do the same thing. #}
{%- if env["GATEWAY_IP"] is undefined %}
# Disable default router(s)
dhcp-option=3
{% else %}
dhcp-option=option:router,{{ env["GATEWAY_IP"] }}
{% endif %}
# Note: Need to test EFI booting
dhcp-match=set:efi,option:client-arch,7
dhcp-match=set:efi,option:client-arch,9
# Client is (i)PXE booting on EFI machine
dhcp-boot=tag:efi,/snponly-x86_64.efi,{{ env.IRONIC_IP }}
# Client is (i)PXE booting on arm64 EFI machine
dhcp-match=set:efi-arm64,option:client-arch,11
dhcp-boot=tag:efi-arm64,/snponly-arm64.efi,{{ env.IRONIC_IP }}
# Client is running (i)PXE on BIOS machine
dhcp-boot=tag:!efi,tag:!efi-arm64,/undionly.kpxe,{{ env.IRONIC_IP }}
{%- if env.IPXE_TLS_SETUP != "true" %}
dhcp-boot=tag:ipxe,http://{{ env.IRONIC_URL_HOST }}:{{ env.HTTP_PORT }}/boot.ipxe
{% endif %}
{% endif %}
{% if env.IPV == "6" %}
# IPv6 Configuration:
enable-ra
ra-param={{ env.PROVISIONING_INTERFACE }},0,0
dhcp-vendorclass=set:pxe6,enterprise:343,PXEClient
dhcp-userclass=set:ipxe6,iPXE
# option6:client-arch is not defined in dnsmasq upstream, resort to architecture
# detection via DHCPv6 option 61 (RFC 5970)
# Client is (i)PXE booting on EFI machine
dhcp-match=set:amd64,option6:61,7
dhcp-match=set:amd64,option6:61,9
dhcp-option=tag:pxe6,tag:amd64,option6:bootfile-url,tftp://{{ env.IRONIC_URL_HOST }}/snponly-x86_64.efi
# Client is (i)PXE booting on arm64 EFI machine
dhcp-match=set:arm64,option6:61,11
dhcp-option=tag:pxe6,tag:arm64,option6:bootfile-url,tftp://{{ env.IRONIC_URL_HOST }}/snponly-arm64.efi
# Fallback: serve x86_64 when PXE client is detected but architecture
# could not be determined. Legacy BIOS does not support IPv6 PXE.
dhcp-option=tag:pxe6,tag:!amd64,tag:!arm64,option6:bootfile-url,tftp://{{ env.IRONIC_URL_HOST }}/snponly-x86_64.efi
{%- if env.IPXE_TLS_SETUP != "true" %}
dhcp-option=tag:ipxe6,option6:bootfile-url,{{ env.IRONIC_HTTP_URL }}/boot.ipxe
{% endif %}
{% endif %}
{%- if env.DHCP_IGNORE | length %}
dhcp-ignore={{ env.DHCP_IGNORE }}
{% endif %}
{%- if env.DHCP_HOSTS | length %}
{%- for item in env.DHCP_HOSTS.split(";") %}
dhcp-host={{ item }}
{%- endfor %}
{% endif %}