Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux Virtual Server: Users

[lvs-users] LVS + Asterisk

 

 

Linux Virtual Server users RSS feed   Index | Next | Previous | View Threaded


greno at verizon

May 16, 2008, 11:25 AM

Post #1 of 9 (2402 views)
Permalink
[lvs-users] LVS + Asterisk

Hi again,
Ok, I finished setting up some pbx (asterisk). Can I use LVS to load
balance the call traffic between multiple pbx's? Or with SIP protocol
is it necessary to use OpenSER?

Regards,
Gerry


_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


graeme at graemef

May 16, 2008, 12:27 PM

Post #2 of 9 (2344 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

On Fri, 2008-05-16 at 14:25 -0400, Gerry Reno wrote:
> Ok, I finished setting up some pbx (asterisk). Can I use LVS to load
> balance the call traffic between multiple pbx's? Or with SIP protocol
> is it necessary to use OpenSER?

You probably can, but given the nature of SIP - two transport protocols,
multi-port, session based - it could get very complicated.

Have you tried it?

Graeme


_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


greno at verizon

May 16, 2008, 12:34 PM

Post #3 of 9 (2345 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

Graeme Fowler wrote:
> On Fri, 2008-05-16 at 14:25 -0400, Gerry Reno wrote:
>
>> Ok, I finished setting up some pbx (asterisk). Can I use LVS to load
>> balance the call traffic between multiple pbx's? Or with SIP protocol
>> is it necessary to use OpenSER?
>>
>
> You probably can, but given the nature of SIP - two transport protocols,
> multi-port, session based - it could get very complicated.
>
> Have you tried it?
>
> Graeme
>
>
Not yet. I was concerned about SIP and wasn't sure how to set it up in
my keepalived.conf

Regards,
Gerry

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


graeme at graemef

May 16, 2008, 12:46 PM

Post #4 of 9 (2339 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

On Fri, 2008-05-16 at 15:34 -0400, Gerry Reno wrote:
> Not yet. I was concerned about SIP and wasn't sure how to set it up in
> my keepalived.conf

You could definitely sort out the main ports - TCP & UDP port 5060 -
trivially; but the follow-on complication is how you then track the
session traffic which can wander around all over the place (cf. the LVS
FTP helper).

I'd strongly recommend you have a good read of the Asterisk mailing list
- it seems that there are several app-based load balancing schemes for
Asterisk, and if they do what you need, I'd use them.

Graeme




_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


greno at verizon

May 16, 2008, 12:52 PM

Post #5 of 9 (2342 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

Graeme Fowler wrote:
> You could definitely sort out the main ports - TCP & UDP port 5060 -
> trivially; but the follow-on complication is how you then track the
> session traffic which can wander around all over the place (cf. the LVS
> FTP helper).
>
> I'd strongly recommend you have a good read of the Asterisk mailing list
> - it seems that there are several app-based load balancing schemes for
> Asterisk, and if they do what you need, I'd use them.
>
>
I had seen several references where people had said they had done this
with lvs so that is what gave me the idea. But maybe this is a case
where an app-based LB scheme might be best.

Regards,
Gerry


_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


morgan at mediatemple

May 17, 2008, 2:18 PM

Post #6 of 9 (2320 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

In theory, you could use a FWM (firewall mark) setup and persistent
connections. If you map the virtual server group to use the same FWM
for the TCP ( SIP uses TCP port 5060) and UDP (RTP usually is
configured for UDP ports 16384-32767) datastreams. It should work in
theory.

However, the application-based Load-balancing in Asterisk does
function fairly well and you might end up with a better solution.
Typically, with load-balancing I find that the more complexity you add
just makes it that much harder to debug when things go awry.

--
Morgan Fainberg
Systems Architect
(mt) Media Temple, Inc
http://www.mediatemple.net/

On May 16, 2008, at 12:52 PM, Gerry Reno wrote:

