Network ranges in users files

Arran Cudbard-Bell a.cudbardb at freeradius.org
Thu Sep 10 14:32:02 CEST 2015


> On 10 Sep 2015, at 13:24, Sophie Loewenthal <sophie.loewenthal at trimbletl.com> wrote:
> 
> Hi,
> 
>    I'dl ike to add some addresses into /etc/raddb/users
> 
> Currently I have this,
>    DEFAULT NAS-IP-Address == 195.222.222.0, Pool-Name := vodafone-nas-m2m
> 
> But I should change this to,
> 195.232.191.50
> 195.232.191.51
> 195.232.191.52
> 195.232.191.53
> 
> Maybe I could use 195.232.191.52/29 allowing 195.232.191.49 - 195.232.191.54
> 
> Would these ideas work?
>  DEFAULT NAS-IP-Address ==  195.232.191.52/29, Pool-Name := vodafone-nas-m2m
> 
> Or,
>  DEFAULT NAS-IP-Address ==  195.232.191.50, Pool-Name := vodafone-nas-m2m
> DEFAULT NAS-IP-Address ==  195.232.191.51, Pool-Name := vodafone-nas-m2m
> DEFAULT NAS-IP-Address ==  195.232.191.52, Pool-Name := vodafone-nas-m2m
> DEFAULT NAS-IP-Address ==  195.232.191.53, Pool-Name := vodafone-nas-m2m

Unfortunately the users file uses older condition evaluation code, so I don't think that will work.

If you're using a v3.0.x version and unlang you should be able to do:

if (&NAS-IP-Address < 195.232.191.52/29) {
	update control {
		Pool-Name := vodafone-nas-m2m
	}
}

The operators change meaning with the types of the operand, so '<' means 'within the set of', instead of 'less than' in this instance.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150910/9eb14e17/attachment.sig>


More information about the Freeradius-Users mailing list