A website shows my proxy IP. Why can WebRTC still see my broadband address?

June 3, 2025

Suppose you configure a browser proxy and open a public-IP lookup site. It shows the proxy server’s address. In the same browser, a WebRTC test page also shows an address belonging to your home broadband provider. Both measurements can be correct. The first site sees who fetched the web page, while the second also asks the browser to try establishing another connection.1

Where does the browser connect after the page loads?

Take a browser video call. First the browser fetches the call page over HTTPS. Then WebRTC (Web Real-Time Communication) looks for paths that can carry audio and video between the endpoints. This is the ICE process. The browser can ask a STUN server a specific question: “What source address and port did my packet have when it reached you?” That address may become one of the candidates ICE presents to the page. If a relay is needed, a TURN server can supply its own relay address. Gathering a candidate establishes only that the browser discovered a possible path. The path the call ultimately uses still depends on connectivity checks.2

If only web requests use the proxy, and browser policy and the network permit STUN probes directly over broadband, the website sees the proxy’s egress and the STUN server sees the broadband public address. Candidates are gathered before the call path is selected, so a single test can display both addresses. RFC 8828 states the condition precisely: “but direct access to the Internet is permitted”. Restrict direct connections and force the browser to use the proxy, and the outcome changes.1

flowchart LR
    B["浏览器"] -->|网页请求| P["代理服务器"]
    P --> W["网页服务器看到代理 IP"]
    B -->|STUN 探测经宽带直连时| S["STUN 服务器看到宽带公网 IP"]
What the test showsWhat question it answers
An IP lookup page returns the proxy’s public addressFrom which address did this particular web request reach the site?
WebRTC lists a private address assigned by the home router, such as 192.168.1.20What local interface information did the browser expose to the page? This address alone doesn’t identify the public broadband egress.
STUN returns a public address owned by the broadband providerAt least this probe reached STUN through that egress. To understand the actual call, inspect the candidate pair eventually selected.

If I set a SOCKS5 proxy on Ubuntu, will WebRTC’s UDP probes use it?

Entering a SOCKS5 address in Firefox or Chrome on Ubuntu Desktop does not by itself send WebRTC’s UDP probes through that proxy. To make the STUN server see the proxy egress, you can have proxy software on Ubuntu receive and forward the packet.34

What does the SOCKS5 address in the browser control?

Suppose a local proxy already listens on 127.0.0.1:1080. In Firefox’s proxy or network settings, choose manual proxy configuration. Enter 127.0.0.1 for SOCKS Host, 1080 for Port, select SOCKS v5, and save. If the proxy reports a different listening port, use that. Firefox can now ask the proxy to fetch web pages.5

“Proxy DNS when using SOCKS v5” in the same window only decides who looks up domain names. The SOCKS5 protocol does allow an application to request a UDP relay address (UDP ASSOCIATE) and send packets to it. But the built-in SOCKS5 proxies in Firefox and Chrome don’t implement that UDP path. There’s no extra checkbox that makes STUN go through SOCKS5. Redirecting ordinary UDP packets straight to 1080 would also skip the negotiation and encapsulation the protocol requires.634

How can I send WebRTC UDP packets through a proxy on Ubuntu?

For example, consider the Linux desktop version of Clash Verge Rev. TUN is a virtual network interface created by the proxy software. Once it’s enabled, the browser still sends packets addressed to the STUN server. Ubuntu routes them to the virtual interface, and Clash Verge Rev forwards them through the selected node. First confirm that the remote node supports UDP forwarding.78

  1. In Clash Verge Rev’s subscriptions section, import and enable a subscription or local configuration containing that node. If all you have is a remote SOCKS5 server, save the example below as webrtc.yaml, replace its address and port, and import it as a local configuration. If login is required, add username and password at the same level as port.9
  2. Open Proxies. For verification, choose Global mode and select the UDP-capable node in the GLOBAL group. Choosing DIRECT makes the software send packets directly from the local machine. Global mode will also affect other applications whose traffic is routed through it during the test.
  3. Enable virtual network interface mode (TUN). If the client asks to install its service, authorize that and then enable the mode. For the test you can disable the client’s system proxy and temporarily select “No proxy” in Firefox. This isolates the effect of TUN.8

If you only have the remote SOCKS5 address, the following example can be imported. Set server to the remote server. udp: true allows the client to forward UDP through that node. The server must support it too.9

proxies:
  - name: 我的UDP节点
    type: socks5
    server: 192.0.2.10  # 示例地址,换成你的远端服务器
    port: 1080
    udp: true
tun:
  enable: true
  auto-route: true             # 让 Ubuntu 把流量路由到虚拟网卡
  auto-detect-interface: true  # 自动选择连接远端节点的实际网卡
rules:
  - MATCH,我的UDP节点

How can I tell where that UDP packet exited?

