Rate limiting (Technitium) DNS with pfSense (Community Edition)

Tags: #<Tag:0x00007f8a15914050> #<Tag:0x00007f8a160fbe80> #<Tag:0x00007f8a160fbd90> #<Tag:0x00007f8a160fbcc8>

Rate limit open DNS resolvers

If you self-host a DNS server you should take care of security. One of the protocols involved with DNS is UDP. Attackers may abuse publicly available open resolvers for DNS Amplification DDoS attacks [1]. Something that cost me some nights when I was doing hands-on incident response.

Why would you ever need to host anything with DNS?

We decided that it was time for a new TV, and naively decided to buy an internet-connected Samsung TV. At some point in time it showed embedded advertisements. Research yielded that this isn’t a unique phenomenon.[2] because Samsung thinks that they are entitled to spam you on your TV.

One way to block these nasty ads, that may also violate consumer and GDPR data subject-rights in the EU, is self-hosting a DNS server with filtering capabilities.

Technitium DNS

Technitium DNS[3] is a feature-rich DNS server, that allows to incorporate block-lists for such issues. Not only will this enhance our comfort while watching TV, it will also enhance privacy and security.

DNS over TLS and HTTP

The features include modern DNS protocols. Self-hosting servers, which are capable to provide these DNS protocols is useful.

But rate-limits for Technitium DNS are still on the road-map. Hosting this on a public IP therefore may not be ideal.

Using pfSense Limiters

In order to protect an open UDP DNS resolver without rate-limiting features you can use a modern firewall.[4]

You can apply a traffic rate-limit to UDP port 53.

What these In / Out pipes do is adding schedulers and queues to the traffic flows.

You allow a default bandwidth, which you can apply globally or per IP even. In this case it’s a simple global bandwidth limit with a scheduler that doesn’t impair latency until that point.

Testing the UDP traffic-limit

One of the more conservative bandwidth test tools is iperf3[5]. It needs a client - server setup, which makes sense especially when we have to measure UDP throughput variance.

On the picture below shell (black background, blue font) is the server. As you can see it reports appox. 65 - 130 Kbit/s. That is appropriate for this measurement. It’s not bursting, and that the intention.


  • pfSense Limiters are useful for traffic limits
  • Technitium DNS is useful for comfort, privacy and security
  • Technology is complex, and you should be careful with self-hosting open resolvers
  • Samsung TVs can embed advertisements and I hope that there will be heavy fines

  1. https://www.cloudflare.com/en-gb/learning/ddos/dns-amplification-ddos-attack/ ↩︎

  2. How to stop adverts appearing on your Samsung TV · GitHub ↩︎

  3. Technitium DNS Server | An Open Source Tool For Privacy & Security ↩︎

  4. Traffic Shaper — Limiters | pfSense Documentation ↩︎

  5. iPerf - iPerf3 and iPerf2 user documentation ↩︎