> Graeme Fowler wrote:
>> You could definitely sort out the main ports - TCP & UDP port 5060 -
>> trivially; but the follow-on complication is how you then track the
>> session traffic which can wander around all over the place (cf. the
>> LVS
>> FTP helper).
>>
>> I'd strongly recommend you have a good read of the Asterisk mailing
>> list
>> - it seems that there are several app-based load balancing schemes
>> for
>> Asterisk, and if they do what you need, I'd use them.
>>
>>
> I had seen several references where people had said they had done this
> with lvs so that is what gave me the idea. But maybe this is a case
> where an app-based LB scheme might be best.
>
> Regards,
> Gerry
>
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
> Send requests to lvs-users-request [at] LinuxVirtualServer
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users


_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


greno at verizon

May 25, 2008, 7:48 AM

Post #7 of 9 (2219 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

Morgan Fainberg wrote:
> In theory, you could use a FWM (firewall mark) setup and persistent
> connections. If you map the virtual server group to use the same FWM
> for the TCP ( SIP uses TCP port 5060) and UDP (RTP usually is
> configured for UDP ports 16384-32767) datastreams. It should work in
> theory.
>
> However, the application-based Load-balancing in Asterisk does
> function fairly well and you might end up with a better solution.
> Typically, with load-balancing I find that the more complexity you add
> just makes it that much harder to debug when things go awry.
>
>
I think the fwmark approach might work. And I like this since
load-balancing with LVS is better for me because I have all my other
services on it.
I'm keeping all traffic going through the Asterisk box with
canreinvite=no. canreinvite=yes would present a further scenario as the
endpoints would then end up in direct communication for RTP.
You'll have to excuse me if I've oversimplified this. I have not used
fwmarks before.

