RTPengine.conf direction flags with multiple IP's and interface lines

302 views
Skip to first unread message

Balding John

unread,
Aug 25, 2024, 12:17:31 PM8/25/24
to Sipwise rtpengine
Hey all,

Hopefully a quick question about RTPengine high availability.

(Tl;Dr at the bottom)

Bit of background: I have a setup with a cloud provider where I am using a cluster of RTPengines for using with kamailio to send public traffic to private subnet for further processing and vice-versa.

This is currently single VM's that are controlled via the Kamailio RTPengine module and I use direction flags in the manage (direction=public direction=private) to facilitate this.

My next fun task is to get an active/active setup with failover using redis keyspaces using ths wiki page: https://github.com/sipwise/rtpengine/wiki/Redis-keyspace-notifications

I have a dumb loadbalancer that will always choose the "primary" VM unless it is down. When it is classes as being down it swaps the traffic to the second node in the pool so the failover looks like this:

rtp1 - primary 1 and fails over to 2
rtp2 - primary 2 and fails over to 3
rtp3 - primary 3 and fails over to 1

This is for both public and Private IP's as both ends are loadbalanced and each VM will have a different interface for each IP.  

The thing I am struggling to figure out is the flags and how they will work once I failover. Mainly, as the IP's will be the same at both ends and the only thing that is changing is the VM and its config file.

So the question (finally) is - How should I define each IP on the VM in the rtpengine.conf and still maintain the direction flags if I need to expand more than the 3 in future?

I assume I need multiple "interface =" lines for each and define them like the below:
    interface = private/{{ rtp1private }};public/{{ rtp1public }}
    interface = private/{{ rtp2private }};public/{{ rtp2public }}

I haven't got around to getting this setup and tested yet as I am struggling with the terraform templates to create it, but I reckon I will have to ask the question anyway.

Is this a fair assumption or have I missed something drastic here?

Tl;Dr - Can I use the same direction flags when you have multiple interface IP's defined in the rtpengine.conf file. And does it matter if these are different interfaces, or just sub interfaces?

David Tek

unread,
Aug 26, 2024, 8:23:36 AM8/26/24
to rtpe...@googlegroups.com
Hello,

You should only ever have one interface line in your rtpengine.conf.


It sounds like you want the same IPs on the main and backup nodes, but want the order the IPs offered to changed depending on which node is active?


If that's the case, the primary rtpengine would have:

    interface = private/{{ rtp1private }};public/{{ rtp1public }};private/{{ rtp2private }};public/{{ rtp2public }}

and the backup rtpengine would have:

    interface = private/{{ rtp2private }};public/{{ rtp2public }};private/{{ rtp1private }};public/{{ rtp1public }}


As per the link above, this will cause the ip rtp1private to be used by the primary node and rtp2private by the backup node.

Does that make sense?

David

















--
You received this message because you are subscribed to the Google Groups "Sipwise rtpengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtpengine+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rtpengine/1f0346e0-ac73-490f-bae5-7c5fe6fbea58n%40googlegroups.com.

Richard Fuchs

unread,
Aug 26, 2024, 8:40:20 AM8/26/24
to rtpe...@googlegroups.com
On 26/08/2024 08.23, David Tek wrote:

It sounds like you want the same IPs on the main and backup nodes, but want the order the IPs offered to changed depending on which node is active?


If that's the case, the primary rtpengine would have:

    interface = private/{{ rtp1private }};public/{{ rtp1public }};private/{{ rtp2private }};public/{{ rtp2public }}

and the backup rtpengine would have:

    interface = private/{{ rtp2private }};public/{{ rtp2public }};private/{{ rtp1private }};public/{{ rtp1public }}


As per the link above, this will cause the ip rtp1private to be used by the primary node and rtp2private by the backup node.

You and the OP may be interested in the new "interface alias name" syntax that was added recently: https://rtpengine.readthedocs.io/en/latest/rtpengine.html#alias-names

(and I see that there was some formatting in the examples that must have gotten lost somewhere along the way, as the interfaces in the config need to be separated by semicolons, not spaces)

So to support such a setup more explicitly without having to rely on order in the config, you would put something like this on the first node:

interface = private1/{{ rtp1private }};public1/{{ rtp1public }};private2/{{ rtp2private }};public2/{{ rtp2public }};private=private1;public=public1

and on the second one:

interface = private1/{{ rtp1private }};public1/{{ rtp1public }};private2/{{ rtp2private }};public2/{{ rtp2public }};private=private2;public=public2

IOW the config is the same except for the alias names. In your signalling to rtpengine you would then only refer to the interfaces through their alias names `private` or `public`.

This is for setups where each node has all relevant IP addresses bound locally and the load balancer is only in charge or redirecting packet flows.

Other setups that involve a load balancer which changes NAT destination addresses would have each node list only its own addresses and not use alias names.

Cheers

Who AmI

unread,
Aug 26, 2024, 9:32:05 AM8/26/24
to rtpe...@googlegroups.com
Hi Both,

This is exactly what I was looking for so thank you for this.

I think I misunderstood the "multiple addresses per interface" in the docs when I read it so thanks for the clarification David.

Also, great news with the "interface alias name" syntax Richard, when was this introduced? Had a look at the recent tags for 11.5.1 new upto my version and couldn't see it in. I am using 11.5.1.18 compiled so I can easily bump up if its not included on my pinned version.

Many Thanks,

John.

--
You received this message because you are subscribed to the Google Groups "Sipwise rtpengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtpengine+...@googlegroups.com.

Richard Fuchs

unread,
Aug 26, 2024, 9:42:53 AM8/26/24
to rtpe...@googlegroups.com
On 26/08/2024 09.31, Who AmI wrote:
> Also, great news with the "interface alias name" syntax Richard, when
> was this introduced? Had a look at the recent tags for 11.5.1 new upto
> my version and couldn't see it in. I am using 11.5.1.18 compiled so I
> can easily bump up if its not included on my pinned version.

More recent than that, probably 12.3 or 12.4. You may want to look at
the new LTS 12.5.

Cheers

Who AmI

unread,
Aug 26, 2024, 9:46:55 AM8/26/24
to rtpe...@googlegroups.com
Thanks for the quick reply,
Will have a look at 12.5 now.

Many Thanks,

John.

--
You received this message because you are subscribed to the Google Groups "Sipwise rtpengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtpengine+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages