PPPoE Monthly Restart

Hi all,

I need to create a script that disconnects all PPPoE users at 12:01 (just after midnight) on the first day of the month to allow a new record to be created for Radius accounting.
Is this possible? I’ve searched for solutions but am yet to find any.
I am using ROS version 3.23.

Cheers :smiley:

Hi,

You must make a script and schedule it for running at your time (for example 12:01).

Hi there,

Yes I understand this, I appoligise if the question wasn’t clear enough but I would like an example for the script and how to schedule it on a certain date. I understand how to schedule, but just not on a certain date.

Cheers

:slight_smile:

Hi,
Excuse me , but I don’t use in this section.
I am using it for dc my nightly user every day before a special time.(e.g. 06:00).
If you think it is useful for you, I can send it.

you can’t specify scheduler to run at certain date, however you can
set scheduler interval to 30days.

Why not just add a “Session-Timeout” variable to your radius profile for that group? That way, the users’ client will automatically disconnect and reconnect after the specified timeout period, for example, after 86400 seconds (24 Hours).

Hi Pikoro,

Good suggestion, but this would mean clients would loose connectvity once a day for a minute, rather than once a month for a minute.
The php backend I have built for accounting checks ‘AcctStartTime’ (the start time of the PPPoE session) in the SQL database and if the AcctStartTime = the current month it adds up the data and displays it as the total monthly data used for a specific client when they log in.
The issue is that the clients are up for longer than a month so come the first day of the new month (or the second, third and so on) it shows no data as ‘AcctStartTime’ began in the previous month. If i physically drop the PPPoE connection on the first of the month this will overcome this (is there a better option?)

On another tact, does anyone know a better way of doing this? Or is there a RADIUS attribute to restart ‘AcctStartTime’ daily/monthly without ending the PPPoE session?

Any suggestions would be greatly appreciated. (I am using FreeRADIUS and MySQL)

Cheers

Well the 24 hours was just an example. You could scale it to 30 days or whatnot. Perhaps a script that calculates the number of seconds in the next month and updates the radius database accordingly by radgroup.

The other way might be to send an admin-request disconnect to the clients at the end of the month and tally from the radius logs that way.

As far as I know, the only way you will be able to reliable take it offline would be via radius attributes if you want to be able to do it at “midnight” on the last day of the month.

Hi Pikoro,
This is more or less what I think too. But surely the large ISP’s dont disconnect their users like that.
The only other way I can see of accounting is using NetFlow.
Any ideas anyone?

Cheers

I happen to work at an ISP and that is how we do it actually. We set a Session-Timeout with the amount of seconds until the next bill is overdue by one month. If the user pays before then, then their modem will briefly disconnect and reconnect and the user is none the wiser, however, if they do not pay by the end of the timeout interval, then the user is suspended and they will not be able to log back on. :slight_smile:

You can also schedule this script every 30 days…

/ppp active remove [/ppp active find]

To reliably fire on the first of a month you could also implement an interval of 90d (or something else much longer than one month), and run a second script every day that looks at the current date and the start-date of the PPPoE termination script. If that start-date is in the past, re-schedule the start-time to be the first of the next month.

Hackish, but would work.

Just shedule this script to run every 24h hours at 00:00:01
Hope this helps


:local date
:local day
:local rollover

# Put the day of the month you want to trigger here 
:set rollover "26"
  
:set date [system clock get date]
:set day [:pick $date 4 6]
 

:if ([$day] = $rollover) do={ :put [/ppp active remove [/ppp active find]]
:log info "PPP Reset"}  else={ :log info "PPP NOT Reset" }

John