load balance with 2 wan connections

Home » Asterisk Users » load balance with 2 wan connections
Asterisk Users 10 Comments

Need some advise or paid help on running asterisk on two WAN connection. I
need load balancing and failover support.

WAN: 1 DSL + 1 Cable ISP.


10 thoughts on - load balance with 2 wan connections

  • There are _many_ issues. First outgoing and incoming traffic is
    completely different for what you want to do.

    Second SIP is hard enough to NAT and route with a single IP let alone
    2 or more and probably dynamic!

    Third, load balancing/fail-over is not a simple matter even doing by
    hand with Linux or BSD, there will still be issues with static routing
    and such. There are some cheap hw that may claim it does, but most
    probably it will not be meant for VoIP, SIP or IAX.

    Depending on your budget and needs, if you need reliability and high
    bandwidth, probably a better solution is to host your main pbx in a
    reliable server on a fixed and public IP and then route the calls to a
    local Asterisk using IAX and even SIP. If local bandwidth is limited
    IAX is a better bet. By having a public box routing calls to local
    box(es) on your private LAN, you could load balance with multiple
    local Asterisk servers (easy balance by dialplan, for example). To
    save on hardware, you could use virtualization or FreeBSD Jails for
    example. Dunno how the telephony hw works with virtualization or jails
    (yet, thoug I do have a single Asterisk running on a FBSD jail).

    Good luck,
    Alejandro Imass

  • I seem to have missed the start of this – however I’d suggest getting
    hardware to do it for you – e.g. Draytek 2820 – will work out of the box
    for you as it has both an ADSL port and an Ethernet port for the cable

    A good point – if to reach the ITSP then it’ll be fine if to reach phones
    then your effective external IP address will alternate between the 2 – so
    the phones won’t always be able to connect – but you could start to fiddle
    with dynamic DNS solutions, etc. Not perfect though.


  • The biggest issue with any solution to use two different providers for
    your IP service that will be used by your VOIP provider to deliver
    calls to your Asterisk server, is that each internet service will have
    a separate address. Therefore, for INBOUND calls, your VOIP provider
    will have to do the load balancing. For outbound calls, it won’t be
    that hard as long as your provider allows you to send calls from both
    IP addresses.

  • some providers do serve inbound by sending the traffic to exact IP, some do
    accept the registers from any IP.

    in second case for Inbound failover, you might just to “register => ” using
    another interface/IP address.

    here a new question arose: how to “sip-ping” some phone number to see if
    it’s alive?

    On Mon, Dec 27, 2010 at 11:51 AM, Sherwood McGowan <

    href=”mailto:sherwood.mcgowan@gmail.com”>sherwood.mcgowan@gmail.com> wrote:

  • We have another gateway in the USA that will send traffic to both IPs. The
    US gateway will load balance the traffic to both IPs.

    This is not used for phones. It is used mainly for wholesale traffic.
    Asterisk is being used as an SS7 gateway.

    Each DSL limits us to about 16 calls. We are thinking of combining DSL +
    DSL + Cable ISP on the same box and have our USA box send traffic to all 3


  • Hi,

    One possibility that you might want to explore is OpenVPN. If your VoIP
    clients support OpenVPN (either through a local Openvpn client on the
    clients network being used as an OpenVPN gateway, or through individual
    clients supporting OpenVPN (laptops with softphones, or I’ve heard of
    one particular hardphone supporting OpenVPN – but can’t remember which).

    Once you are using OpenVPN – it is a bit easier to setup a failover
    scenario – or even load-balancing – as Openvpn has some inbuit
    functionality in this direction. There has been some recent discussion
    on the OpenVPN list about load balancing and failover setups if I
    remember correctly.

    Just a thought,


  • afaicr, snom supports vpn.
    Though probaby just plain setup, no special configs like load

  • Hi,

    Thanks for that – it does seem that the phone I was thinking of was a Snom.

    Looking at these instructions for setting up OpenVPN on the Snom 370 phone:


    lower down, in one of the the vpn.cnf which is the config file for the
    phone, the “remote random” directive actually is specified – which is
    the load balancing mechanism used by OpenVPN. So it does seem to support it.