EDIT: the tldr: I want to use TEE and NAT to clone UDP traffic. I'm not worried about handling responses. I ideally don't want to install new software. I am using TEE to send to local segment (127.0.0.2) successfully, then I want to NAT that traffic out to the WAN.
I have bind9 listening on port 53 on my Debian server. I have an external client making DNS requests to said server. All of this is working fine. I would like to copy the incoming DNS requests on port 53 and send them off to, say, 184.108.40.206. Note the word copy.
From much googling and reading on SU, I have found the most often advised method is to use iptables TEE and NAT. I have TEE working pretty well, here's my command:
iptables -t mangle -A POSTROUTING -p udp -d 127.0.0.1 --dport 53 -j TEE --gateway 127.0.0.2
I verified I receive a copy of the DNS request at 127.0.0.2:53 with netcat. So far so good.
Now, I need to change the destination IP. I attempt to accomplish this with:
iptables -t nat -A PREROUTING -p udp -d 127.0.0.2 --dport 53 -j DNAT --to 220.127.116.11
I used tcpdump to monitor for outgoing traffic to 18.104.22.168. Nothing. I wondered: maybe I need to change the source IP address so that the kernel doesn't drop this packet, since it's arriving at 127.0.0.2, but the source IP is set to that of my external DNS client. Why not?
iptables -t nat -A POSTROUTING -p udp -d 127.0.0.2 --dport 53 -j SNAT --to DNS_SERVERS_PUBLIC_IP
Still, tcpdump shows nothing.
I have IP forwarding on:
$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
I am pretty much out of ideas and would appreciate any and all help. Thank you.