SonicWall UDP Connection Timeout – What It Really Means

sonicwalludp

Since UDP is a connectionless protocol, I'm confused by the setting on my Sonicwall Firewall for "UDP Connection Timeout". It's set at a default of 30 seconds — but what exactly times out after 30 seconds?

WTF?

Here's my actual real-world situation:
I have an NTP server in the ntp.org pool that serves about 3000 queries per minute. This puts a bit of a strain on my SOHO grade TZ-200 — not in terms of bandwidth; but in terms of # of connections it has passing through it. I'm wondering if the UDP connections somehow are 'kept alive' on the SonicWall; even though they're (by definition) connectionless.

What am I missing here? What does SonicWall mean when it talks about a "UDP Connection Timeout"?

Best Answer

While there is no formal "connection" with UDP there is still a convention that clients send requests and expect to get responses back with the source IP and port swapped with the Destinatoin IP and port.

Stateful firewalls and NATs therefore assume that packets with a given combination of source IP/source port/Destination IP/Destination port and the corresponding combination with source and destination swapped form part of a "connection". This allows rules like "outgoing connections only" to be applied to UDP and allows reverse translations to be applied to response packets.

Unfortunately the firewall or NAT has no way of knowing when the client has finished talking to the server. So it has to wait for a timeout before removing the entry from it's state tracking tables. That is the timeout you are setting.

In principle it would be possible to build a NAT box that used a stateless approach for port forwards while maintaining a stateful approach for outgoing connections but it's simpler to just use stateful NAT for everything and it sounds like this is what your vendor is doing.

Unfortunately as you have discovered this sucks for stateless UDP servers serving large numbers of small requests. You end up in a situation where the firewall consumes far more resources than the sever itself.