Change NAS-IP-Address

Brian Candler B.Candler at
Tue Mar 12 10:38:05 CET 2013

On Tue, Mar 12, 2013 at 07:57:48AM +0100, Patrick Kowalik wrote:
> Hello everybody,
> for my Case I needed to change one Octett of my NAS-IP-Address (
> like from x.x.4.x to x.x.5.x )!

In what way did you want to change the third octet? Only replace 4 with 5?
Replace any value with that value plus one?

> I don't really found an function to change only one octett from the
> NAS-IP-Address

Sure, you can easily do it in unlang. For example to change x.x.4.x to

    if (NAS-IP-Address =~ /^([0-9]+\.[0-9]+)\.4\.([0-9]+)$/) {
        update request {
            NAS-IP-Address := "%{1}.5.%{2}"

If you wanted to add 1 to an octet you can use the expr module to do that,
e.g.  %{eval: %{2} + 1}.  See 'man rlm_expr' for more examples.

Anyway, this is really a user question not a devel question.



More information about the Freeradius-Devel mailing list