feat: optionally bind SIP signaling to a named interface (LIVEKIT_NODE_IP_IFACE)#744
Open
rililinx wants to merge 1 commit into
Open
feat: optionally bind SIP signaling to a named interface (LIVEKIT_NODE_IP_IFACE)#744rililinx wants to merge 1 commit into
rililinx wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #744 +/- ##
==========================================
+ Coverage 65.25% 66.13% +0.87%
==========================================
Files 51 41 -10
Lines 6588 7863 +1275
==========================================
+ Hits 4299 5200 +901
- Misses 1915 2190 +275
- Partials 374 473 +99 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
If LIVEKIT_NODE_IP_IFACE is set, resolve the first IPv4 address of that network interface and use it as conf.ListenIP for SIP signalling binding. This mirrors the LiveKit media server behaviour and is useful in ECS/Fargate/Kubernetes, where the container IP lives on a known interface (e.g. eth0) and must be bound explicitly rather than falling back to the 0.0.0.0 wildcard. The override is skipped when the env var is empty, or when listen_ip is already set to a specific (non-wildcard) address in config. Co-Authored-By: Claude <noreply@anthropic.com>
rililinx
force-pushed
the
feat/listen-ip-from-iface
branch
from
July 15, 2026 14:30
30172c8 to
7a04a75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional
LIVEKIT_NODE_IP_IFACEenvironment variable. When set, the first IPv4 address of the named network interface (e.g.eth0) is resolved at startup and used as the SIP signaling bind address (listen_ip).It is a no-op when:
listen_ipis already set to a specific (non-wildcard) address in config — an explicit operator choice always wins.Why
This is about the bind address only, and is complementary to — not a replacement for — the existing advertised-IP options (
local_net,use_external_ip,nat_1_to_1_ip).On a multi-homed host (e.g. EC2 with multiple ENIs, bare metal, or K8s pods with several interfaces), binding SIP to
0.0.0.0lets the kernel choose the source IP of outbound responses based on the routing table. That source IP can differ from the interface the request arrived on and from the IP advertised inContact/Via/SDP. Many SIP peers and NATs drop responses whose source IP doesn't match where they sent the request, so signaling breaks.Binding to the same interface you advertise keeps the response source IP consistent.
listen_ipalready lets you pin a static address, but in dynamically-scheduled environments (ECS/EC2/K8s) the address isn't known when the config is authored, whereas the interface name (eth0) is stable. Resolving by interface name at startup makes this ergonomic and mirrors the interface/NODE_IPresolution already used by the LiveKit media server, giving operators one consistent deployment pattern across LiveKit components.What this does not do
SignalingIP/MediaIP. Those remain governed bylocal_net/use_external_ip/nat_1_to_1_ip.awsvpcdeployments, where a0.0.0.0bind pluslocal_netfor the advertised IP is sufficient.How
applyNodeIPIfaceruns right after config load inrunService, resolving the interface intoconf.ListenIPbefore the server starts.ipv4FromIface/firstIPv4do the lookup and pick the first IPv4 on the interface.Tests
Unit tests in
cmd/livekit-sip/main_test.gocover the address-selection logic and the skip/override/error paths.Notes
The env-var name mirrors the LiveKit media server for cross-component consistency. Happy to rename, or to expose this as a
listen_ifaceconfig field instead of an env var, if maintainers prefer.