Subversion Repositories configs

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
# -*- text -*-
2
######################################################################
3
#
4
#	This is a virtual server that handles DHCP.
5
#
6
#		!!!! WARNING !!!!
7
#
8
#	This code is experimental, and SHOULD NOT be used in a
9
#	production system.  It is intended for validation and
10
#	experimentation ONLY.
11
#
12
#	In order for this to work, you will need to run configure:
13
#
14
#		$ ./configure --with-dhcp
15
#		$ make
16
#		$ vi share/dictionary
17
#
18
#	## Un-comment the line containing $INCLUDE dictionary.dhcp
19
#	## Then, save the file.
20
#
21
#		$ make install
22
#
23
#	DHCP is NOT enabled by default.
24
#
25
#	The goal of this effort is to get the code in front of
26
#	people who are interested in another DHCP server.
27
#	We NEED FEEDBACK, patches, bug reports, etc.  Especially patches!
28
#
29
#	Please contribute, or this work will be nothing more than
30
#	a curiosity.
31
#
32
#
33
#	Q: What does it do?
34
#	A: It allows the server to receive DHCP packets, and to
35
#	   respond with static, pre-configured DHCP responses.
36
#
37
#	Q: Does it do static/dynamic IP assignment?
38
#	A: No.  Or, maybe.  Try it and see.
39
#
40
#	Q: Does it read ISC configuration or lease files?
41
#	A: No.  Please submit patches.
42
#
43
#	Q: Does it have DHCP feature X?
44
#	A: No.  Please submit patches.
45
#
46
#	Q: Does it support option 82?
47
#	A: Yes.
48
#
49
#	Q: Does it support other options?
50
#	A: Maybe.  See dictionary.dhcp.  Please submit patches.
51
#
52
#	Q: It doesn't seem to do much of anything!
53
#	A: Exactly.
54
#
34 - 55
#	$Id: 33da1f10a67dd38b889300bc998737a268ef0948 $
4 - 56
#
57
######################################################################
58
 
