Trying to set up an anycast DNS setup. For the time being, we have two routers, R01 and our Mgmt router that we're using until we move to SDN (in testing phases).

The problem we're having is the DNS receives the query on like it should but it responds via using NAT. The box that the DNS server is on has a gateway of last resort set to .1 for upgrades and other traffic, and is configured on the loopback interface. How do we force responses back through the way it came (through R01)?

BGP AS 64000   +   +      Static Routed
Aggregating +--+   +----+ |           | SNAT on .130
   +--------+-+    +----+------------+
   |R01       |    |Mgmt/OOB Rtr     |
   |          |    |                 |
   +-----+----+    +---------+-------+
      .2 |                   | .1
         |    |
              | .4
      |DNS Service    |
      |Anycast        |
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Aug 13, 2017 at 20:34

1 Answer 1


Your DNS server doesn't know where the packet(s) came from. Thus responses will follow whatever the route table says is the best path to the destination -- which is a different path if the origin was R01.

You'll need some sort of policy-based routing on the server -- route based on src, not dest; anything from should be forwarded to How to set that up on your (unspecified) host OS is off-topic here. (as it isn't a router)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.