Failover with Heartbeat not working (secondary IP)

I am trying to use Heartbeat to failover two Asterisk boxes. My problem is that Asterisk will connect to the IP with no problems, if it is the Primary IP of the controller, but will not connect if it is secondary.

eth0 <-- Connects just fine
eth0:0 <-- Phones wont connect.

I have tried it on multiple boxes and have the exact same problem, no matter which server I use. Dell 1850, 1650, doesn’t matter. Anyone have any idea? I’ve used Secondary IPs for years and have done failovers with HTTP, SQL, Mail and tons of other stuff… I’m lost on this one.

have you tried setting the bindaddr= to the secondary ip ? i’m running linux ha and i bound the bindaddr= with the secondary ip and works.

Looks like that worked! Its weird that 0.0.0.0 “binds to all”, but doesnt… :unamused:

Thanks for the advice!

How can I do High Availability/Load Balancing with it then?

I wanted the following

Server One
Real IP: 101
Float: 102

Server Two
Real IP: 102
Float: 101

That way I could do Round Robin with 101 & 102 for load balancing and if one went down, Heartbeat would load that IP on the box that is up.

the problem with such a setup is getting the two Asterisk installs to know about each other’s phones. This can be done using DUNDi (somehow), or i’ve also seen putting an install of SER in front of Asterisk. You can also use MySQL realtime to keep a single extensions.conf, but getting the two * boxes to know which phone is registered to who is still a bit of a question. SER is a good answer.

I am using res_mysql and cdr_mysql for Realtime and also have NFS setup for extensions.conf (because you still have to have the context in there…), voicemail and sounds. I also have both * boxes using a shared SQL server. Both boxes uses the exact same SQL, configs and voicemail. All I need to do is get virtual IPs working and then I will tackle the DUNDi problem.

IronHelix: “Somehow” is right for DUNDi. We spent a few weeks just trying to find ANY decent documentation so we could give it a try, and gave up eventually. I’m amazed that Digium doesn’t get off it’s hiney and write some docs. It’s their bloody protocol after all. Good grief!

I think we’re going to have OpenSER sitting in between our phones and Asterisk. We seem to have gotten around the issue of how a phone that registers with one Asterisk system knows about phones registered on another is to, upon registration from a phone to OpenSER, have OpenSER forward() the registration messages ‘down’ to all the Asterisk boxes. In that way, every asterisk box knows about every phone. Doing the same thing for SUBSCRIBE messages so we can get BLF to work.

voip-info.org/wiki-DUNDi+Ent … ration+SIP it’s not great but its something. I agree that DUNDi could use some more docs.

So I guess since everyone is avoiding my problem, that BINDADDR=0.0.0.0 just doesn’t work…

No, is not necesary to use OpenSer for this… To get the Load Balancing and be able to known on wich one of the load balanced servers a phone registered , could be solved using the regcontext=sipregistration in the sip.conf file in each registration server as explained here → voip-magazine.com/content/view/3644/

DUNDI could be of great help, even having a single pair of servers !

That would help for having NOT ONLY a Clustered / HA server, but also a Load Balanced System with shared load.

Also can not understand why a BINDADDR=0.0.0.0, that should BIND on ALL IP address, does not work… Is that a bug ? Could someone explain why ? How do I get Asterisk bind to ALL addresses ? I need * recognizes / bind both IP address in order to get not only a HA system, but also a Load Balanced system !

Also can not understand why a BINDADDR=0.0.0.0, that should BIND on ALL IP address, does not work… Is that a bug ? Could someone explain why ? How do I get Asterisk bind to ALL addresses ? I need * recognizes / bind both IP address in order to get not only a HA system, but also a Load Balanced system ![/quote]

Uhhmmm… I did some googling and I find my own answer form the statments below… Please find attached the solution I found at http://www.voip-info.org/wiki/index.php?comment_page=1&page_id=78&maxComments=10&comments_maxComments=10&comments_sort_mode=commentDate_desc&comments_style=flat

[quote]The statement “(0.0.0.0 binds to all)” next to the bindaddr= parameter in the default sip.conf is very misleading.

If you configure bindaddr=0.0.0.0 in sip.conf, SIP will not truly bind to any IP other than the first IP on a particular ethernet interface (or more specifically, the system’s ip route to the SIP device, which will be the first IP unless configured otherwise). It will respond to requests sent to any IP on the machine, however those responses will always be sent from the first IP and therefore if the original request was sent to a secondary IP, the response will inevitably be discarded by the SIP device as unrelated.

This is contrary to the behavior of hundreds if not thousands of other types of servers, and in particular the behavior of those which claim to bind to all addresses, but apparently is intended behavior as according to Corydon76 from Digium: “This has been asked many times before, and the answer is still the same. We simply don’t support this behavior.”

So beware — “you cannot alias your Ethernet interface to multiple addresses and expect it to work.”

Of course this means you cannot use systems like heartbeat to transfer a virtual IP between SIP servers to maintain redundancy as a workaround for yet another asterisk weakness (that it will only use the first SRV record, though this weakness is actually well-documented and I believe they intend to fix it).

Hope you have a plan C. :smile: If it helps, we solved this problem here using SRV on the clients (since they handle it correctly), and DUNDi on the server side.[/quote][/url]