asterisk con 2 ISP pseudo HOWTO, and one doubt

azoth

Joined
Jan 16, 2009
Messages
5
Likes
0
Points
0
#1
Hello!

During the last days I have been configuring an elastix server with redundant connections, i found almost no documentation about this topic so i want to share my experience and also ask your for help about a NAT topic at the end

I have two internet connections with two different ISPs, each connection has a public IP:

ISP1 = 190.xx.xx.xx
ISP2 = 200.xx.xx.xx


each conecion is managed by router making NAT on ports 5060 and 10000 to 20000, the routers also make QoS

router1 = 192.168.100.1
router2 = 192.168.200.1


The asterisk server has two network cards:

eth0 = 192.168.100.7
eth1 = 192.168.200.7


the sip.conf files has the line:

bindaddr = 0.0.0.0

Sometimes it used to work with ISP1 and sometimes with ISP2 but never with both at the same time! after a lot of changes and headaches i found out that the server could only use one default gateway, so i:

Added the lines:

100 ISP1
200 ISP2


at the end of /etc/iproute2/rt_tables

and entered the next commands as root:

ip rule add from 192.168.200.0/24 to 0.0.0.0/0 table 200
ip route add default via 192.168.200.1 table 200
ip rule add from 192.168.100.0/24 to 0.0.0.0/0 table 100
ip route add default via 192.168.100.1 table 100



and then the server let the users to register using port 5060, does not matter if they come from 190.xx.xx.xx or 200.xx.xx.xx

however when they make a call the other end did not hear anything, as this is a common NAT problem, i had to add more lines to sip.conf that is now:


nat=yes
bindaddr=0.0.0.0
externip=190.xx.xx.xx ; públic IP of ISP1
localnet=192.168.100.0/255.255.255.0 ; private network
qualify=yes
allow=gsm

and now everything is working, clients can connect using 190.xx.xx.xx or 200.xx.xx.xx and make calls

However i am not really confident about externip and localnet
this way, if i change them for the ISP2 public IP and network it also works. If type twice externip and localnet the NAT problem comes back and there is no sound in one end.


Does exist a better way to configure a redundant elastix server with two ISPs?

I have experience with GNU/Linux but this is my first asterisk server and would appreciate whatever you can teach me.

Have a nice day


Azoth
 

telecomtechnician

Joined
Jan 8, 2008
Messages
422
Likes
0
Points
16
#2
Hola

Me parece excelente lo que hiciste. Lo que te sugiero es que te consigas un router de dos puertos WAN, y conectas las dos IP allí. De esa manera no tienes que preocuparte que IP funciona y cual no, el router se encarga de hacer el balanceo de carga de manera automática.

Si tienes el servidor elastix con dos tarjetas de red, utiliza una para conectarte a el lado de la lan, y la otra para conectarte a la wan.

Saludos

David Medina
 

azoth

Joined
Jan 16, 2009
Messages
5
Likes
0
Points
0
#3
Hola,

Gracias por tomarte el tiempo para responder!

Lo que pasa es que yo necesito redundancia y si pongo un solo enrutador con dos conexiones WAN y este se apaga, resetea, muere etc todo el sistema va a fallar (tengo otros 3 servidores funcionando ademas del pbx), por eso preferi poner dos enrutadores distintos y todos los equipos con dos tarjetas de red, asi aunque un servidor o enrutador falle los demas servicios siguen estando disponibles.

alguna otra idea?

Azoth
 

azoth

Joined
Jan 16, 2009
Messages
5
Likes
0
Points
0
#4
In case somebody else finds my little howto, i found out it does not work in production :(

Altough the operating system supports very well two gateways asterisk DOES NOT, and get in conflict with iptables in 40% of the calls and therefore you have calls without audio in one end, despite if you hang up, unregister, register again, make the same call and it works.

Using an sniffer i could find the rtp packets taking different weird ways, for example sip traffic with 1 public IP and RTP traffic in the other public IP.

Thats very unlucky that asterisk lacks of this feature and bindr=0.0.0.0 does practically nothing, while other software like apache2, samba etc use this option very well.


Azoth
 

azoth

Joined
Jan 16, 2009
Messages
5
Likes
0
Points
0
#5
Hey!

I found that using iax instead of sip, asterisk seems to work with both ISPs, i have to run depeer tests, but it seems to work in my environment!!!

Azoth
 

concentra

Joined
Jul 1, 2008
Messages
26
Likes
0
Points
1
#6
Hi !
Have you addressed this issue successfully ?
I want to have 2 ( or 3 ) conections and want some trunks using a connection and others using other connection, like a "fixed" load balance...

Maurício Faria
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,938
Messages
130,959
Members
17,632
Latest member
moaulool
Top