summaryrefslogtreecommitdiffstats
path: root/raddb/mods-available/dhcp_sqlippool
blob: 909b93c7ebcbbeb16b123ca38e696790b5771dda (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
#  Configuration for DHCP for the SQL based IP Pools module (rlm_sqlippool).
#
#  See raddb/mods-available/sqlippool for common configuration explanation
#
#  See raddb/policy.d/dhcp_sqlippool for the "glue" code that allows
#  the RADIUS based "sqlippool" module to be used for DHCP.
#
#  See raddb/sites-available/dhcp for instructions on how to configure
#  the DHCP server.
#
#  The database schemas are available at:
#
#       raddb/mods-config/sql/ippool-dhcp/<DB>/schema.sql
#
#  $Id$

sqlippool dhcp_sqlippool {
	# SQL instance to use (from mods-available/sql)
	#
	#  If you have multiple sql instances, such as "sql sql1 {...}",
	#  use the *instance* name here: sql1.
	sql_module_instance = "dhcp_sql"

	#  This is duplicative of info available in the SQL module, but
	#  we have to list it here as we do not yet support nested
	#  reference expansions.
	dialect = "mysql"

	# Name of the check item attribute to be used as a key in the SQL queries
	pool_name = "Pool-Name"

	# SQL table to use for ippool range and lease info
	ippool_table = "dhcpippool"

	# The duration for which a lease is reserved whilst under offer
	offer_duration = 10

	# IP lease duration. (Leases expire even if no DHCP-Release packet is received)
	# Either use the value to be sent to the client or a hard coded one.
	lease_duration = "%{reply:DHCP-IP-Address-Lease-Time}"
	#lease_duration = 7200

	#  The attribute in which the IP address is returned in the reply
	attribute_name = "DHCP-Your-IP-Address"

	#  Assign the IP address, even if the above attribute already exists in
	#  the reply.
	#
#	allow_duplicates = no

	#  The attribute in which an IP address hint may be supplied
	req_attribute_name = "DHCP-Requested-IP-Address"

	#
	#  RFC 2132 allows the DHCP client to supply a unique
	#  identifier ("uid") using Option 61 (DHCP-Client-Identifier)
	#  in which case it must be used as the lookup key for
	#  configuration data.
	#
	pool_key = "%{%{DHCP-Client-Identifier}:-%{DHCP-Client-Hardware-Address}}"
	#
	#  The "uid" is generated by the OS which means that clients
	#  whose BMC piggybacks on the main interface (sharing its MAC,
	#  but generating a distinct uid) and dual-booting clients can
	#  be allocated multiple IPs, consuming more pool entries. To
	#  avoid this you can ignore the RFCs and key the configuration
	#  data based only on the client MAC address.
	#
	#  pool_key = "%{DHCP-Client-Hardware-Address}"

	################################################################
	#
	#  WARNING: MySQL (MyISAM) has certain limitations that means it can
	#           hand out the same IP address to 2 different users.
	#
	#           We suggest using an SQL DB with proper transaction
	#           support, such as PostgreSQL, or using MySQL
	#	     with InnoDB.
	#
	################################################################

	#  These messages are added to the "control" items, as
	#  Module-Success-Message.  They are not logged anywhere else,
	#  unlike previous versions.  If you want to have them logged
	#  to a file, see the "linelog" module, and create an entry
	#  which writes Module-Success-Message message.
	#
	messages {
		exists = "DHCP: Existing IP: %{reply:${..attribute_name}} (cid %{DHCP-Client-Identifier} chaddr %{DHCP-Client-Hardware-Address} giaddr %{DHCP-Gateway-IP-Address})"

		success = "DHCP: Allocated IP: %{reply:${..attribute_name}} from %{control:${..pool_name}} (cid %{DHCP-Client-Identifier} chaddr %{DHCP-Client-Hardware-Address} giaddr %{DHCP-Gateway-IP-Address})"

		clear = "DHCP: Released IP %{DHCP-Client-IP-Address} (cid %{DHCP-Client-Identifier} chaddr %{DHCP-Client-Hardware-Address} giaddr %{DHCP-Gateway-IP-Address})"

		failed = "DHCP: IP Allocation FAILED from %{control:${..pool_name}} (cid %{DHCP-Client-Identifier} chaddr %{DHCP-Client-Hardware-Address} giaddr %{DHCP-Gateway-IP-Address})"

		nopool = "DHCP: No ${..pool_name} defined (cid %{DHCP-Client-Identifier} chaddr %{DHCP-Client-Hardware-Address} giaddr %{DHCP-Gateway-IP-Address})"
	}

	$INCLUDE ${modconfdir}/sql/ippool-dhcp/${dialect}/queries.conf
}