FreePBX with backup Internet connection

Our FreePBX server is behind a dual WAN peplink router. If WAN1 goes down WAN2 steps in and provides Internet connectivity. Problem is the “externip” value in Asterisk. When the system changes to WAN2 the outside IP address changes and there is no sound on calls. If we manually change the externip IP address to WAN2 everything works ok again.

Is there a reliable way to automate the process? This is (or will be) a production system. Thanks.

You might try it with DNS srv records. Should fix the problem also.

@Skyking. Thanks for the feedback and info. I did read this file previously but it does not resolve my issue. The dyndns client would have to run on the Linux machine not the router or the static IP presented outside will be the router IP not the FreePBX machine.

@James83. I already use SRV records, sip.mydomain.com and sip2.mydomain.com for ports 5060 and registration works great on the client side. I guess I could add another SRV record for http port 80 lookup and that might resolve the issue. Externhost would then be the SRV record. Thanks.

Is something preventing you from running inadyn on your PBX? That way when failover occurs your records will update automatically.

You have need doing this for a long time. You have never setup a system with dynamic DNS?

It also means you have not read the sip Asterisk docs or you would know about externhodt.

Hope this helps.

You have need doing this for a long time. You have never setup a system with dynamic DNS?

It also means you have not read the sip Asterisk docs or you would know about externhodt.

Hope this helps.

Nope. I am using the Distro and we usually use a static IP for the system. I tried setting up a dynamic IP in advanced sip settings but that doesn’t seem to work. The IP is never updated even though sip_general_additional.conf contains the correct settings

externhost=sip.mydomain.net
externrefresh=120

I have ready many Asterisk docs. If you are referring to anything specific could you post a link please or a name I can google?

does sip.mydomain.net resolve to your current outside IP? You need to be using a dynamic DNS service.

Docs, the only definitive reference that is updated with the Asterisk builds is the actual Asterisk docs. It never ceases to amaze me that folks install Asterisk and never look at the documentation.

http://www.asterisk.org/doxygen/trunk/Config_sip.html

The key with externhost is it queries the url specified as the argument and uses that value in the externip variable internally. Queries take place at the interval defined in externrefresh.

@James83. Do you have a working system that uses a SRV record as FQDN? I tried setting sip.mydomain.com as externhost (static & dynamic) and calls have no sound. The SRV record points to sip2mydomain.com on port 80 and port 5060.

@dziny. inadyn is another option but I am trying not to use dyndns as this would introduce another point of failure.

perhaps I’m missing something here, unless you are obfuscating deliberately, you should not be using *.mydomain.com or anything that is not publicly resolvable, it might work in your internal network but certainly not from outside.

*.mydomain.com is an example, not the real domain name.

Well truly you can use bgp to resolve correctly for the rest of the world your current IP{ address to an a dns resolvable name , but that needs collusion with all your providers (and a bit of knowledge) , a poorman’s fix is to have ONE dynamic dns client somewhere in the “active” network that authoritatively updates you dynamic address in a unique fashion, then just wait a couple of minutes. (the audio payload is rtp on ports as defined in /etc/rtp.conf)

Thanks for all the great comments. In the end I decided to go with the no-ip.com DUC Linux client for the server and externhost = [email protected].

The server is behind a dual wan router and automatically switches to WAN2 if WAN1 goes down. externhost updates the server IP address at that point (with a slight delay)

On the client side we use SRV records to failover to WAN2 so clients automatically re-register on WAN2 if WAN1 goes down.