calricon.
VoIP & Telecom

The rtpengine Multi-Homed Routing Trap: Why Linux Reverse Path

Nov 5, 2026/8 min read/Verified Production Playbook

calricon / field note

In multi-homed VoIP architectures bridging public carriers and

Nov 5, 2026/VoIP & Telecom
317
Advertisement

The rtpengine Multi-Homed Routing Trap: Why Linux Reverse Path Filtering Mutes Media

In high-capacity Voice over IP (VoIP) topologies, Session Border Controllers (SBCs), and cloud telephony platforms, deploying rtpengine on multi-homed Linux hosts is standard practice. Telecommunications architects configure separate network interfaces to physically isolate public wholesale carrier traffic (e.g., eth0) from internal private PBX clusters, media processing workers, or Kubernetes overlay networks (e.g., eth1). During early integration tests using simple ping probes or low-volume symmetric calls, signaling and audio flow predictably. However, when the multi-homed infrastructure transitions to real-world carrier traffic with diverse upstream transit providers, a pervasive operational failure strikes: callers experience persistent one-way audio or complete silence immediately upon answering. SIP signaling logs indicate normal session establishment with valid 200 OK exchanges, but media packets from the external caller fail to reach the internal endpoint, or outbound audio to the carrier departs through the wrong gateway, triggering silent packet drops across upstream carrier firewalls.

The root cause is the interplay between asymmetric network paths, Linux kernel Reverse Path Filtering (RPF), and single-gateway routing tables. By default, standard Linux distributions enforce strict Reverse Path Filtering (net.ipv4.conf.all.rp_filter = 1). When an inbound RTP stream arrives on the secondary interface (eth1), the Linux kernel verifies whether a return packet to the sender's source IP would exit through that same incoming interface based on the operating system's main routing table. Because the host possesses only a single default gateway pointing out the primary interface (eth0), the kernel concludes the source IP is spoofed and silently discards the incoming RTP packets before they ever reach rtpengine userspace or the xt_RTPENGINE kernel module. Furthermore, outbound media generated by rtpengine on the secondary IP is routed via the primary default gateway, creating asymmetric routing that triggers upstream firewall drops. Without Linux policy-based routing tables and loose RPF tuning, multi-homed media proxies cannot maintain bidirectional voice streams.



Problem Diagnosis & Root Cause Architecture

To identify multi-homed routing failures before they degrade live customer conversations, infrastructure engineers must examine the packet traversal path through the Linux network stack and rtpengine interface bindings:




  • Strict Reverse Path Filtering (RFC 3704): Under strict RPF mode (rp_filter = 1), the kernel performs a reverse lookup in the routing table for every arriving packet. If the optimal return route does not match the arrival interface, the packet is silently dropped at the IP layer. In a multi-homed proxy where public carrier traffic arrives on an interface different from the default gateway, all inbound media is discarded without generating ICMP unreachable notifications.

  • Single Default Gateway Constraint: The standard Linux kernel routing architecture maintains a single active default gateway in the main routing table. When rtpengine transmits outbound RTP packets from its secondary IP address, the kernel uses the single default gateway on the primary interface. The resulting packets carry the secondary IP as the source address but exit through the primary interface MAC address, violating carrier egress filters and provoking Anti-Spoofing drops.

  • Kernel Space Desynchronization in xt_RTPENGINE: When the xt_RTPENGINE kernel module offloads media forwarding, it relies on netfilter hooks. If the kernel drops incoming packets due to RPF before they pass the PREROUTING hook, kernel-space session tables never observe incoming media, preventing the module from learning the remote media endpoint address and freezing stream forwarding.

  • Missing Source-Based Policy Routing (PBR): Without dedicated routing tables for each network interface, the operating system cannot select next-hop gateways based on source IP addresses. Standard route lookups consider only destination IP addresses, making deterministic interface return routing impossible in multi-provider environments.



