FreeRADIUS 4: DHCP v4: ERROR: Expansion "network" needs to be resolved before it is used
Dima Ermakov
demonihin at gmail.com
Fri Nov 8 12:34:54 UTC 2024
Hi Alan,
Thank you for your explanation.
Here is what I want to do eventually:
1. Define per IP Prefix DHCP configuration, preferably, via text
"files". The configuration should contain: DNS settings, Lease time,
Default gateway (maybe more later);
2. For some network prefixes I want to define DHCP pools with SQL
integration to track active leases (this will be my next step, when I
manage to do the first step).
To do so, I read the wiki page (although for FreeRADIUS 3.2) about
DHCP and read the configuration from v3.2 (which was probably my
mistake).
The examples from v3.2 (mods-available/dhcp_files) gave me the idea to
use static key="network" (see below):
"""
# Instances of the "files" module for managing DHCP options
#
files dhcp_network {
# The file containing network-specific DHCP options mapping
filename = ${modconfdir}/files/dhcp
# For network lookups we use a fixed key. Matching
# actual networks is done by additional filtering within
# the file
key = "network"
}
"""
I see your recommendation to use DEFAULT. To implement (1), should I
create several DEFAULT sections + Fall-Through := yes + Network-Subnet
comparison operations like below?
"""
# files dhcp_config content:
DEFAULT Network-Subnet < 172.25.1.0/24
Domaiin-Name-Server := 192.168.20.2,
Router-Address := 172.25.1.1,
Fall-Through := yes
DEFAULT Network-Subnet < 172.25.2.0/24
Domaiin-Name-Server := 192.168.20.2,
Router-Address := 172.25.2.1,
Fall-Through := yes
"""
or I misunderstood you?
// Dmitrii.
On Fri, 8 Nov 2024 at 13:00, Alan DeKok <aland at deployingradius.com> wrote:
>
> On Nov 8, 2024, at 11:27 AM, Dima Ermakov <demonihin at gmail.com> wrote:
> > I am trying to test FreeRADIUS 4 on RockyLinux 9.4 built from commit
> > c01f1dbb733966ac51f7d2bacb6343fc04450024
> > I know that this software is not supposed to be used in production
> > (and I don't do it, it is testing only for now).
>
> It should mostly work, barring some corner cases and features which aren't implemented.
>
> > I tried to configure a simple DHCPv4 service which uses the "files"
> > module to assign per-network properties.
> > The processing fails with expansion of "key" in files:
> >
> > """
> > files files_dhcp_network {
> > ...
> > key = 'network'
>
> Why are you using a fixed string here? This doesn't make sense.
>
> What are you trying to do? Why are all of the "files" entries using a fixed name "network"?
>
> > with error: files_dhcp_network - ERROR: Expansion "network" needs to
> > be resolved before it is used.
>
> Yes, the documentation explains that the "key" field should be an expansion, an attribute reference, etc. It shouldn't be a fixed string.
>
> > Here is a part of my ${moddir}/dhcp_config (inspired by
> > https://www.freeradius.org/documentation/freeradius-server/3.2.7/howto/protocols/dhcp/policy_network_options.html
> > ):
> >
> > """
> > network IP-Pool.Name := "local"
> > Domain-Name := "example.org",
> > Subnet-Mask := 255.255.255.0,
> > Router-Address := 172.16.1.1,
> > Domain-Name-Server := 192.168.20.2,
> > Fall-Through := yes
> >
> > network Network-Subnet < 172.25.1.0/24
> > IP-Pool.Name := "pool-172.25.1.0/24",
> > Subnet-Mask := 255.255.255.0,
> > Broadcast-Address := 172.25.1.255
> > """
>
> So every "files" entry is keyed with the word "network". Why?
>
> What are you trying to do? Why do you expect it to do when you configure a fixed key of "network"?
>
> > Could you, please, if possible point me to what should be corrected?
>
> Use the word DEFAULT to match all entries, or configure the "key" field to use an actual key, and not a fixed string.
>
> Alan DeKok.
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
--
С уважением, Дмитрий Ермаков.
More information about the Freeradius-Users
mailing list