[asterisk-users] Multi-homed SIP in Asterisk 11?

john at millican.us john at millican.us
Wed Jul 31 09:53:21 CDT 2013


On 7/31/2013 10:32 AM, Tony Mountifield wrote:
> Most of my experience until recently has been in Asterisk 1.2, and I am
> just starting to make use of Asterisk 11 for new systems.
>
> I have a question about using SIP on a multi-homed machine.
>
> I have a customer who wants an Asterisk box with two network interfaces:
> one on the public Internet (no NAT), and one on a private LAN. The box
> will not do any IP forwarding between interfaces. They want to connect
> to a SIP trunk from an ITSP via the public interface, and to have SIP
> phones on their LAN registered via the private interface.
>
> I haven't tried such a setup before, so before creating a test system,
> I wondered if anyone here has made such a setup, and whether there are
> any issues with getting SDP contents and media routing correct?
>
> Cheers
> Tony
I built a setup like this a few years back.  I believe the hurdle was 
more for the OS than asterisk.

Let say the the two networks are 192.168.10.0/24 and 192.168.11.0/24  
and the gateways are 192.168.10.1 and 192.168.11.1 respectively, and the 
asterisk box server has the two interfaces as 192.168.10.11 and 
192.168.11.11

from memory(warning: my memory is not what it used to be):

echo "1 TenNet" >> /etc/iproute2/rt_tables
echo "2 ElevenNet" >> /etc/iproute2/rt_tables

ip route add 192.168.10.0/24 dev eth0 src 192.168.10.11 table TenNet
ip route add 192.168.11.0/24 dev eth1 src 192.168.11.11 table ElevenNet

ip route add default via 192.168.10.1 dev eth0 table TenNet
ip route add default via 192.168.11.1 dev eth1 table ElevenNet

ip route show 2>&1 >> $logFile

ip rule add from 192.168.10.11/32 table TenNet
ip rule add from 192.168.11.11/32 table ElevenNet

ip rule add to 192.168.10.11/32 table TenNet
ip rule add to 192.168.11.11/32 table ElevenNet

All that the above does is ensure that traffic is routed out the correct 
interface based on where it is headed. I.E. All traffic for 
192.168.10.0/24 goes out eth0 all traffic for 192.168.11.0/24 goes out eth1

Then in asterisk I believe I add a localnet setting in sip.conf  as 
192.168.11.0, could be wrong on this though.

JohnM




More information about the asterisk-users mailing list