[asterisk-users] 2 NICs; Asterisk receives on eth1 and replies on eth0

kjcsb kjcsb at orcon.net.nz
Mon Jul 10 21:31:26 MST 2006


I have an Asterisk server with 2 network cards. One provides the LAN 
connection and the other provides the Internet connection. Currently this is 
set up in the following way:

eth0 192.168.1.5. This provides LAN connectivity

eth1 192.168.1.251, gw 192.168.1.252 (Note that other nodes on the network 
use a different gateway, not 192.168.1.252). This provides the internet 
connection. The router is set up with DMZ enabled and pointing to 
192.168.1.251.



Currently, when a SIP device attempts to register across the internet, the 
following sip dialogue is observed:



U 60.234.nnn.nnn:5060 -> 192.168.1.251:5060

  REGISTER sip:60.234.xxx.xxx SIP/2.0..Via: SIP/2.0/UDP 
60.234.nnn.nnn;branch=z9hG4bK9d31000024770000..From: "CallerID" 
<sip:1590 at 60.234.xxx.xxx>;tag=bec20000273bffff..To: 
<sip:1590 at 60.234.xxx.xxx>..Contact: <sip:1590 at 60.234.nnn.nnn>..Call-ID: 
1d19ffff20040000 at 192.168.0.16..CSeq: 100 REGISTER..Expires: 60..User-Agent: 
Grandstream HT488 1.0.2.16..Max-Forwards: 70..Allow: 
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,

  OPTIONS,INFO,SUBSCRIBE..Content-Length: 0....

#

U 192.168.1.5:5060 -> 60.234.nnn.nnn:5060

  SIP/2.0 100 Trying..Via: SIP/2.0/UDP 
60.234.nnn.nnn;branch=z9hG4bK9d31000024770000;received=60.234.nnn.nnn..From: 
"CallerID" <sip:1590 at 60.234.xxx.xxx>;tag=bec20000273bffff..To: 
<sip:1590 at 60.234.xxx.xxx>..Call-ID: 1d19ffff20040000 at 192.168.0.16..CSeq: 100 
REGISTER..User-Agent: Asterisk PBX..Allow: INVITE, ACK, CANCEL, OPTIONS, 
BYE, REFER, SUBSCRIBE, NOTIFY..Contact: 
<sip:1590 at 60.234.xxx.xxx>..Content-Length: 0....

###

U 192.168.1.5:5060 -> 60.234.nnn.nnn:5060

  SIP/2.0 401 Unauthorized..Via: SIP/2.0/UDP 
60.234.nnn.nnn;branch=z9hG4bK9d31000024770000;received=60.234.nnn.nnn..From: 
"CallerID" <sip:1590 at 60.234.xxx.xxx>;tag=bec20000273bffff..To: 
<sip:1590 at 60.234.xxx.xxx>;tag=as23747970..Call-ID: 
1d19ffff20040000 at 192.168.0.16..CSeq

  : 100 REGISTER..User-Agent: Asterisk PBX..Allow: INVITE, ACK, CANCEL, 
OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY..Contact: 
<sip:1590 at 60.234.xxx.xxx>..WWW-Authenticate: Digest realm="asterisk", 
nonce="1442f9e8"..Content-Length: 0....



where:

60.234.nnn.nnn is public IP of SIP client

60.234.xxx.xxx is public IP of Asterisk server



Asterisk seems to be replying on eth0 whereas the inbound traffic was 
received on eth1.



This leads me to think that there's a better way to configure the network. 
If anyone could provide some advice I would appreciate it. If the setup is 
reasonable, how do I get Asterisk to reply on eth1?



Thanks in advance



Cameron




More information about the asterisk-users mailing list