2 Voip Providers and 2 NICS

HI Guys, I need some assistance.

I have a running asterisk box with my sending out calls through my current voip provider. I have now added a second NIC for another VOIP provider to split the calls between the 2. I now have a problem were i cannot ping the 2nd Voip provider as it does not go through the 2nd NIC but goes through the default agteway to the internet. How do i route the destination IP to my 2nd nic router. I am using centos running asterisk 1.8

Kind Regards,

Why are you using a second NIC ? is this so you can use a second internet link ?

Dependin on the DIstro many will send traffic via eth0 if its on the same subnet at eth1 for example

bit more detail on what you are trying to achieve would help

You need to use static routes that are a part of Linux routing process. A google search should provide a lot of details on how to add a static route to a routing table.

If you want help from here, please include all the details you have.

Also, although I have’t looked too closely at this in Asterisk, IP was intended to be an internet protocol, to make one big network out of multiple networks. It was never intended to create disjoint networks accessed from the same machine.

I am not completely convinced that you can make this work without using two instances of Asterisk, linked by something other than SIP.

At least for 1.6.1.0, it looks to me that there is only one IP address ever used when contacting machines believed to be within the NAT boundary:

[code]/*! \brief our (internal) default address/port to put in SIP/SDP messages

  • internip is initialized picking a suitable address from one of the
  • interfaces, and the same port number we bind to. It is used as the
  • default address/port in SIP messages, and as the default address
  • (but not port) in SDP messages.
    */
    static struct sockaddr_in internip;[/code]

and only one other used for machines outside the NAT boundary.

[code]/*! \brief our external IP address/port for SIP sessions.

  • externip.sin_addr is only set when we know we might be behind
  • a NAT, and this is done using a variety of (mutually exclusive)
  • ways from the config file:
    • with “externip = host[:port]” we specify the address/port explicitly.
  • The address is looked up only once when (re)loading the config file;
    • with “externhost = host[:port]” we do a similar thing, but the
  • hostname is stored in externhost, and the hostname->IP mapping
  • is refreshed every ‘externrefresh’ seconds;
    • with “stunaddr = host[:port]” we run queries every externrefresh seconds
  • to the specified server, and store the result in externip.
  • Other variables (externhost, externexpire, externrefresh) are used
  • to support the above functions.
    /
    static struct sockaddr_in externip; /
    !< External IP address if we are behind NAT */[/code]

I’m not aware of changes in later versions, which means that the application layer will arbitrarily choose one address, which is not going to work if you have disjoint networks, unless the other sides ignore the information in the SIP headers and just use the actual source address.

I tend to describe the sort of configuration you seem to want as an “improperly multi-homed” one.