dhcp and cache question

Anton zav at tomica.ru
Thu Jul 21 09:29:34 CEST 2016


Good day.

I would like to cache queries in my dhcp configuration of freeradius and 
especially to cache sql queries. I have the next dhcp configuration section:

dhcp DHCP-Discover {
        update reply {
                DHCP-Message-Type = DHCP-Offer
        }
        update reply {
                &DHCP-Domain-Name-Server[1] = 192.168.1.254
                &DHCP-Domain-Name-Server[2] = 192.168.0.254
                &DHCP-Subnet-Mask = 255.255.255.0
                &DHCP-Renewal-Time = 86300
                &DHCP-Rebinding-Time = 86330
                &DHCP-IP-Address-Lease-Time = 86400
                &DHCP-DHCP-Server-Identifier = 192.168.24.14
                &DHCP-Relay-Circuit-Id := "%{request:DHCP-Relay-Circuit-Id}"
                &DHCP-Relay-Remote-Id := "%{request:DHCP-Relay-Remote-Id}"
        }
        mac2ip
        if ("%{request:DHCP-Relay-Circuit-Id}" =~ /0x....(....)..../i) {
                update control {
                        &Pool-Name := "vlan-%{expr:0x%{1}}"
                }
        }
        dhcp_sqlippool
        if ("%{reply:DHCP-Your-IP-Address}" =~ /([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}).[0-9]{1,3}/i) {
                update reply {
                        &DHCP-Router-Address = "%{1}.1"
                }
        }
        if ("%{reply:DHCP-Your-IP-Address}" =~ /(10.[0-9]{1,3}.[0-9]{1,3}).[0-9]{1,3}/i) {
                update reply {
                        &DHCP-Renewal-Time := 580
                        &DHCP-Rebinding-Time := 590
                        &DHCP-IP-Address-Lease-Time := 600
                }
        }
        linelog
       ok
}

dhcp DHCP-Request section has the same configuration.

Here is the static database(pool) mac2ip and dynamyc sql database(pool) sqlippool. ma2ip is checked first
if we have match in mac2ip then we use it, else we use dynamic ip-address from sqlpool. It works.

mac2ip works fast but sqlippool uses mysql and get some CPU load -- there are some crazy
devices in the network which ask dhcp all the time and fast (misconfigured or brocken routers?).
Mysql eats the CPU :-).

How can I use rlm_cache module in this configuration to speed up and reduce CPU load ?

I cannot understand how to use rlm_cache. Please explain me with examples on my configuration.


-- 
Anton,
инженер отдела управления сетью связи,
ООО "ИКА" (Томика) 634050 г. Томск
пр. Ленина 55, оф. 101
Тел: 701-855



More information about the Freeradius-Users mailing list