Dual NIC's

A am trying to use two NIC’s with Asterisk 1.6.2 as eth0 and eth1. Both networks have SIP devices. I can’t get both to work with SIP at the same time (though web serving, ssh etc are ok). bindaddr only has eth0 working. I can bindaddr for eth1 and it works, but then I lose all the devices on eth0.

I am following these directions from edgemarc exactly,…
portal.knowledgebase.net/display … aid=306414

To simplify I have also tried putting eth1 directly on the internet with its public IP.

Any idea how to use two nics with sip on asterisk at the same time?


It should just work. they are on different subnets ? and you have set the externip ?
also what does route show you as well as netstat -a |grep 5060 ?


Yes extern ip is x.x.x.163 eth0 is and eth1 is a public ip of x.x.x.163. eth0 can also get to the internet via the router which is x.164 on the WAN side an on the lan side.


Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface x.x.x.160 * U 0 0 0 eth1 * U 0 0 0 eth0 default UG 0 0 0 eth0

netstat -a |grep 5060 shows nothing…?

If I set the bindaddr to x.x.x.163 my external phones work on eth1, but my internal phones on eth0 stop working. If I set the bindaddr to then it’s the other way around.

It would seem that I have figured this one out… the default route needs to be set for the NIC with the public IP:

Destination Gateway Genmask Flags Metric Ref Use Iface <public IP>* U 0 0 0 eth0 * U 0 0 0 eth1 * U 0 0 0 eth1 default <public IP gateway> UG 0 0 0 eth0


I am running into a similar problem but my setup is a little different. I dont have or need NATing
My setup is as follows:


I am able to set a call and I have the audio coming from the outside world to my phone but the audio from my Phone IP(X.X)
is not going out to the SIP-Server. In fact I think it is not even reaching the Asterisk server. Here is the reason why?

The SDP in the 180 going to the phone has the IP address of the external-inf(Z.Z)

<--- Transmitting (NAT) to X.X.141.32:5060 ---> SIP/2.0 183 Session Progress^M Via: SIP/2.0/UDP X.X.141.32;branch=z9hG4bK87468d20000002f44b86a00400006f2b00000166;received=X.X.141.32;rport=5060^M From: "Irfan Lateef" <sip:2005@Y.Y.47.149>;tag=327f290e2e7^M To: <sip:99084611234@Y.Y.47.149>;tag=as24228e21^M Call-ID: 876BAA6B36F644F7B4EF7BE5D4B7E8BD0x87468d20^M CSeq: 2 INVITE^M User-Agent: Asterisk PBX^M Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO^M Supported: replaces, timer^M Require: timer^M Session-Expires: -1;refresher=uas^M Contact: <sip:99084611234@Z.Z.247.106>^M Content-Type: application/sdp^M Content-Length: 315^M ^M v=0^M o=root 1021147583 1021147583 IN IP4 Z.Z.247.106^M s=Asterisk PBX^M [b]c=IN IP4 Z.Z.247.106[/b]^M t=0 0^M m=audio 18702 RTP/AVP 0 8 3 101^M

I have the following in the sip_nat.conf

localnet=Y.Y.47.149/ externhost=Z.Z.247.106 externrefresh=10 fromdomain=att.com nat=yes qualify=yes canreinvite=no

I think the SDP should have give the Y.Y.47.149 IP on the local net side to the phone. But I am unable to figure how make it do that.

The Asterisk log shows this.

[Feb 25 11:06:30] VERBOSE[1449] logger.c: -- Executing [s@macro-dialout-trunk:19] ^[[1;36;40mDial^[[0;37;40m("^[[1;35;40mSIP/2005-19dc0db8^[[0;37;40m", "^[[1;35;40mSIP/ATT-alpi016-IPFlex1/19084611234,300,^[[0;37;40m") in new stack [Feb 25 11:06:30] VERBOSE[1449] logger.c: == Using SIP RTP TOS bits 184 [Feb 25 11:06:30] VERBOSE[1449] logger.c: == Using SIP RTP CoS mark 5 [Feb 25 11:06:30] VERBOSE[1449] logger.c: -- Called ATT-alpi016-IPFlex1/19084611234 [Feb 25 11:06:32] VERBOSE[1449] logger.c: -- SIP/ATT-alpi016-IPFlex1-19dda0f8 is making progress passing it to SIP/2005-19dc0db8 [Feb 25 11:06:32] VERBOSE[1449] logger.c: Audio is at Z.Z.247.106 port 18702 [Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding codec 0x4 (ulaw) to SDP [Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding codec 0x8 (alaw) to SDP [Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding codec 0x2 (gsm) to SDP [Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding non-codec 0x1 (telephone-event) to SDP [Feb 25 11:06:32] VERBOSE[1449] logger.c:

Any help is greatly appreciated.

Thanks and Regards,
Irfan Lateef


I fixed the problem myself. I posted the solution on asterisk-users list.
If you are interested here is the link.