59
#
60
#  The DHCP functionality goes into a virtual server.
61
#
62
server dhcp {
63
 
64
#  Define a DHCP socket.
65
#
66
#  The default port below is 6700, so you don't break your network.
67
#  If you want it to do real DHCP, change this to 67, and good luck!
68
#
69
#  You can also bind the DHCP socket to an interface.
70
#  See below, and raddb/radiusd.conf for examples.
71
#
72
#  This lets you run *one* DHCP server instance and have it listen on
73
#  multiple interfaces, each with a separate policy.
74
#
75
#  If you have multiple interfaces, it is a good idea to bind the
76
#  listen section to an interface.  You will also need one listen
77
#  section per interface.
78
#
79
#  FreeBSD does *not* support binding sockets to interfaces.  Therefore,
80
#  if you have multiple interfaces, broadcasts may go out of the wrong
81
#  one, or even all interfaces.  The solution is to use the "setfib" command.
82
#  If you have a network "10.10.0/24" on LAN1, you will need to do:
83
#
84
#  Pick any IP on the 10.10.0/24 network
85
#	$ setfib 1 route add default 10.10.0.1
86
#
87
#  Edit /etc/rc.local, and add a line:
88
#	setfib 1 /path/to/radiusd
89
#
90
#  The kern must be built with the following options:
91
#	options    ROUTETABLES=2
92
#  or any value larger than 2.
93
#
94
# The other only solution is to update FreeRADIUS to use BPF sockets.
95
#
34 - 96
 
97
	#  So that we only specify these values once, and then
98
	#  use them in all of the listen sections.
99
	port = 6700
4 - 100
	ipaddr = 127.0.0.1
34 - 101
	interface = lo0
4 - 102
 
34 - 103
	#  When the machine is not Linux, or has only one network
104
	#  interface, use the following listener.  It receives
105
	#  broadcast *and* unicast packets.
106
	listen {
107
		type = dhcp
108
 
109
		ipaddr = *
110
		port = ${..port}
111
		interface = ${..interface}
112
 
113
		# The DHCP server defaults to allowing broadcast packets.
114
		# Set this to "no" only when the server receives *all* packets
115
		# from a relay agent.  i.e. when *no* clients are on the same
116
		# LAN as the DHCP server.
117
		#
118
		# It's set to "no" here for testing.
119
		broadcast = no
120
	}
121
 
122
	# When the machine is Linux and has multiple network interfaces, use
123
	# the following two listeners instead of the one above.
124
 
125
	#  Listen for broadcasts on a specific interface.
126
	listen {
127
		type = dhcp
128
		ipaddr = 255.255.255.255
129
		port = ${..port}
130
		interface = ${..interface}
131
 
132
		#
133
		#  The source IP for unicast packets is chosen from the first
134
		#  one of the following items which returns a valid IP
135
		#  address:
136
		#
137
		#	src_ipaddr
138
		#	ipaddr
139
		#	reply:DHCP-Server-IP-Address
140
		#	reply:DHCP-DHCP-Server-Identifier
141
		#
142
		#  For now, use the parent's "ipaddr", not the one
143
		#  in this listen section
144
		#
145
                src_ipaddr = ${..ipaddr}
146
	}
147
 
148
	#  Listen for unicasts on an IP, but not bound to any interface.
149
	#  This allows Linux systems to receive packets on interface X
150
	#  when the IP is associated with interface Y.
4 - 151
	#
34 - 152
	#  Then, define which interface the packets go out of, via
153
	#  "src_interface".  This means that the outbound packets
154
	#  get sent via the correct interface.
155
	listen {
156
		type = dhcp
157
		ipaddr = ${..ipaddr}
158
		port = ${..port}
4 - 159
 
34 - 160
		#
161
		#  When sending unicast responses, this interface is
162
		#  used as the source interface.  If unset, the value
163
		#  is taken from the "interface" field in this
164
		#  section.
165
		#
166
		#  This interface is also used when adding ARP entries.
167
		#  FreeRADIUS doesn't open "raw" network sockets to send
168
		#  unicast DHCP responses on the local network.  Instead,
169
		#  it updates the ARP table for this interface with the
170
		#  MAX and IP of the DHCP client.  The server can then
171
		#  send a normal UDP unicast socket.
172
		#
173
		#  NOTE: The server MUST be running as "root" in order
174
		#  to update the ARP table.  Or, it must have the
175
		#  apropriate capabilities added to it after it starts up.
176
		#
177
		src_interface = ${..interface}
178
	}
179
 
4 - 180
#  Packets received on the socket will be processed through one
181
#  of the following sections, named after the DHCP packet type.
182
#  See dictionary.dhcp for the packet types.
183
dhcp DHCP-Discover {
184
	update reply {
185
	       DHCP-Message-Type = DHCP-Offer
186
	}
187
 
188
	#  The contents here are invented.  Change them!
189
	update reply {
190
	        DHCP-Domain-Name-Server = 127.0.0.1
191
	        DHCP-Domain-Name-Server = 127.0.0.2
192
		DHCP-Subnet-Mask = 255.255.255.0
193
		DHCP-Router-Address = 192.168.1.1
194
		DHCP-IP-Address-Lease-Time = 86400
195
		DHCP-DHCP-Server-Identifier = 192.168.1.1
196
	}
197
 
198
	#  Do a simple mapping of MAC to assigned IP.
199
	#
200
	#  See below for the definition of the "mac2ip"
201
	#  module.
202
	#
203
	#mac2ip
204
 
205
	#  If the MAC wasn't found in that list, do something else.
206
	#  You could call a Perl, Python, or Java script here.
207
 
208
	#if (notfound) {
209
	# ...
210
	#}
211
 
34 - 212
	#  Or, allocate IPs from the DHCP pool in SQL.
213
#	dhcp_sqlippool
214
 
4 - 215
	ok
216
}
217
 
218
dhcp DHCP-Request {
219
	update reply {
220
	       DHCP-Message-Type = DHCP-Ack
221
	}
222
 
223
	#  The contents here are invented.  Change them!
224
	update reply {
225
	        DHCP-Domain-Name-Server = 127.0.0.1
226
	        DHCP-Domain-Name-Server = 127.0.0.2
227
		DHCP-Subnet-Mask = 255.255.255.0
228
		DHCP-Router-Address = 192.168.1.1
229
		DHCP-IP-Address-Lease-Time = 86400
230
		DHCP-DHCP-Server-Identifier = 192.168.1.1
231
	}
232
 
233
	#  Do a simple mapping of MAC to assigned IP.
234
	#
235
	#  See below for the definition of the "mac2ip"
236
	#  module.
237
	#
238
	#mac2ip
239
 
240
	#  If the MAC wasn't found in that list, do something else.
241
	#  You could call a Perl, Python, or Java script here.
242
 
243
	#if (notfound) {
244
	# ...
245
	#}
246
 
34 - 247
	#  Or, allocate IPs from the DHCP pool in SQL.
248
#	dhcp_sqlippool
249
 
4 - 250
	ok
251
}
252
 
253
#  If there's no named section for the packet type, then the packet
254
#  is processed through this section.
255
dhcp {
256
	# send a DHCP NAK.
257
	reject
258
}
259
 
260
 
261
}
262
 
263
######################################################################
264
#
265
#  This next section is a sample configuration for the "passwd"
266
#  module, that reads flat-text files.  It should go into
267
#  radiusd.conf, in the "modules" section.
268
#
269
#  The file is in the format <mac>,<ip>
270
#
271
#	00:01:02:03:04:05,192.168.1.100
272
#	01:01:02:03:04:05,192.168.1.101
273
#	02:01:02:03:04:05,192.168.1.102
274
#
275
#  This lets you perform simple static IP assignment.
276
#
277
######################################################################
278
 
279
#passwd mac2ip {
280
#	filename = ${confdir}/mac2ip
281
#	format = "*DHCP-Client-Hardware-Address:=DHCP-Your-IP-Address"
282
#	delimiter = ","
283
#}