[MX] PPPoE Calling-Station-Id issue on JunOS

After making my bras live, I was unable to get the client’s mac address which made my team difficult to troubleshoot. Here I found a tweak to get Client’s Mac address into the database.

Juniper BRAS sends the client MAC address, but not in the attribute. It uses the ERX-Dhcp-Mac-Addr attribute instead of Calling-Station-Id, and its value comes in a different pattern, 00oc.429e.7ef1, than we are used to see MAC addresses.

My workaround was to configure my Freeradius server in a way that in the authorization and accounting sections of the default configuration I could filter the ERX-Dhcp-Mac-Addr attribute and copy its contents to the Calling-Id-Attribute using its unlang capabilities:

File: /etc/freeradius/sites-enabled/default

authorize {
    .
    .
    .
    if (ERX-Dhcp-Mac-Addr =~ /^([a-f0-9][a-f0-9])([a-f0-9][a-f0-9]).([a-f0-9][a-f0-9])([a-f0-9][a-f0-9]).([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])$/) {
        update request {
            Calling-Station-Id := "%{1}:%{2}:%{3}:%{4}:%{5}:%{6}"
        }
    }

    files
    sql
    .
    .
    .
}
.
.
.
accounting {
    .
    .
    .
    if (ERX-Dhcp-Mac-Addr =~ /^([a-f0-9][a-f0-9])([a-f0-9][a-f0-9]).([a-f0-9][a-f0-9])([a-f0-9][a-f0-9]).([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])$/) {
        update request {
            Calling-Station-Id := "%{1}:%{2}:%{3}:%{4}:%{5}:%{6}"
        }
    }
    sql
    .
    .
    .
}

Restart freeradius and there you go.

 

Leave a Reply

Your email address will not be published. Required fields are marked *