The failure mode is particularly deceptive because standard diagnostic tools such as tcpdump capture incoming RTP packets on the network interface before the kernel's RPF verification drop. Engineers see media arriving on the wire, yet rtpengine-ctl list sessions displays zero received packets, misleading teams into troubleshooting nonexistent codec or application bugs.


Why Standard Implementations Fail

Typical infrastructure provisioning scripts and container networking configurations fail to account for multi-homed asymmetric VoIP media dynamics.



1. Default Operating System Sysctl Settings

Standard Linux server distributions (such as Ubuntu, Debian, Rocky Linux, and RHEL) ship with net.ipv4.conf.all.rp_filter = 1 or net.ipv4.conf.default.rp_filter = 1 enabled out of the box for security hardening. System administrators frequently assume that binding rtpengine to specific IP addresses bypasses kernel routing checks. However, RPF validation occurs at the IP layer prior to socket delivery, rendering application-level socket bindings completely ineffective.



2. Static Interface Routes Without Dedicated Gateway Tables

Administrators often attempt to resolve routing issues by adding static subnet routes (e.g., ip route add https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://10.0.0.0/8%26source%3Dgmail%26ust%3D1793804874183000%26sa%3DE&source=gmail&ust=1793805548458000&sa=E dev eth1). While static routes handle traffic destined for local subnets, wholesale SIP carriers deliver media from unpredictable public IP blocks across the global internet. Because these external source addresses do not match static local subnet rules, they fall back to the single default gateway, reigniting the RPF drop cycle.



3. Defining Multiple Default Gateways in Main Table

Another common mistake is adding two default gateways with equal or varying metrics within the primary routing table. Linux cannot perform session-aware gateway selection for stateless UDP media. Outbound RTP packets experience route flapping between gateways, creating jitter bursts, out-of-order delivery, and carrier firewall rejects.



Authenticated Step-by-Step Resolution Playbook

Follow this authenticated engineering playbook to implement source-based policy routing and configure loose Reverse Path Filtering for multi-homed rtpengine deployments.



Step 1: Configure Custom Linux Routing Tables

Create distinct routing tables for the external and internal network interfaces by updating /etc/iproute2/rt_tables:



# /etc/iproute2/rt_tables
# Append custom routing tables for multi-homed VoIP media
200 ext_traffic
201 int_traffic

Assigning dedicated table IDs ensures that routing decisions for each interface operate in complete isolation from the main kernel routing table.

""",

"""

Step 2: Implement Source-Based Policy Routing Rules

Configure routing rules and default gateways for each interface so that traffic originating from an interface always exits via that interface's specific gateway:



# Define network parameters
EXT_IF="eth0"
EXT_IP="198.51.100.10"
EXT_GW="198.51.100.1"

INT_IF="eth1"
INT_IP="10.10.0.10"
INT_GW="10.10.0.1"

# Populate the external routing table
ip route add https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://198.51.100.0/24%26source%3Dgmail%26ust%3D1793804874184000%26sa%3DE&source=gmail&ust=1793805548458000&sa=E dev $EXT_IF src $EXT_IP table ext_traffic
ip route add default via $EXT_GW dev $EXT_IF table ext_traffic

# Populate the internal routing table
ip route add https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://10.10.0.0/24%26source%3Dgmail%26ust%3D1793804874184000%26sa%3DE&source=gmail&ust=1793805548458000&sa=E dev $INT_IF src $INT_IP table int_traffic
ip route add default via $INT_GW dev $INT_IF table int_traffic

# Add policy routing rules based on source IP address
ip rule add from $EXT_IP table ext_traffic priority 100
ip rule add from $INT_IP table int_traffic priority 101

# Flush the routing cache to enforce changes immediately
ip route flush cache

With these rules active, any packet transmitted by rtpengine using source IP 10.10.0.10 strictly utilizes table int_traffic and exits through eth1 via gateway 10.10.0.1, eliminating cross-interface egress violations.



Step 3: Configure Loose Reverse Path Filtering

Adjust kernel sysctl parameters to set Reverse Path Filtering to loose mode (rp_filter = 2). In loose mode, the kernel accepts the incoming packet as long as the source address is reachable via any interface on the system, preventing asymmetric media drops:



# Create persistent sysctl configuration: /etc/sysctl.d/99-voip-routing.conf
cat << 'EOF' > /etc/sysctl.d/99-voip-routing.conf
# Enable loose Reverse Path Filtering across all interfaces
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.eth0.rp_filter = 2
net.ipv4.conf.eth1.rp_filter = 2

# Increase socket receive and send buffer memory for high-volume RTP
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
EOF

# Apply the sysctl parameters immediately
sysctl -p /etc/sysctl.d/99-voip-routing.conf

Note: Both conf.all.rp_filter and conf.<interface>.rp_filter must be set to 2. Linux uses the maximum value of all and the specific interface; leaving all.rp_filter = 1 will enforce strict mode regardless of individual interface settings.



Step 4: Configure rtpengine Multi-Interface Bindings

Update /etc/rtpengine/rtpengine.conf to declare logical interface names and map external public IP addresses cleanly:



# /etc/rtpengine/rtpengine.conf
[rtpengine]
table = 0
no-fallback = false

# Define multi-homed interfaces with internal and external logical tags
# Syntax: logical_name/local_bind_ip!advertised_public_ip
interface = external/https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://198.51.100.10%26source%3Dgmail%26ust%3D1793804874184000%26sa%3DE!203.0.113.10&source=gmail&ust=1793805548458000&sa=E; internal/https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://10.10.0.10%26source%3Dgmail%26ust%3D1793804874184000%26sa%3DE&source=gmail&ust=1793805548458000&sa=E

# Media port allocation range
port-min = 20000
port-max = 40000

# Control socket for Kamailio signaling communication
listen-ng = https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://127.0.0.1:22222%26source%3Dgmail%26ust%3D1793804874184000%26sa%3DE&source=gmail&ust=1793805548458000&sa=E
listen-cli = https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://127.0.0.1:9900%26source%3Dgmail%26ust%3D1793804874184000%26sa%3DE&source=gmail&ust=1793805548458000&sa=E

# Enable kernel-space packet forwarding
kernel-support = true

Restart the rtpengine daemon to apply the multi-interface configuration:



systemctl restart rtpengine


Step 5: Verify Policy Routing and Packet Flow in Production

Validate that policy routing rules and kernel packet counters are functioning correctly during active calls:



# Verify policy routing rules
ip rule show

# Inspect routing entries within custom tables
ip route show table ext_traffic
ip route show table int_traffic

# Test route lookup resolution from each source IP
ip route get 8.8.8.8 from 198.51.100.10
ip route get 10.200.0.50 from 10.10.0.10

# Check kernel counters for Reverse Path Filtering drops (should remain 0)
nstat -az TcpExtIPReversePathFilter

# Monitor active media streams and packet counters across interfaces
rtpengine-ctl list sessions | grep -E "SSRC|packets|bytes" | sed 20q

Confirm via nstat that TcpExtIPReversePathFilter does not increment during call arrival. The ip route get commands should confirm that traffic from each source IP resolves exclusively through its designated interface gateway.

Multi-homed media proxies demand precise harmony between Linux kernel networking parameters and VoIP application bindings. By implementing source-based policy routing tables and switching to loose Reverse Path Filtering, telecommunications engineers eliminate silent packet discard traps, ensuring bidirectional audio clarity across complex multi-carrier networks.

Advertisement
Engineering Advisory 48-Hour Audit Turnaround

Experiencing this issue in your production systems?

Calricon conducts senior-level VoIP, SIP trunking, Asterisk, and cloud infrastructure audits. We review your live configs, identify packet drops or contention bottlenecks, and provide exact remediation runbooks.