How to bind Asterisk to use one particular IP address/interface?

Hello,

I have installed FreePBX 2.5.2.3 using AsteriskNow 1.5 which has Asterisk 1.4.24.

I have registered SIP clients and they are able to successfully make calls, however some of traffic is using the managment network.

The Asterisk has two interfaces (one for management and one for inband). The SIP clients register using the inband network, but sometimes the Asterisk responds using the management network.

Is there a way to force Asterisk to only use one of the NICs/IPs?

Thanks in advance for any tips!

if you have installed the SIP Settings module in freePBX you can go in and bind the asterisk listeners to a specific IP address.

Thanks- Where do I get the SIP Settings module? I do not see it listed in the Module Administration page.

I don’t think you actually want to bind. This would stop clients from registering on the management interface altogether.

Do you have your localnet settings correct in either sip_nat.conf or sip_general_custom.conf?

If you don’t have a new enough version for the SIP settings module you can set it manually in sip_general_custom.conf.

Here is a list of all Asterisk sip channel general and peer specific variables:

http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf

Yes you can bind to one specific interface. In sip_general_custom.conf and iax_general_custom.conf add the following line (usually the conf files are empty):

bindaddr= (IP address of interface) <= no brackets

This will bind the SIP and IAX protocol to the IP address of the interface of your choice.

A typical problem when using two interfaces without binding the protocols is this:

Phone A registers to the IP address of eth0, but due to internal “routing” (default route, iptables, etc…), the PBX responds through eth1. The PBX’s response is from eth1’s IP address. Phone A says “Who are you? I’m registering to eth0’s IP address!” and tries to register again to eth0’s IP address. The result is that Phone A never completes the registration even though the PBX is talking to it.

the bindaddr=x.x.x.x is one of the entries [along with port and NAT management] that can be managed using the SIP Settings Modules and IAX Settings modules. The modules also allow free form editing for those of us interested in managing QoS/ToS.

Managing the bind address also is critical if you use multple IP addresses on the same NIC [as, for example, when using a floating IP address in an HA cluster]. In that circumstance, asterisk has a rather nasty habit of listening for SIP/IAX on the virtual IP address but replying on the base address of the NIC causing phones/trunks to fail to register.

I found these two little modules to be great conveniences over editing the files directly and makes a useful checklist to make sure you remember all the needed settings.

Are the SIP Settings Modules and IAX Settings modules part of Asterisk itself, AsteriskNow, or Freepbx? Where do I get and configure them?
Would these modules solve the issues in the following thread?
http://www.mail-archive.com/[email protected]/msg37817.html

Thanks

these modules are freePBX modules.

you can bind SIP to either a single IP address or all addresses [bindaddr=0.0.0.0] but there is no way, as far as i know, to bind SIP to more than one address other than all addresses so the question posed in the linked question of attaching SIP trunks to specific NICs cannot be done through asterisk alone. However, it seems it could effectively and simply be done by managing the static routes on the server.