Skip to content

Instantly share code, notes, and snippets.

@asvdvl
Created August 17, 2024 23:56
Show Gist options
  • Save asvdvl/c99abe2517a97f305c8f30b0ab18ea27 to your computer and use it in GitHub Desktop.
Save asvdvl/c99abe2517a97f305c8f30b0ab18ea27 to your computer and use it in GitHub Desktop.
--[[
So, let's assume the following situation: you have native IPv4 from your provider,
but you get IPv6 from a tunnel broker, such as Hurricane Electric (located in another country).
After setting things up, you notice that when making DNS requests(ipv6.google.com is good example for me) over IPv4,
you receive one answer for an AAAA query, but over IPv6, you get a completely different answer.
Most likely, the DNS gave you the server closest to you. This can create problems where traffic crosses the border twice,
resulting in poor speed and high latency.
To solve this problem, I used `dnsdist`: all AAAA record queries are routed to the IPv6 pool,
and all other requests go through IPv4.
Additionally, you can switch servers to DoH or adjust other settings depending on your network and needs.
]]
newServer({address="1.1.1.1", pool="ip4"})
newServer({address="2606:4700:4700::1111", pool="ip6"})
addAction(QTypeRule(DNSQType.AAAA), PoolAction("ip6"))
addAction(AllRule(), PoolAction("ip4"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment