Community discussions

MikroTik App
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Implementing radius server failover

Thu Jul 29, 2010 11:54 pm

I have two Identical freeradius servers and i want to recieve accounting information (one as backup) But if the main one fails the 2nd one to take over automatically. Which is the best approach?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Implementing radius server failover

Fri Jul 30, 2010 2:02 am

add two RADIUS servers and set 'accounting-backup=yes' for both?..
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Fri Jul 30, 2010 8:24 am

I have tried that setup and i get "RADIUS server not responding" when they are both have accounting backup enabled. If I just enable one to Accounting-backup they both get accounting packet but only the main one authenticates users. In case i switch off main radius server the backup server doesn't takeover authenticating automatically. I have to change it manually.
Is there a script or a way to automate this process?
 
csickles
Forum Guru
Forum Guru
Posts: 1255
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: Implementing radius server failover

Fri Jul 30, 2010 8:28 am

You could netwatch the Radius server and then on down change it to the backup.
Then on up, revert..

But I would think there is still an issue elsware..
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Fri Jul 30, 2010 8:46 am

I have done exactly as u advised but if am not on the watch out customers will not be authenticated in case the main radius server fails mainly due to power failure. If i could get a solution to handle failover between the two radius servers i can have sleep at night.
 
csickles
Forum Guru
Forum Guru
Posts: 1255
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: Implementing radius server failover

Fri Jul 30, 2010 8:49 am

Netwatch is a process / program /system thread.

You can "watch" other devices with it and take actions depending on their state IE: run a script that in you case alters the RADIUS server settings...

Crude but it sould do the job..
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Fri Jul 30, 2010 9:30 am

I would like to try that but am not good in writing scripts so if u can point me to a script which i can edit to suite my need I would appreciate.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Implementing radius server failover

Fri Jul 30, 2010 1:52 pm

so, accounting-backup RADIUS is not used for authentication?..

anyway, you will need some tool to synchronize your accounting data on both servers in case of failure of one of them
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Implementing radius server failover

Fri Jul 30, 2010 2:39 pm

If "/radius" is set correctly, the second server should take over authentication and accounting without any entries if the first radius server fails. If you can post the output of "/radius print", that might help. Change the radius secrets tho.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Fri Jul 30, 2010 11:08 pm

/radius print value-list
1. service: ppp
login
hotspot
wireless
called-id:
domain:
address: 192.168.1.159
secret: xxxxxxxx
authentication-port: 1812
accounting-port: 1813
timeout: 1s
accounting-backup: yes
realm:


2. service: ppp
login
hotspot
wireless
called-id:
domain:
address: 192.168.200.159
secret: xxxxxxx
authentication-port: 1812
accounting-port: 1813
timeout: 3s
accounting-backup: no
realm:
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Fri Jul 30, 2010 11:10 pm

so, accounting-backup RADIUS is not used for authentication?..

anyway, you will need some tool to synchronize your accounting data on both servers in case of failure of one of them
I have solved that using mysql replication on both servers but the underlying problem is switching over in case the main radius server stops working.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Implementing radius server failover

Sat Jul 31, 2010 1:04 am

If you shut down the main radius server, the backup should take over, If not, it isn't any good, is it? Can you try it with the main radius server offline? If the backup doesn't take over, something is not correct.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Sat Jul 31, 2010 11:00 am

I have tried that a couple of times and I noticed from logs that if the main server is off customers get RADIUS server not responding when trying to login and those already logged I get RADIUS accounting request not sent: no response.
Is it a bug in the radius package or what could be wrong? Anyone ?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Implementing radius server failover

Sat Jul 31, 2010 2:39 pm

I would set "accounting-backup=no" on both entries until you get both the servers responding.
Also try setting the radius timeout to a higher value.
/radius
set 0 timeout=600ms
set 1 timeout=600ms

EDIT: I see you have increased the timeout values already. Good move. And according to the docs on radius, "accounting backup=yes" should be used on the second (backup) server. I don't use it, so I can't check it right now to see what it does.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Implementing radius server failover

Sat Jul 31, 2010 4:59 pm

I have solved that using mysql replication on both servers but the underlying problem is switching over in case the main radius server stops working.
is it master/master replication?.. then set "accounting-backup: no" on both servers - in that case you should get authentication failover, and mysql replication will give you accounting failover
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Sat Jul 31, 2010 7:37 pm

