More documentation that people might read
[freeradius.git] / raddb / sites-available / dhcp
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 #               $ make install
17 #
18 #       DHCP is NOT enabled by default.
19 #
20 #       The goal of this effort is to get the code in front of
21 #       people who are interested in another DHCP server.
22 #       We NEED FEEDBACK, patches, bug reports, etc.  Especially patches!
23 #
24 #       Please contribute, or this work will be nothing more than
25 #       a curiosity.
26 #
27 #
28 #       Q: What does it do?
29 #       A: It allows the server to receive DHCP packets, and to
30 #          respond with static, pre-configured DHCP responses.
31 #
32 #       Q: Does it do static/dynamic IP assignment?
33 #       A: No.  Or, maybe.  Try it and see.
34 #
35 #       Q: Does it read ISC configuration or lease files?
36 #       A: No.  Please submit patches.
37 #
38 #       Q: Does it have DHCP feature X?
39 #       A: No.  Please submit patches.
40 #
41 #       Q: Does it support option 82?
42 #       A: Yes.
43 #
44 #       Q: Does it support other options?
45 #       A: Maybe.  See dictionary.dhcp.  Please submit patches.
46 #
47 #       Q: It doesn't seem to do much of anything!
48 #       A: Exactly.
49 #
50 #       $Id$
51 #
52 ######################################################################
53
54 #
55 #  The DHCP functionality goes into a virtual server.
56 #
57 server dhcp {
58
59 #  This is part RADIUS legacy (sorry).  Clients have to be defined for
60 #  DHCP.  This is not normal practice for a DHCP server, but it does
61 #  enable a simple filter list of "known clients".
62 #
63
64 #  DHCP packets are normally sent with source IP address 0.0.0.0.
65 #  If you want to accept packets from any IP, uncomment the "netmask"
66 #  entry below, and delete the other "client" sections in this file.
67 client any {
68         ipaddr = 0.0.0.0
69         #netmask = 0
70         dhcp = yes
71 }
72
73 #  For local testing.
74 client localnet {
75         ipaddr = 127.0.0.0
76         netmask = 8
77         dhcp = yes
78 }
79
80 #  Define a DHCP socket.
81 #
82 #  The default port below is 6700, so you don't break your network.
83 #  If you want it to do real DHCP, change this to 67, and good luck!
84 #
85 #  You can also bind the DHCP socket to an interface.
86 #  See below, and raddb/radiusd.conf for examples.
87 #
88 #  This lets you run *one* DHCP server instance and have it listen on
89 #  multiple interfaces, each with a separate policy.
90 #
91 #  If you have multiple interfaces, it is a good idea to bind the
92 #  listen section to an interface.  You will likely also need one
93 #  listen section per interface.
94 listen {
95         ipaddr = *
96         port = 6700
97         type = dhcp
98         #interface = eth0
99 }
100
101 #  Packets received on the socket will be processed through one
102 #  of the following sections, named after the DHCP packet type.
103 #  See dictionary.dhcp for the packet types.
104 dhcp DHCP-Discover {
105         update reply {
106                DHCP-Message-Type = DHCP-Offer
107         }
108
109         #  The contents here are invented.  Change them!
110         update reply {
111                 DHCP-Domain-Name-Server = 127.0.0.1
112                 DHCP-Domain-Name-Server = 127.0.0.2
113                 DHCP-Subnet-Mask = 255.255.255.0
114                 DHCP-Router-Address = 192.168.1.1
115                 DHCP-IP-Address-Lease-Time = 86400
116                 DHCP-DHCP-Server-Identifier = 192.168.1.1
117         }
118
119         #  Do a simple mapping of MAC to assigned IP.
120         #
121         #  See below for the definition of the "mac2ip"
122         #  module.
123         #
124         #mac2ip
125
126         #  If the MAC wasn't found in that list, do something else.
127         #  You could call a Perl, Python, or Java script here.
128
129         #if (notfound) {
130         # ...
131         #}
132
133         ok
134 }
135
136 dhcp DHCP-Request {
137         update reply {
138                DHCP-Message-Type = DHCP-Ack
139         }
140
141         #  The contents here are invented.  Change them!
142         update reply {
143                 DHCP-Domain-Name-Server = 127.0.0.1
144                 DHCP-Domain-Name-Server = 127.0.0.2
145                 DHCP-Subnet-Mask = 255.255.255.0
146                 DHCP-Router-Address = 192.168.1.1
147                 DHCP-IP-Address-Lease-Time = 86400
148                 DHCP-DHCP-Server-Identifier = 192.168.1.1
149         }
150
151         #  Do a simple mapping of MAC to assigned IP.
152         #
153         #  See below for the definition of the "mac2ip"
154         #  module.
155         #
156         #mac2ip
157
158         #  If the MAC wasn't found in that list, do something else.
159         #  You could call a Perl, Python, or Java script here.
160
161         #if (notfound) {
162         # ...
163         #}
164
165         ok
166 }
167
168 #  If there's no named section for the packet type, then the packet
169 #  is processed through this section.
170 dhcp {
171         # send a DHCP NAK.
172         reject
173 }
174
175
176 }
177
178 ######################################################################
179 #
180 #  This next section is a sample configuration for the "passwd"
181 #  module, that reads flat-text files.  It should go into
182 #  radiusd.conf, in the "modules" section.
183 #
184 #  The file is in the format <mac>,<ip>
185 #
186 #       00:01:02:03:04:05,192.168.1.100
187 #       01:01:02:03:04:05,192.168.1.101
188 #       02:01:02:03:04:05,192.168.1.102
189 #
190 #  This lets you perform simple static IP assignment.
191 #
192 ######################################################################
193
194 #passwd mac2ip {
195 #       filename = ${confdir}/mac2ip
196 #       format = "*DHCP-Client-Hardware-Address:=DHCP-Your-IP-Address"
197 #       delimiter = ","
198 #}