I’m testing our self-hosted LiveKit server using t...
# ask-ai
m
I’m testing our self-hosted LiveKit server using the LiveKit testing tool and ran into some connection issues. Here’s the log I observed:
Connecting to signal connection via WebSocket
Connected to server, version 1.9.1.
Establishing WebRTC connection
tcp 10.244.0.81:7801 host (private)
udp 10.244.0.81:59873 host (private)
udp 10.224.0.4:11053 srflx (private)
tcp 10.244.0.81:7801 host (private)
udp 10.244.0.81:57347 host (private)
udp 10.224.0.4:50835 srflx (private)
Warning: Server is not configured for ICE/TCP
Warning: No public IPv4 UDP candidates were found. Your server is likely not configured correctly
Can connect via TURN
Warning: TURN is configured server side, but TURN/TLS is unavailable.
Can publish audio
Error: unable to detect audio from microphone
Can publish video
received video frames
published 249 video packets
Resuming connection after interruption
Fail
Could you please guide me on how to debug and properly configure the server to resolve these issues?
t
Thanks for reaching out, Rajadurai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm here to help you get your self-hosted LiveKit server connection issues sorted out! Let's walk through some steps together: 1. Enable ICE/TCP: Try setting up
rtc.tcp_port
(like 7881) in your server settings and make sure that port is open in your firewall. This helps your connection fall back to TCP if UDP isn’t available. 2. Ensure Public IPv4 UDP Candidates: It’s important to enable
use_external_ip: true
in the
rtc
configuration so your server can advertise its public IPs. Also, set a valid UDP port range (for example, 50000-60000) and double-check that these ports are open. 3. Configure TURN/TLS: Turn on TURN by setting
turn.enabled: true
and specify
turn.tls_port
(like 5349). Don’t forget to provide valid SSL certificates to keep things secure. 4. Firewall Configuration: Make sure to open all the necessary ports, including 7880 (API/WebSocket), 7881 (ICE/TCP), 50000-60000 (UDP), and 5349 (TURN/TLS). 5. Debugging: Use the LiveKit Connection Tester to help diagnose any connectivity hiccups. Keep an eye out for warnings related to ICE/TCP, public IPv4 UDP candidates, and TURN/TLS in your logs. Following these steps should really help clear up those warnings and boost your connection. If you run into any questions or want help with a specific part of the setup, just let me know—I’m here for you! Sources: Diagnosing Connection Errors with Connection Test Utility | Deploying LiveKit | LiveKit Docs | pkg/rtc/transport.go | Ports and firewall | LiveKit Docs | Running LiveKit on AWS
m
# access_token must be at least 32 chars long keys: access_token: secretsecretsecretsecretsecretsecret log_level: info port: 7880 redis: address: redis.default.svc:6379 rtc: port_range_end: 60000 port_range_start: 50000 tcp_port: 7801 stun_servers: - my_stunner_ip:3478 turn_servers: - credential: pass-1 host: my_stunner_ip port: 3478 protocol: udp username: user-1 use_external_ip: false turn: enabled: false loadBalancerAnnotations: {} This is my livekit-config.
t
Thank you for sharing your configuration! To help resolve the connection issues you're experiencing, here are a few friendly suggestions to guide you through the adjustments: 1. Enable TURN: It would be great to update your configuration to enable TURN, which can really improve connectivity. Here's an example you can follow:
Copy code
turn:
  enabled: true
  tls_port: 5349
  domain: turn.myhost.com
  cert_file: /path/to/turn.crt
  key_file: /path/to/turn.key
Just a quick reminder to make sure the TURN domain has a valid SSL certificate and that the port (5349 or 443) is open on your firewall. 1. Use External IP: To help your server advertise its public IP, you can set
use_external_ip: true
in the
rtc
section. Here's how it might look:
Copy code
rtc:
  use_external_ip: true
  port_range_start: 50000
  port_range_end: 60000
  tcp_port: 7881
Also, please ensure that the UDP port range (50000-60000) and the TCP port (7881) are open to allow smooth communication. 1. Firewall Configuration: Opening these ports will really help: • 7880 (TCP): Main server signaling • 7881 (TCP): ICE-over-TCP fallback • 50000-60000 (UDP): WebRTC media traffic • 5349 or 443 (TCP): TURN/TLS Making these changes should help clear up the warnings and improve your connection. If you’d like, I’m here to assist with any specific details or questions you might have along the way! Sources: Deploying LiveKit | LiveKit Docs | pkg/service/turn.go | examples/server-gke-vpc-native.yaml
m
when I enable use_external_ip: true my server return could not validate external IP {"ip": "10.224.0.5", "error": "context deadline exceeded"} 2025-09-27T134256.892Z INFO livekit rtcconfig/webrtc_config.go:284 failed to get external ip {"local": "10.244.1.123", "err": "context deadline exceeded"} 2025-09-27T134256.892Z INFO livekit rtcconfig/webrtc_config.go:99 no external IPs found, using node IP for NAT1To1Ips {"ip": "10.224.0.5"} waht is this
t
It looks like you’re encountering the error "could not validate external IP" with "context deadline exceeded" during STUN-based discovery. Don’t worry, I’m here to help you work through it! Here are some friendly steps to get this sorted out: 1. Ensure STUN Servers Are Reachable: First, let’s make sure your server can connect to default STUN servers like
stun.l.google.com:19302
on UDP port 3478. You can use tools such as
nc
or
stunclient
to check this connectivity. 2. Open Required Ports: Next, please verify that your firewall allows inbound UDP traffic on the necessary port range (for example, 50000–60000) or the specific
udp_port
if you have it configured. This helps the communication flow smoothly. 3. Allow Bidirectional UDP Traffic: It’s important to confirm that UDP packets sent to your external IP and port can come back to your server’s local UDP socket. This usually means your NAT setup and firewalls aren’t blocking these returning packets. 4. Use Custom STUN Servers (Optional): If needed, you can specify custom STUN servers in your configuration under
rtc.stun_servers
. This gives you a bit more control over the discovery process. 5. Verify Networking Setup: If you’re on a cloud platform, double-check that your instance’s public IP is properly assigned and that NAT gateways or load balancers aren’t interfering with UDP traffic. Sometimes these can cause unexpected hiccups. 6. Alternative Configuration: If STUN discovery keeps giving you trouble, you might want to explicitly set
node_ip
in your configuration or disable
use_external_ip
if your server can be accessed directly via its local IP. This can be a helpful workaround. I hope these steps help you get things back on track! If you have any questions or need more guidance, please don’t hesitate to reach out. I’m here to support you every step of the way. Sources: CHANGELOG.md | pkg/rtcconfig/config.go | Deploying LiveKit | LiveKit Docs