Skip to Content
Xeonr Developer Docs

UDP tunnels

DNS, syslog, a game server — and what a tunnel can and cannot do to a datagram.

burrow udp 53 --allow cidr:203.0.113.0/24
  Forwarding   udp://udp.brw.xnr.app:20431  ->  127.0.0.1:53

A UDP tunnel draws a port from the same pool as a TCP one, leased on the same 72-hour terms — reconnect and you get the same port back. A pooled port is TCP or UDP, never both, and the hostname differs: udp.brw.xnr.app, not tcp.brw.xnr.app.

A bare port means 127.0.0.1, not localhost, and so does localhost:53. localhost is ::1 first on many machines, and a UDP send has no handshake to fail, so a service listening on IPv4 loopback alone would never see a datagram. If yours listens only on IPv6, say so: burrow udp [::1]:53.

Read this before you use one

Your datagrams arrive as datagrams: boundaries are preserved end to end, and a zero-length datagram stays zero-length. But the hop between the gateway and your machine is a single reliable, ordered connection, and that changes the character of the traffic in two ways you cannot turn off:

  • Nothing is lost and nothing is reordered. A protocol that expects to see loss will never see any through the tunnel.
  • Flows share a connection. One flow waiting on a slow reply holds up the others on the same tunnel.

So a UDP tunnel is the right tool for exercising a service — a resolver you are developing, a syslog collector, a game server you want a friend to join — and the wrong tool for measuring a network, benchmarking throughput, or anything whose results depend on real packet loss. If you need the latter, you need a real path to the machine, not a tunnel.

It is closed unless you say otherwise

Exactly as with TCP: a datagram carries nobody to ask for a login, so an HTTP tunnel's rules cannot apply. Burrow refuses to start a UDP tunnel that says nothing about who may reach it:

$ burrow udp 53
burrow: a UDP tunnel needs to say who may reach it: add --allow team (reached with
        `burrow connect --udp`), --allow cidr:<range>, or --public to open it to anybody

--public exists, needs saying out loud, and is recorded in the activity feed. On the pool port only the IP-shaped rules — cidr: and --public — can apply; team, user: and group: need somebody to sign in, which is what burrow connect --udp is for.

Flows, not connections

UDP has no connections, so Burrow groups datagrams into flows: everything arriving from one source address, for as long as it keeps arriving. A flow with no traffic in either direction for a minute is closed, and the next datagram from that source starts a new one.

That is also how a flow appears in your history — one record per flow, with bytes each way and how long it lasted, alongside your TCP connections in burrow connections. A flow through burrow connect --udp also records who signed in. Payload is never captured, as with TCP.

Two limits are worth knowing if your service is busy:

  • A flow whose datagrams are arriving faster than your local service drains them drops the excess rather than queueing without bound. The same thing a congested network would do.
  • A tunnel has a cap on how many flows it will hold at once, so a flood of spoofed source addresses cannot open an unbounded number of streams to your machine. Established flows keep working.

The better option: no public port

As for TCP, burrow connect carries the traffic over an authenticated connection instead, so a tunnel whose rules name nobody by address answers nobody on its pool port:

# the owner, exposing it to nobody in particular
burrow udp 53 --name dnsdev --allow team

# anybody on the team, on their own machine
burrow connect dnsdev --udp --local 127.0.0.1:5353
dig @127.0.0.1 -p 5353 example.internal

The consumer authenticates as themselves, and the tunnel's full rule set — team, user:, group: — is applied to them before any datagram is carried. --udp binds a UDP socket rather than a TCP listener, and --local is required with it: there is no sensible default port for "some UDP service".

The flows are kept on the consumer's machine, the same way the gateway keeps them for a pool port: each local source address is one flow, carried over its own connection to the gateway and closed after a minute with no datagram either way. A source the tunnel refuses is told once on stderr and retried a few seconds later, rather than redialled for every datagram it sends.

burrow connect without --udp to a UDP tunnel, or with it to a TCP one, is refused with the flag that fixes it.

On this page