Routing calls to different (external) network interfaces


In order to save come money customer decided to run 1 asterisk server (plain old asterisk,
Trixbox, Elastix) for several smaller companies. Due to the fact that one VoIP service
provider does billing based on source IP address of the IP PBX the question came up regarding
routing (I belive this would be layer 5 routing):

Let say we have two internal subnets sn1= and sn2= and
two external IP addresses (on physical or virtual nics) ip1 on eth1 (eth1:0) and ip2
on eth2 (eth1:1).

Is it possible to route calls from certain internal subnet sn1 to specific external
(outgoing) network interface eth1 (eth1:0) with ip1 so that provider can distinguish
internal “company”?

What would be solutions:

  1. trunk setup
  2. routing (static routes) I would kindly ask You for sample
  3. virtualization

Thanks and best regards


If I understood you correctly, you will want to set a route for the specific destination, which is basically done like this (iirc):

# route add dest.ip gw local.gateway.interface.ip.
Read the route man pages, you should be able to figure out how to filter that based on source network

After I had a network route rule added freepbx works fine for me. But every time the sys is restarted I need to reapply the route. Is there any file where I can put this route add dest.ip gw local.gateway.interface.ip so I don’t have to do it when the sys restart

Google might work for this.

Try searching for “centos adding static route”