Dual Wan failover

Need some ideas. How to get pbx system to jump to other WAN if primary goes down.

two modems----Pfsense—FreePBX

PBX has address of primary Wan but if that goes down, how does it know to use backup Wan? Is there anything within pfsense that would allow phone system to keep working?

The PBX is not aware of the dual WAN, pfsense is. Maybe you can explain the exact issue you are having and what you are really trying to accomplish.

How big an internet user are you? If you are big enough you should do this using the proper internet mechanisms for dual homing, in which case all your IP addresses will be available over all your service providers,

The company I used to work for, in the UK, had proper autonomous system numbers, even though it had less than 100 employees.

The proper way is with border gateway protocol and autonomous system numbers, but that is a service only likely to be provided by ISPs aiming at medium to large businesses.

Ad Daivd55 was mentioned, if you have BGP4 routing and dual providers this problem wouldn’t exist, because both providers are routing your IP addresses, but I’m guessing this is not the case.

I have clients with this exact configuration and you need to force all traffic out of a specific route on thre router/firewall and define SIP as the IP associated with that route on the PBX.
That I’m aware of you need to manually switch both firewall and SIP at the point it fails and there is no way to make it happen automatically.

I will further define this for someone reading it and saying of course you can…
Yes most firewalls will configure fail over and that will work, but your PBX will have the wrong SIP IP and once the call connected will almost immediately drop as well as media not communicating.

I’m not sure if Schmooze HA will change the SIP IP, that may be something to research.

I don’t see why you would have to force traffic out a specific route. Your pfsense takes care of the failover from one internet connection to the other but Asterisk has to find out about your external IP address being different.
You can accomplish that by using a hostname in your SIP settings instead of a fixed IP.

You would then need a mechanism so that your hostname resolves to your currently active external IP address by using some DDNS service or use the one you get when you purchase Freepbx sysadmin pro.

You can do this automatically. You need to use DYNDNS name and specify that in Asterisk SIP settings. At that point if you write a script to check for IP address change, then reload asterisk once that happens, it will re-register via the new IP address (of course DYNDNS would have changed at that point). Then incoming calls will know where to go.

My issue is that I can’t make this happen instantly. It will take a few minutes to determine the IP address change, then reload and all should be good at that point. But during that time, I get 1-way audio, because the UDP traffic won’t know where to go during that time. The SIP provider thinks the box is still registered at 1 IP and the box is now using a different IP address.

You don’t need to do that. Dnsmgr will regularly resolve the name (default I think is 300 seconds) and Asterisk will update itself (at least with PJSIP).

Now if you register to your provider incoming calls will fail until your server sends a register packet via the new active internet connection with a different IP address.
You can set Asterisk to send registration packets more frequently if it’s too long between registrations.

How would you deal with it if you’re using Chan_sip to register to SIP provider then? Since I believe Dnsmgr would not be used.

Regarding sending reg packets more frequently, would this be the Registration Timeout setting, which I have mine currently set to 1200?

You change to PJSIP because it will deal with this better and well, Chan_SIP is the walking dead right now. You really shouldn’t be using it as your go-to SIP driver anymore on Asterisk.

1 Like

It might also depend on your FreePBX version, Dnsmgr wasn’t running on my FreePBX 13 installs. Whether there are limitations to chansip I don’t know.

freepbx-a*CLI> dnsmgr status
DNS Manager: enabled
Refresh Interval: 300 seconds
Number of entries: 0

Yes, the registertimeout settings is where you control in chansip how often Asterisk should attempt to re-register to other devices.

Ah, you’re right. I added the dnsmgr.conf file with proper syntax and now it’s enabled, after an asterisk restart.
This should now monitor the change of IP address as long as the DYNDNS entry is listed in the Dynamic Host entry field. I assume at that point if the primary WAN goes down the hostname is updated and asterisk will re-register with SIP provider and new IP address.

Thanks a lot avayax!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.