Open the WebRTC Trickle ICE test, keep the same STUN server, and set IceTransports to all. Click Gather candidates once before enabling TUN and once afterwards. In the result table, find a row with Type srflx and Protocol udp and read its Address. This is the UDP egress the STUN server observed. If it changes from the broadband public IP to the expected node egress IP, this probe used the node. If the broadband address still appears, look under Connections in the client to see whether the UDP connection selected the node or DIRECT. Note whether it used IPv4 or IPv6. If there’s no such row, this test didn’t measure a comparable UDP egress.102

What changes with a VPN or a kill switch?

A VPN can add a virtual network interface to the system, such as Wintun on Windows. If traffic to STUN passes through the VPN gateway and exits there, STUN usually sees the gateway’s public address. If a company VPN takes over only internal office traffic, a public STUN server may still be reached over broadband. A kill switch controls what happens when the VPN unexpectedly disconnects. For example, OpenVPN’s description of mobile Connect 3.3 says that with full tunneling and the kill switch enabled, the system blocks direct outgoing traffic until the VPN returns.11112

Why might the same test site show different addresses on a computer and a phone?

An OpenClash report illustrates this well. Using Chrome on the same test site, the reporter saw the node’s IPv4 and IPv6 addresses on a computer, but the Android device showed its own public IPv6 address. They also noted that IPv6 could go through the proxy when Android visited ordinary websites. This is why checking egress requires stating which device, which kind of connection, and which address family. Saying only “the proxy works for IPv6” doesn’t locate where the paths diverge.13

The report leaves a question open: what type of candidate was the public IPv6 address shown on Android? A device’s own network interface can have a public IPv6 address. Start by reading the candidate type: host comes from a local interface, srflx is the mapped address learned from a probe, and relay is a relay address. A public IPv6 address alone doesn’t tell you which probe followed which path.213

Footnotes

  1. Uberti, J., & Shieh, G. (2021-01). WebRTC IP address handling requirements (RFC 8828). IETF. 引文见第 3 节第 3 项,不同代理与路由策略见第 5.2 节。 ↩ ↩2 ↩3

  2. Keränen, A., Holmberg, C., & Rosenberg, J. (2018-07). Interactive Connectivity Establishment (ICE): A protocol for Network Address Translator (NAT) traversal (RFC 8445). IETF. 第 2 节,候选地址的收集与连通性检查。 ↩ ↩2 ↩3

  3. Gosu, V. (2024). QUIC (HTTP/3) connection does not work when using SOCKS5 proxy, comment 3. Mozilla Bugzilla. Firefox 网络组件开发者对 SOCKS 层的说明。 ↩ ↩2

  4. The Chromium Authors. (n.d.). Proxy support in Chrome, “SOCKSv5 proxy scheme”. Chromium. Chrome 134 的 SOCKSv5 支持范围。 ↩ ↩2

  5. Mozilla Support. (n.d.). Connection settings in Firefox. 手动配置代理。 ↩

  6. Leech, M., Ganis, M., Lee, Y., Kuris, R., Koblas, D., & Jones, L. (1996-03). SOCKS protocol version 5 (RFC 1928). IETF. 第 6 节,中继地址与端口;第 7 节,UDP 包的格式。 ↩

  7. Krasnyansky, M., & Thiel, F. (2002 修订). Universal TUN/TAP device driver. Linux Kernel Documentation. 第 1 节,虚拟网卡与用户空间程序如何收发数据包。 ↩

  8. Clash Verge Rev. (n.d.). 《快速入门》. Clash Verge Rev Docs. 导入订阅、选择节点和开启 TUN 的界面示例。MetaCubeX. (n.d.). TUN. mihomo docs. 自动路由与出口网卡。 ↩ ↩2

  9. MetaCubeX. (n.d.). SOCKS. mihomo docs. SOCKS5 出站配置及 UDP 选项。 ↩ ↩2

  10. WebRTC Project. (n.d.). Trickle ICE. WebRTC samples. 收集候选地址及结果表。 ↩

  11. WireGuard. (n.d.). Wintun — Layer 3 TUN driver for Windows. 项目说明首段。 ↩

  12. OpenVPN. (2021-11-18). VPN kill switch for OpenVPN Connect now available. OpenVPN Blog. 移动端版本与断线时的行为。 ↩

  13. huoshan12345. (2025-02-21). 《[Bug] 安卓端会有webrtc泄露,而pc端没有, 请问一下是配置不当还是原理决定的?》 (OpenClash issue #4338),“Describe the Bug”。GitHub. 报告者的测试条件与结果。 ↩ ↩2

© 2025 borui. All rights reserved. This content may be freely reproduced, displayed, modified, or distributed with proper attribution to borui and a link to the article: borui (2025-06-03). A website shows my proxy IP. Why can WebRTC still see my broadband address?. https://caiborui.com/blog/2025-06-03-zh-webrtc-proxy-vpn-ip-entrans

@misc{borui2025-2486611f,
  author = {borui},
  title = {{A website shows my proxy IP. Why can WebRTC still see my broadband address?}},
  year = {2025},
  publisher = {borui's blog},
  url = {https://caiborui.com/blog/2025-06-03-zh-webrtc-proxy-vpn-ip-entrans}
}