I have solved that using mysql replication on both servers but the underlying problem is switching over in case the main radius server stops working.
is it master/master replication?.. then set "accounting-backup: no" on both servers - in that case you should get authentication failover, and mysql replication will give you accounting failover
At the moment its master/slave replication. I will setup master/master replication and then disable accounting-backup as you advised.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Mon Aug 02, 2010 12:35 pm

It worked after changing the time out to different values on both radius client entries. I noticed they need to be well spaced to allow for failover.
Now mysql master-master replication takes care of syncing th databases
You do not have the required permissions to view the files attached to this post.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Implementing radius server failover

Mon Aug 02, 2010 4:17 pm

It worked after changing the time out to different values on both radius client entries. I noticed they need to be well spaced to allow for failover.
mmm?..
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Mon Aug 02, 2010 7:07 pm

I set time out on both servers at different times and disabled accounting-backup. Is that better?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Implementing radius server failover

Mon Aug 02, 2010 9:25 pm

I set time out on both servers at different times and disabled accounting-backup. Is that better?
there should be no sense in setting different timeout values: second RADIUS should be queried only if first one do not respond...
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Mon Aug 02, 2010 11:15 pm

Then why was it not working before I set different timeouts?
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Implementing radius server failover

Tue Aug 03, 2010 12:37 am

I tend to list the primary and secondary radius servers as alternate entries under Radius in winbox, with a timeout of 500ms.

They are also listed 3 times, so the MT gets 6 goes in 3 seconds to hit either remote Radius server.

The last entry on the MT is a third Local Radius server that has a 24-hour backup of the main authentication database on it.

With this setup some accounting records are lost if the primary falls over, but it doesn't really matter too much, as the accounting records are incremental, and are only used for dynamic bandwidth limiting/timeout kicking.

If i lost Authentication then that would be Bad. Loosing a few accounting records isn't such a big deal.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Tue Aug 03, 2010 11:32 am

I tend to list the primary and secondary radius servers as alternate entries under Radius in winbox, with a timeout of 500ms.

They are also listed 3 times, so the MT gets 6 goes in 3 seconds to hit either remote Radius server.

The last entry on the MT is a third Local Radius server that has a 24-hour backup of the main authentication database on it.

With this setup some accounting records are lost if the primary falls over, but it doesn't really matter too much, as the accounting records are incremental, and are only used for dynamic bandwidth limiting/timeout kicking.

If i lost Authentication then that would be Bad. Loosing a few accounting records isn't such a big deal.
You are saying you have 2 radius servers and each sever has 3 entries under radius client in MT. I also have two radius servers (main and back up) . May initial setup has failed yet again once the main radius server went down so i have to define the main one again using winbox. If you don't mind please explain how to setup mine to work as failover just a yours does. Thanks.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Implementing radius server failover

Tue Aug 03, 2010 12:25 pm

/radius
add accounting-backup=no accounting-port=1813 address=Primary-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Primary-Secret service=hotspot timeout=500ms

add accounting-backup=no accounting-port=1813 address=Secondary-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Secondary-Secret service=hotspot timeout=500ms

add accounting-backup=no accounting-port=1813 address=Primary-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Primary-Secret service=hotspot timeout=500ms

add accounting-backup=no accounting-port=1813 address=Secondary-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Secondary-Secret service=hotspot timeout=500ms

add accounting-backup=no accounting-port=1813 address=Primary-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Primary-Secret service=hotspot timeout=500ms

add accounting-backup=no accounting-port=1813 address=Secondary-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Secondary-Secret service=hotspot timeout=500ms

add accounting-backup=no accounting-port=1813 address=Local-Radius-Server-IP \
authentication-port=1812 called-id="" comment="" disabled=no domain="" \
realm="" secret=Local-Secret service=hotspot timeout=500ms
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Implementing radius server failover

Tue Aug 03, 2010 12:27 pm

It appears that the MT tries each server in order.

If it doesn't get a reply for whatever reason, it tries the next on and so on.

You can looks at the stats for each Radius server entry on the MT to see if it 'falls through' and how often.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Tue Aug 03, 2010 10:52 pm