So let's see, I'm using keepalived so in the conf I guess I would have
something like:
virtual service RS_IP 5060 { # SIP
persistent...
virtual service fwmark 1 { # SIP RTP
persistent...

In iptables (directors):
iptables -t mangle -A PREROUTING -p udp -d 192.168.1.27-28 --dport
10000:20000 -j MARK --set-mark 1 # SIP RTP: where -d has ip of real servers

In iptables (realservers): # only for NAT, what about DR?
iptables -A PREROUTING -t mangle -d <VIRTUAL_IP> -j MARK --set-mark 1 #
route back to director

Does this look reasonable?

Regards,
Gerry


_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


morgan at mediatemple

May 26, 2008, 12:12 PM

Post #8 of 9 (2185 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

Those looks reasonable, however, you will probably not want to
separate the SIP and RTP traffic. It would make more sense to use two
iptables rules that set the same firewall mark. IE: You can set as
many iptables rules as the system can handle to assign a given
firewall mark. Any traffic (regardless of port/type) can be balanced
with the FWM. FWM is (as you can see by the ipvsadm man-page) it's
own service type. Instead of specifying --tcp-service or --udp-
service you specify --fwmark-service. Given that I use Keepalived vs.
the other methods, it is slightly different than making direct calls
with ipvsadm.

In short, no need to have separate VIPS for SIP and RTP unless you
have different servers handing SIP traffic.

It would probably look something more like this:

> virtual service fwmark 1 { # SIP RTP
> persistent...

> iptables -t mangle -A PREROUTING -p udp -d 192.168.1.27-28 --dport
> 10000:20000 -j MARK --set-mark 1 # SIP RTP: where -d has ip of real
> servers
> iptables -t mangle -A PREROUTING -p tcp -d 192.168.1.27-28 --dport
> 5060 -j MARK --set-mark 1 # SIP RTP: where -d has ip of real servers

I've not used FWM+NAT in a good long while. You probably don't need
to set the firewall mark on the realservers as the firewall mark (I
don't believe) stays with the packet once it leaves the local
networking stack (ie, it is not sent out on the wire). So unless the
system needs to do something specific with the firewall mark (IE
iprule to policy-route to the director) the firewall mark will not
need to be set on the real-server.

A DR configuration should work almost identically, however, I've not
done UDP in a DR configuration (always NAT). A standard DR
configuration ~should~ function for a Asterisk setup like this.

--
Morgan Fainberg
Systems Architect
(mt) Media Temple, Inc
http://www.mediatemple.net/

On May 25, 2008, at 7:48 AM, Gerry Reno wrote:

> Morgan Fainberg wrote:
>> In theory, you could use a FWM (firewall mark) setup and persistent
>> connections. If you map the virtual server group to use the same FWM
>> for the TCP ( SIP uses TCP port 5060) and UDP (RTP usually is
>> configured for UDP ports 16384-32767) datastreams. It should work
>> in
>> theory.
>>
>> However, the application-based Load-balancing in Asterisk does
>> function fairly well and you might end up with a better solution.
>> Typically, with load-balancing I find that the more complexity you
>> add
>> just makes it that much harder to debug when things go awry.
>>
>>
> I think the fwmark approach might work. And I like this since
> load-balancing with LVS is better for me because I have all my other
> services on it.
> I'm keeping all traffic going through the Asterisk box with
> canreinvite=no. canreinvite=yes would present a further scenario as
> the
> endpoints would then end up in direct communication for RTP.
> You'll have to excuse me if I've oversimplified this. I have not used
> fwmarks before.
>
> So let's see, I'm using keepalived so in the conf I guess I would have
> something like:
> virtual service RS_IP 5060 { # SIP
> persistent...
> virtual service fwmark 1 { # SIP RTP
> persistent...
>
> In iptables (directors):
> iptables -t mangle -A PREROUTING -p udp -d 192.168.1.27-28 --dport
> 10000:20000 -j MARK --set-mark 1 # SIP RTP: where -d has ip of real
> servers
>
> In iptables (realservers): # only for NAT, what about DR?
> iptables -A PREROUTING -t mangle -d <VIRTUAL_IP> -j MARK --set-mark
> 1 #
> route back to director
>
> Does this look reasonable?
>
> Regards,
> Gerry
>
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
> Send requests to lvs-users-request [at] LinuxVirtualServer
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


greno at verizon

May 26, 2008, 1:41 PM

Post #9 of 9 (2183 views)
Permalink
Re: [lvs-users] LVS + Asterisk [In reply to]

Morgan Fainberg wrote:
> Those looks reasonable, however, you will probably not want to
> separate the SIP and RTP traffic. It would make more sense to use two
> iptables rules that set the same firewall mark. IE: You can set as
> many iptables rules as the system can handle to assign a given
> firewall mark. Any traffic (regardless of port/type) can be balanced
> with the FWM. FWM is (as you can see by the ipvsadm man-page) it's
> own service type. Instead of specifying --tcp-service or --udp-
> service you specify --fwmark-service. Given that I use Keepalived vs.
> the other methods, it is slightly different than making direct calls
> with ipvsadm.
>
> In short, no need to have separate VIPS for SIP and RTP unless you
> have different servers handing SIP traffic.
>
> It would probably look something more like this:
>
>
>> virtual service fwmark 1 { # SIP RTP
>> persistent...
>>
>
>
>> iptables -t mangle -A PREROUTING -p udp -d 192.168.1.27-28 --dport
>> 10000:20000 -j MARK --set-mark 1 # SIP RTP: where -d has ip of real
>> servers
>> iptables -t mangle -A PREROUTING -p tcp -d 192.168.1.27-28 --dport
>> 5060 -j MARK --set-mark 1 # SIP RTP: where -d has ip of real servers
>>
>
> I've not used FWM+NAT in a good long while. You probably don't need
> to set the firewall mark on the realservers as the firewall mark (I
> don't believe) stays with the packet once it leaves the local
> networking stack (ie, it is not sent out on the wire). So unless the
> system needs to do something specific with the firewall mark (IE
> iprule to policy-route to the director) the firewall mark will not
> need to be set on the real-server.
>
> A DR configuration should work almost identically, however, I've not
> done UDP in a DR configuration (always NAT). A standard DR
> configuration ~should~ function for a Asterisk setup like this.
>
>

Yes, of course, I need to keep the SIP and RTP together since I'm not
using a separate SIP server. So now if we use ARA we should have a good
extensible solution. To me this seems like it might be better than
OpenSER because with OpenSER you have a SPOF whereas with keepalived/LVS
you have more robust solution. My setup is LVS-DR so I need to think
is the direct return route is going to create any problems. Otherwise,
the only thing lacking in this picture is FreePBX does not support ARA :-(

Regards,
Gerry

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

Linux Virtual Server users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.