To clarify the terms used on this page
One of our users (Muffy) had a request for the following:
This then lead to additional requirements
We will start off by adding the following attributes to the /usr/local/share/freeradius/dictionary.chillispot file.
#YFi Prime time - Normal Time differentiation ATTRIBUTE Yfi-Prime-Start 140 string ATTRIBUTE Yfi-Prime-End 141 string ATTRIBUTE Yfi-Prime-Total-Octets 142 integer ATTRIBUTE Yfi-Prime-Session 143 integer ATTRIBUTE Yfi-Normal-Total-Octets 144 integer ATTRIBUTE Yfi-Normal-Session 145 integer ATTRIBUTE Yfi-Prime-Bandwidth-Max-Up 146 integer ATTRIBUTE Yfi-Normal-Bandwidth-Max-Down 148 integer ATTRIBUTE Yfi-Prime-Bandwidth-Max-Down 149 integer ATTRIBUTE Yfi-Normal-Bandwidth-Max-Up 150 integer
Taking the above attributes in account we can now specify per user or per profile the following:
Description
Attribute
Check/Reply
Sample Value
Start of prime time
Yfi-Prime-Start
Check
08:00
End of Prime time
Yfi-Prime-End
Check
17:00
Data usage - prime time
Yfi-Prime-Total-Octets
Check
10485760 (10Meg)
Time usage - prime time
Yfi-Prime-Session
Check
3600 (1Hour)
Data usage - normal time
Yfi-Normal-Total-Octets
Check
10485760 (10Meg)
Time usage - normal time
Yfi-Normal-Session
Check
3600 (1Hour)
Bandwidth - prime time
Yfi-Prime-Bandwidth-Max-Up and Yfi-Prime-Bandwidth-Max-Down
Check
131072 (128Kb/s)
Bandwidth - normal time
Yfi-Normal-Bandwidth-Max-Up and Yfi-Normal-Bandwidth-Max-Down
Check
131072 (128Kb/s)
The table will be as follows
DROP TABLE IF EXISTS `times`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `times` ( `id` bigint(21) NOT NULL auto_increment, `acctsessionid` varchar(64) NOT NULL default '', `username` varchar(64) NOT NULL default '', `time` bigint(20) default NULL, `data` bigint(20) default NULL, `type` enum('Prime','Normal') default 'Normal', `created` datetime NOT NULL, `modified` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; SET character_set_client = @saved_cs_client;
With the above in mind we can do the following:
This functionality is disabled by default, to activate it, uncomment the following in _/usr/local/etc/raddb/rlm: _
Include the authentication request.
#---- Comment out for Prime time / Normal time function --- my $prime_return = prime_auth($username); if ($prime_return != 1){ $RAD_REPLY{'Reply-Message'} = "$prime_return"; return 0; } #----------------------------------------------------------
Include the accounting request.
#---- Comment out for Prime time / Normal time function --- prime_accounting(\%RAD_REQUEST); #----------------------------------------------------------
Restart FreeRADIUS
sudo /etc/init.d/radiusd restart
This section will discuss detail around the workings of Prime.pm.
The following can be used as a test to determine if the differentiation between prime time and normal time happens as intended.
Attribute
Check/Reply
Typical valueYfi-Prime-Start
Check
08:00Yfi-Prime-End
Check
08:30Yfi-Prime-Total-Octets
Check
10485760Yfi-Normal-Total-Octets
Check
20485760