I Set as you explained but for some reason failover is not working. What version are you using? Am using 4.1 on a RB750G could it be a bug in my version?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Implementing radius server failover

Wed Aug 04, 2010 12:09 am

4.1 or 4.10?
for some reason failover is not working
what do you see in RADIUS stats? are both servers queried?
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Thu Aug 05, 2010 12:18 am

I use 4.10 and I have timeouts on the secondary radius status when i set it to accounting-backup but nothing when i disable accounting-backup. I have run out of ideas now since it even stopped working and i havent changed anything.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Implementing radius server failover

Thu Aug 05, 2010 1:30 am

I have upwards of 200 mikrotik + other devices accessing the same 3 Radius servers with no perceiveable problem.

However, i do not use Radius for ppp authentication, so maybe that's enough of a difference.

I *never* set Accounting-Backup because it seemed to break things early in testing, so i never tick it anymore.

If it is a matter of Timing, you might want to give VRRP a try, with the Two Radius servers doing MySQL replication, but both appearing to have the same IP address : if one fails, the second server takes over, and the authenticating equipment should not notice the difference.

Out of interest, *why* would your Primary Radius server break often enough for you to lose sleep ?
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Thu Aug 05, 2010 10:12 pm

I have upwards of 200 mikrotik + other devices accessing the same 3 Radius servers with no perceiveable problem.

However, i do not use Radius for ppp authentication, so maybe that's enough of a difference.

I *never* set Accounting-Backup because it seemed to break things early in testing, so i never tick it anymore.

If it is a matter of Timing, you might want to give VRRP a try, with the Two Radius servers doing MySQL replication, but both appearing to have the same IP address : if one fails, the second server takes over, and the authenticating equipment should not notice the difference.

Am starting to think its the secondary server with the problem since i setup mysql master-master replication and still its not replicating in a timely manner. Just to ask i the main server runs on mysql 5.0 while the secondary is mysql 5.1 could it be the issue?

Out of interest, *why* would your Primary Radius server break often enough for you to lose sleep ?
Concerning My primary server going down its an issue with the national power provider. The power is very erratic and am still in the process of setting up a 24 hr power backup solution.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Thu Aug 05, 2010 10:58 pm

I have upwards of 200 mikrotik + other devices accessing the same 3 Radius servers with no perceiveable problem.

However, i do not use Radius for ppp authentication, so maybe that's enough of a difference.

I *never* set Accounting-Backup because it seemed to break things early in testing, so i never tick it anymore.

If it is a matter of Timing, you might want to give VRRP a try, with the Two Radius servers doing MySQL replication, but both appearing to have the same IP address : if one fails, the second server takes over, and the authenticating equipment should not notice the difference.

Am starting to think its the secondary server with the problem since i setup mysql master-master replication and still its not replicating in a timely manner. Just to ask i the main server runs on mysql 5.0 while the secondary is mysql 5.1 could it be the issue?

Out of interest, *why* would your Primary Radius server break often enough for you to lose sleep ?
Am starting to think its the secondary server with the problem since i setup mysql master-master replication and still its not replicating in a timely manner. Just to ask i the main server runs on mysql 5.0 while the secondary is mysql 5.1 could it be the issue?

Concerning My primary server going down its an issue with the national power provider. The power is very erratic and am still in the process of setting up a 24 hr power backup solution.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Implementing radius server failover

Fri Aug 06, 2010 12:51 am

power problem.Ok - fix it with a UPS or two.

It is almost always better to have the same software version running for replication.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Fri Aug 06, 2010 9:11 am

I found a power solution, i will move it to a building with 24hr generator backup next week. I will revisit radius failover after moving the radius manager.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Implementing radius server failover

Sun Aug 08, 2010 3:57 am

Good Plan.

Also spend a few euros on a UPS or two, despite the generator.

You'll sleep a lot better.
 
heviejob
Member Candidate
Member Candidate
Topic Author
Posts: 171
Joined: Mon Nov 30, 2009 4:54 pm

Re: Implementing radius server failover

Sun Aug 08, 2010 9:46 pm

Sure I will be doing that too.

Who is online

Users browsing this forum: Bing [Bot], HeA9, jaisal, jason9456402, stef70, stratonetworks and 88 guests