Iax trunk with 2 nics wan

Hi
I have 2 running asterisk server connected through 2 iax trunks ,on one of the two servers has 2 nics ,each one is connected to ADSL router,and i want to bind the first iax trunk to one nic and the second iax trunk to the other nic.
is it possible to use the directive BINDADDR in the iax.conf to do this?

port 12300 :listing port of trunk iax1
port 12301:listing port of trunk iax2

iax.conf



bindaddr=192.168.1.2:12300
bindaddr=192.168.0.1:12301

thx in advance !

Hi,

No, you either have to bind to one specific address or all addresses, not a subset of addresses. You’ll have to run multiple copies of Asterisk if you want to achieve that.

thx for the reply
ok i get it,this is not supported yet using binaddr,but is there another way to do it?

the first iax trunk is using the port 12345
the second iax trunk is using the port 11665

can i use netfilter and iptables to force asterisk to listen on both nics ? i mean to use a range of ports to listen on nic1 and the other range to listen on nic2?

thank you for help.

Hi,

No, because one instance of Asterisk can’t listen on multiple ports for the same protocol. You’ll have to run two instances of Asterisk if you want this done. I do not think trying to use iptables to route traffic from two separate ports on two interfaces into one port on one interface will work without fault.

Cheers.

Perhaps you could try Port redirection with iptables (Asterisk listenes only on one port, but you use iptables to translate the public port to the port that Asterisk is listening to). Here is an example:

cyberciti.biz/faq/linux-port … -iptables/

But I have to agree with malcomd, I doubt this would work without any faults.

thx a lot guys for your help
it turned out to be possible using iptables mangle chain
voip-info.org/wiki/view/Use+ … on+for+SIP

Best regards