Anjul Srivastava
2007-Mar-15 14:11 UTC
[asterisk-users] sip_nat.conf - Asterisk with two Ethernet Interfaces
Will this do the intended thing? This is in sip_nat.conf which is included in sip.conf: externip=192.168.0.200 localnet=192.168.0.200/255.255.255.0 externip=64.168.237.110 localnet=192.168.1.2/255.255.255.0 I have Asterisk running on a box with two Ethernet interfaces and bound to both. One interface, 192.168.1.2 services clients outside the firewall who are led to believe that Asterisk is running at 64.168.237.110. The other interface, 192.168.0.200 services clients inside the firewall who are led to believe that Asterisk is running at 192.168.0.200. I am worried that Asterisk might not do what I am intending to do. What I want is for Asterisk to send SIP/SDP Connection Info as 64.168.237.110 to those clients that contact it on 192.168.1.2, and to send SIP/SDP Connection Info as 64.168.237.110 to those that contact it on 192.168.0.200. I am worried that it might use the last externip=... declaration for both interfaces and ignore the other one. Could somebody help me with determining the treatment of the multiple externip=... declarations? Or point me to how I could verify? I don't want to wait until the evening to find out from outside the firewall that this doesn't work. (It is working fine from within the firewall where I contact asterisk at 192.168.0.200) Thank you! Best regards, Anjul.
Anjul Srivastava
2007-Mar-15 20:06 UTC
[asterisk-users] Re: sip_nat.conf - Asterisk with two Ethernet Interfaces
I figured it out by examining the log files. The following works but not as hypothesized above. 1. the second externip overrides the first, so externip can only be specified once 2. the first localnet and the second localnet are BOTH understood and used. 3. asterisk tests the destination IP against BOTH localnet specifications, and if the destination IP does NOT match, THEN it substitutes its SOURCE IP with externip. 4. if the source IP is not substituted then the correct local source IP is used depending upon which interface the request came from. so, all's good, at least for my scenario. <quote who="Anjul Srivastava">> Will this do the intended thing? > > This is in sip_nat.conf which is included in sip.conf: > > > externip=192.168.0.200 > localnet=192.168.0.200/255.255.255.0 > externip=64.168.237.110 > localnet=192.168.1.2/255.255.255.0 > > I have Asterisk running on a box with two Ethernet interfaces and bound to > both. One interface, 192.168.1.2 services clients outside the firewall > who are led to believe that Asterisk is running at 64.168.237.110. The > other interface, 192.168.0.200 services clients inside the firewall who > are led to believe that Asterisk is running at 192.168.0.200. > > I am worried that Asterisk might not do what I am intending to do. What > I want is for Asterisk to send SIP/SDP Connection Info as 64.168.237.110 > to those clients that contact it on 192.168.1.2, and to send SIP/SDP > Connection Info as 64.168.237.110 to those that contact it on > 192.168.0.200. > > I am worried that it might use the last externip=... declaration for both > interfaces and ignore the other one. > > Could somebody help me with determining the treatment of the multiple > externip=... declarations? Or point me to how I could verify? > > I don't want to wait until the evening to find out from outside the > firewall that this doesn't work. (It is working fine from within the > firewall where I contact asterisk at 192.168.0.200) > > Thank you! > > Best regards, > Anjul. >