Tuesday, March 29, 2016

Elastix multiple external ip

In this article I want to share the experience to add multiple addresses for Elastix/Asterisk server. This can be used in the following scenarios:
1. A cluster of two Elastix servers (http://www.elastix.com/en/elastix-high-availability-in-detail-2/)
2. Single Elastix server and two voip-provider
3. A cluster of two Elastix servers and two voip-provider

'extrnip' parameter can specify only one IP address in the file sip.conf. Therefore 'externip' in this case is not needed. To use a different address just add routes such as

Server1: internal 192.168.0.1 external_1 192.168.1.1 external_2 192.168.1.2
Server2: internal 192.168.0.2 external_1 192.168.1.5 external_2 192.168.1.5
Virtual IP: external_1 192.168.1.3, isp_1 192.168.1.4, external_2 192.168.1.6, isp_2 192.168.1.7

001
002
ip route add 192.168.1.4/32 via 192.168.1.3 dev eth1 src 192.168.1.3
ip route add 192.168.1.7/32 via 192.168.1.6 dev eth1 src 192.168.1.6

to routes added during the event HA
- create script "/etc/ha.d/resource.d/IProute"

001
002
003
004
005
006
007
008
009
010
#!/bin/bash

args=("$@")

if [ ${args[0]} == "start" ]then
        ip route add 192.168.1.4/32 via 192.168.1.3 dev eth1 src 192.168.1.3
        ip route add 192.168.1.7/32 via 192.168.1.6 dev eth1 src 192.168.1.6
fi

exit 0

- add script "IProute" to config HA "/etc/ha.d/haresources"

001
voipserver.drbd drbddisk::r0 Filesystem::/dev/drbd0::/replica::ext3 IPaddr::192.168.0.3/24/eth0/192.168.0.255 IPaddr::192.168.1.3/27/eth1/192.168.1.31 IPaddr::192.168.1.6/27/eth1/192.168.1.31 IProute mysqld asterisk httpd elastix-updaterd

No comments:

Post a Comment