-
Notifications
You must be signed in to change notification settings - Fork 1
/
90-dhcp
executable file
·83 lines (67 loc) · 3.65 KB
/
90-dhcp
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
#!/bin/sh
set -e
# Configure dnsmasq for PXE TFTP boot.
#
# Limit DHCP assignments to 1 IP, to prevent accidental concurrent booting
# of multiple clients.
uci batch << EOF
set dhcp.@dnsmasq[0].local='/iscsi/'
set dhcp.@dnsmasq[0].domain='iscsi'
set dhcp.@dnsmasq[0].logdhcp='1'
set dhcp.@dnsmasq[0].enable_tftp='1'
set dhcp.@dnsmasq[0].tftp_root='/srv/pxe/tftp'
#set dhcp.@dnsmasq[0].dhcp_boot='ipxe/x86/ipxe.pxe'
# When assigning DHCP allocations, use "infinite" leases to effictively make
# them static, so that the iSCSI initiator hosts can use them indefinitely
# without interruption and without refreshing them.
set dhcp.lan.leasetime='infinite'
set dhcp.lan.start='2'
set dhcp.lan.limit='8'
set dhcp.lan.force='0'
set dhcp.lan.ignore='0'
# Provide no default route/gateway to the initiator host to let it handle
# its own network connections and routing.
# If you want to route packets through the target host, remove this option.
add_list dhcp.lan.dhcp_option='option:router'
# Start in dnsmasq DHCP Proxy mode by default, for use with existing DHCP servers.
# Will be set back to '0' by /etc/init.d/dhcpfallback if no existing DHCP server
# is found.
set dhcp.lan.proxy='1'
add dhcp userclass
set dhcp.@userclass[-1].networkid='ipxe'
set dhcp.@userclass[-1].userclass='iPXE'
# DHCP Server: dnsmasq --dhcp-boot bootfile-name settings
add dhcp boot
set dhcp.@boot[-1].filename='tag:ipxe,ipxe/entry.ipxe'
add dhcp match
set dhcp.@match[-1].networkid='pcbios'
set dhcp.@match[-1].match='60,PXEClient:Arch:00000'
add dhcp boot
set dhcp.@boot[-1].filename='tag:pcbios,tag:!ipxe,ipxe/x86/ipxe.pxe'
#set dhcp.@boot[-1].filename='tag:pcbios,tag:!ipxe,ipxe/x86/undionly.kpxe'
add dhcp match
set dhcp.@match[-1].networkid='efi_x86_64'
set dhcp.@match[-1].match='60,PXEClient:Arch:00007'
add dhcp match
set dhcp.@match[-1].networkid='efi_x86_64'
set dhcp.@match[-1].match='60,PXEClient:Arch:00009'
add dhcp boot
set dhcp.@boot[-1].filename='tag:efi_x86_64,tag:!ipxe,ipxe/x86_64/ipxe.efi'
#set dhcp.@boot[-1].filename='tag:efi_x86_64,tag:!ipxe,ipxe/x86_64/snponly.efi'
# DHCP PXE Proxy: dnsmasq --pxe-service bootfile-name settings
# In normal DHCP server mode (dhcp.lan.proxy='0'), these must be removed to
# workaround the following issue. /etc/init.d/dhcpfallback does this.
# "pxe-service entries in dnsmasq conf seem to fail non-proxy EFI boot"
# https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q1/014853.html
set dhcp.@dnsmasq[0].pxe_prompt='$(uci get system.@system[0].hostname) - PXE Boot Menu'
add_list dhcp.@dnsmasq[0].pxe_service='tag:!ipxe,x86PC,"$(uci get system.@system[0].hostname) x86PC iPXE",ipxe/x86/ipxe.pxe'
#add_list dhcp.@dnsmasq[0].pxe_service='tag:!ipxe,x86PC,"$(uci get system.@system[0].hostname) x86PC iPXE",ipxe/x86/undionly.kpxe'
add_list dhcp.@dnsmasq[0].pxe_service='tag:ipxe,x86PC,"$(uci get system.@system[0].hostname) x86PC entry.ipxe",ipxe/entry.ipxe'
add_list dhcp.@dnsmasq[0].pxe_service='tag:!ipxe,x86-64_EFI,"$(uci get system.@system[0].hostname) x86-64_EFI iPXE",ipxe/x86_64/ipxe.efi'
#add_list dhcp.@dnsmasq[0].pxe_service='tag:!ipxe,x86-64_EFI,"$(uci get system.@system[0].hostname) x86-64_EFI iPXE",ipxe/x86_64/snponly.efi'
add_list dhcp.@dnsmasq[0].pxe_service='tag:ipxe,x86-64_EFI,"$(uci get system.@system[0].hostname) x86-64_EFI entry.ipxe",ipxe/entry.ipxe'
add_list dhcp.@dnsmasq[0].pxe_service='tag:!ipxe,BC_EFI,"$(uci get system.@system[0].hostname) BC_EFI iPXE",ipxe/x86_64/ipxe.efi'
#add_list dhcp.@dnsmasq[0].pxe_service='tag:!ipxe,BC_EFI,"$(uci get system.@system[0].hostname) BC_EFI iPXE",ipxe/x86_64/snponly.efi'
add_list dhcp.@dnsmasq[0].pxe_service='tag:ipxe,BC_EFI,"$(uci get system.@system[0].hostname) BC_EFI entry.ipxe",ipxe/entry.ipxe'
commit dhcp
EOF