Hi Arran Thanks for your reply. The problem is that when the server recives a LEASEQUERY packet I get the following error: Error: DHCP can only receive ethernet requests, not type 00 Thanks Ben On 28 August 2015 at 00:06, Arran Cudbard-Bell <a.cudbardb@freeradius.org> wrote:
On Aug 27, 2015, at 2:40 PM, Бен Томпсон <b.thompson@latera.ru> wrote:
Hi Everyone
I have configured FreeRADIUS to as a DHCP server which offers IP addresses based on the option 82 values added by a DHCP relay. In cases where the client sends a unicast renew request bypassing the relay, the option 82 values are queried from an instance of rlm_cache which have configured to keep a record of leases. (This replicates the option 82 "Stash" functionality in ISC DHCP Server). A bit of unlang is involved to check that the lease is valid and take care of clearing out the cache, but it is all fairly simple.
The aformentioned server is working well, but I would also like it to be able to respond to Lease Query requests, and wondered if it would be possible to make it work in a similar way using rlm_cache. I would envisage that configuration might look something like this:
dhcp DHCP-Lease-Query { # look in the cache to see if there is an active lease
update control { Cache-Status-Only := yes }
cache
if (notfound) {
# check to see if we know about this IP ...some unlang lookup the IP from our usual auth
source/DB
cache }
... ... some unlang to figure out if the lease(s) are valid, etc. ...
# work out which type of reply packet is requred and add the relevant options if (result of above says lease is active) { update reply { DHCP-Message-Type := DHCP-Lease-Active ... add some other stuff to the reply... } } elsif (result of above says lease is unassigned) { update reply { DHCP-Message-Type := DHCP-Lease-Unassigned ... add some other stuff to the reply... } } elsif (result of above says lease is unknown) { update reply { DHCP-Message-Type := DHCP-Lease-Unknown ... add some other stuff to the reply... } } }
I am guessing that the source code would need to be modified, and if so,
it
may be too much for me as I am not a skilled C programmer. I would be able to test it however.
I don't *think* code modifications are required.
Did you just need to right control attributes for the cache module? Or something else...
If you need the cache to persist you should setup a memcached instance (or use v3.1.x and setup a Redis instance).
-Arran
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Бен Томпсон, инженер отдела внедрения и техподдержки, компания "Латера" | www.latera.ru тел.: +7 (499) 940-95-05, доб. 221 E-mail: b.thompson@latera.ru Присоединяйтесь к нам в социальных сетях [image: Встроенное изображение 1] <https://www.facebook.com/pages/%D0%91%D0%B8%D0%BB%D0%BB%D0%B8%D0%BD%D0%B3-%D0%93%D0%B8%D0%B4%D1%80%D0%B0/622692344514207> [image: Встроенное изображение 2] <https://twitter.com/Hydra_billing_> [image: Встроенное изображение 3] <http://www.youtube.com/channel/UC0SHZ4fnWJ443xUwYEAbT5g?spfreload=10> [image: Встроенное изображение 5] <https://www.linkedin.com/company/9347770?trk=hp-feed-company-name>