Host Candidate
No server neededA host candidate is an IP address and port directly on the device's local network interface. Gathered without contacting any external server. Host candidates work for P2P on the same LAN or network segment. They fail across NAT – the address is private and unreachable from the internet. The browser gathers one host candidate per local network interface (Wi-Fi, Ethernet, VPN).
How it works
Host candidates are the first type gathered by ICE. They represent the device's actual IP addresses on its local interfaces.
Gathering: the ICE agent enumerates all network interfaces and creates a host candidate for each IP address found. On a machine with both Wi-Fi (192.168.1.5) and Ethernet (10.0.0.2), two host candidates are created.
IPv6 host candidates: modern browsers also gather IPv6 host candidates. link-local (fe80::) addresses are excluded as they are not routable.
Privacy: in 2015, a privacy concern was identified – host candidates expose the device's local IP to the web application (even before getUserMedia). Browsers now implement IP handling policies that can suppress or hash local IPs. The setting is controlled by RTCConfiguration.iceTransportPolicy and browser privacy settings.
When host candidates work: - Both peers on the same LAN or corporate network - VPN where both clients share a virtual network - Loopback (localhost) connections for testing
When they fail: - Peers behind different NATs (home networks) - Mobile networks (carrier-grade NAT) - Any scenario where the private IP is unreachable from the internet
SDP Example
# Host candidate in SDP (RFC 8839 §5.1) a=candidate:1 1 UDP 2130706431 192.168.1.5 54321 typ host generation 0 # ^ foundation # ^ component (1=RTP, 2=RTCP) # ^ transport (UDP) # ^ priority # ^ connection address (private IP) # ^ port # ^ type: host
Pros
- +No external server required – works without STUN or TURN
- +Lowest latency when successful – direct LAN connection
- +Highest ICE priority – tried first before srflx and relay
Cons
- !Fails across NAT – private IPs not reachable from the internet
- !Exposes local network IP to the remote peer (privacy concern)
- !Multiple host candidates per device (one per network interface) increases SDP size
Priority
Highest (126 × 2^24 + 65535 × 2^8 + (256-component))