Most proxy traffic is TCP. Calls, games, WebRTC, QUIC and DNS use UDP. If you run a mobile proxy farm and your customers need any of those, the proxy has to carry UDP too, and it has to do it from outside your network.
XProxy 21.3 closes the main gap here: SOCKS5 UDP now works when your box sits behind a router. This post explains why that was hard, what changed in November, and how to switch it on and test it.
Why UDP matters for a mobile proxy
A SOCKS5 client asks for UDP with a request called UDP ASSOCIATE. The XProxy SOCKS5 port answers it, and the datagrams leave through the same modem and the same mobile IP as the TCP traffic.
- Games and voice or video calls send UDP.
- WebRTC uses UDP, and the test script below uses a STUN server, the kind WebRTC relies on, to see which IP your UDP leaves from.
- QUIC and HTTP/3 run over UDP port 443. A path that carries only TCP cannot use them.
- DNS often travels over UDP, so UDP also matters for leak checks.
Apps that speak SOCKS5 UDP include Proxifier, v2rayN, sing-box and Clash (when their UDP option is on), plus your own scripts. Chrome, Edge and most antidetect browsers send TCP only through a proxy, so browsing does not depend on this.
Why UDP breaks behind a router
UDP does not travel inside the SOCKS5 connection. In its answer to UDP ASSOCIATE, the proxy names a relay address: an IP and a new UDP port for that session. The client sends its datagrams there.
Strict clients, such as most apps, sing-box and many SDKs, send exactly to the IP the proxy names. Lenient clients keep the proxy's host name and only take the port. In your LAN both work.
A box behind a router names its LAN address by default, for example 192.168.1.10. A client on the internet cannot reach that address, so strict clients get no UDP.
What changed in November
SOCKS5 UDP behind a router (21.3.16)
The box can now name its public address in the UDP ASSOCIATE reply, so strict clients send to a place they can reach. You can set it automatically or with a fixed IP in Proxy Settings.
Clients in your LAN still get the box's LAN address. Only clients that reach the box from the internet get the public one.
This setting needs the Basic plan or higher.
Router rules in one tab (21.3.49)
Forwarding Ports now has three tabs: Through a VPS, Through your router, and Ports in use. Through your router lists every NAT rule to create on your router, TCP and UDP, including the UDP block for SOCKS5 UDP, with a Copy rules button. You choose how many UDP ports to forward, from 50 to 5000.
SOCKS5 UDP with Force Server Resolve DNS (21.3.17)
Force Server Resolve DNS makes the proxy resolve names itself. Before 21.3.17, turning it on could stop SOCKS5 UDP from working. Now both work together.
SOCKS5 UDP through VPS Forwarding on more modem models (21.3.3)
UDP through VPS Forwarding now works on more modem models.
Direct Mode for VPS Forwarding (21.3.16)
If your box has no public IP at all, VPS Forwarding is the route. In the WireGuard engine, Direct Mode lets the box see each customer's own IP, and SOCKS5 UDP works through the VPS.
The guide lists the differences between the two engines:
| Engine | Ports with UDP | UDP ports to allow on the VPS |
|---|---|---|
| WireGuard + Direct Mode (recommended) | Every SOCKS5 port the VPS forwards | One block of 400 ports in 61000-64999 per box |
| Relay + UDP Socks5 | The main proxy port of each modem | 32768-60999 |
XProxy opens these ports in the VPS's own firewall (ufw or firewalld). If your VPS provider has its own firewall, allow them there too. VPS Forwarding needs the Premium plan.
HTTP/3 and the website blacklist (21.3.22)
A SOCKS5 UDP datagram carries only an address, so a blacklist of website names could not match HTTP/3 sent by VPN-style (TUN) clients such as v2rayN TUN, sing-box and Clash. The website blacklist can now block HTTP/3, and the option also applies to traffic through VPS Forwarding.
Browsers then fall back to HTTPS over TCP, where the name rules apply. Other UDP, such as STUN, games and DNS, keeps working.
Browser proxy settings never send QUIC through a proxy, so this mainly concerns TUN clients.
How to set it up
- Update the XProxy box to 21.3.49 or later. SOCKS5 UDP behind a router arrived in 21.3.16; 21.3.49 adds the router rules tab used below.
- In the panel, open Proxy Management, then Proxy Settings, then General. In the card SOCKS5 UDP behind a router, choose Router public IP (auto) and click Save. With a fixed public IP from your provider, choose Fixed IP and type it.
- Open Forwarding Ports, tab Through your router. It lists every rule to create on your router: your TCP proxy ports and one UDP rule for the SOCKS5 UDP block, all to the box's LAN address. Click Copy rules and add them on the router.
- The UDP block is 1000 ports by default. You can set 50 to 5000 in the same tab; more ports serve more clients at once.
Clients that reach the box through VPS Forwarding need none of these router rules.
It applies at once, without restarting the proxies. Auto asks public STUN servers for your router's IP every 10 seconds, so a new IP from your provider is picked up by itself.
The card tells you when auto cannot work:
- CGNAT: your provider shares one IP between many customers, so ports cannot be forwarded. Use VPS Forwarding.
- More than one internet line: a load-balancing router shows a different IP to each server, so no address is given.
How to test it
The guide has a Python script that asks for UDP like a strict client. It checks that a STUN server, Google's DNS servers and a web server all see the modem's mobile IP, and never your own. Run it from another network, such as a VPS or a phone hotspot, with your proxy's address, port and login.
A second script loads a page over HTTP/3 through the proxy's UDP relay. When it prints http=http/3, QUIC went through.
Copy both scripts from the SOCKS5 UDP guide. For what browsers do with QUIC, read QUIC and HTTP/3 through a proxy.
FAQ
Which port do I use for SOCKS5 UDP?
The SOCKS5 port of the modem, with the same login as for TCP. With Auto Proxy on, HTTP and SOCKS5 share one port, and modem #1 is 4001. With Auto Proxy off, SOCKS5 is on its own port, 5001.
Why does my browser not use HTTP/3 through the proxy?
The browser decides that, not the proxy. In a lab test with Chrome 148, a SOCKS5 proxy gave HTTP/2 even though it answered UDP ASSOCIATE. To keep QUIC, use WireGuard or a Shadowsocks app in VPN mode.
Does UDP count toward a port's data quota?
Yes. On Selling Platform ports, UDP datagrams are counted and stop with the TCP traffic when the quota is used up.
Do I need to do anything in my LAN?
No. In your LAN, SOCKS5 UDP works on every plan with nothing to switch on.
My script only gets an answer to the first datagram.
The proxy accepts datagrams from the client port that sent the first one. Send every datagram of a session from the same UDP socket.
Get started
Already running XProxy? Update your box, open Proxy Settings and try the new card. The full list of November changes is on the changelog.
Building a new farm? Browse XProxy software and hardware and pick the plan that fits.
