Multi wan / multi homed


I’ve been looking at this subject for some time with no joy. I’d really like to get to a success on this with this post.

My objective: have multiple wan links serving my asterisk

What for: clients can register from one or the other link, to load balance, and possibly fail over. Minimlal functionality would be assigning specific customers to a specific nic (I have customer with their own VPN that want to provide their own link to my server)

My setup: asterisk running on a dell with 4 NIC, each of them NATed (192.168.0.x, .1.x, etc…) and a public IP.

So far… ETH0 is the main nic. externip is set to its public IP. Any customer registering through this IP gets service (signalling & media). When they send REGISTER through ETH1 public address, the packet reaches asterisk, but asterisk replies using ETH0. I’ve tried to play with ip rules / ip route tables, no joy.

So, assuming minimal functionality: assign customers to certain public IP, hence, NIC, what do I need to do to have multiple wan links on my asterisk ?

external router ? external proxy ? has anyone succeeded in doing this ? how ?

thanks for the help - if you want to point me to some googling, I’ve done a lot of it, I’d appreciate if you could be specific !


For specific consultation please move this thread to the job forum.

If all the interfaces have valid public addresses you do not have a NAT configuration.

When you have multiple public addresses, Asterisk makes a best effort to use the address of the interface which forms the best route to the destination, when setting IP addresses in the SIP headers and SDP. externaddr is frustrating this.

Note though, that to be truly multihomed, you need to have an autonomous system number, which is something you will probably not get for a single system, and even if you can get, it routes to you may not propagate well.

Without true multihoming, you are going to have to be clever with your routing tables (the OS, not Asterisk) to ensure that traffic goes out to the right network. You will probably have to partition the public network space and have routes to the partitions, rather than a default route.

You may find it easier to run multiple instances of Asterisk and have them talk to each other. This may mean using non-standard port numbers.

Many thanks - I had thought of the multiple asterisks instances. That is indeed a good idea.

Any other options ?


You could try configuring “policy routing” on the server. But I have no experience how Asterisk behaves in this case.