If I run tcpdump on eth0 interface, then I see following ingress packets to my NIC:

15:07:47.174643 00:19:e2:9e:df:f0 > 00:01:6c:55:3a:72, ethertype IPv4 (0x0800), length 194: (tos 0x0, ttl 63, id 26045, offset 0, flags [none], proto UDP (17), length 180) > 58791*- 1/2/0 0.10.81.in-addr.arpa. SOA test-ns.example.net. hostmaster.example.net. 2010040800 14400 7200 604800 86400 (152)

I would like to replace the destination IP address from to I made a following rule to PREROUTING table:

# iptables -t nat -L PREROUTING -v --line-numbers -n
Chain PREROUTING (policy ACCEPT 175 packets, 14073 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1        0     0 DNAT       udp  --  eth0   *              udp spt:53 to:

As I understand, this should rewrite the destination IP address for UDP traffic addressed to port 53 into However, for some reason, I do not see any matches for this rule. What might cause this? INPUT chain in filter table allows this traffic.

  • Did you enable net.ipv4.ip_forward? – Lambert Nov 30 '15 at 13:31
  • If I understand what you're trying to do...you want the responses of a dns query to go to a host other than the one that requested it? I'm really curious what your use case is and I'm pretty sure there would be a better way to do it than with an iptables rule. – David King Nov 30 '15 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.