0

So Im trying to configure BIND to change the IP address of a response based on the requested domain's configured ip address. So a request comes into bind for domain.local and its ip address is 10.0.0.10. What im trying to do is if bind sees any domain that has an ip address of 10.0.0.10 it will respond back with an ip of lets say 10.0.0.20 instead without having to create a record in bind for domain.local.

1 Answers1

2

This gets very messy if you have lots of different responses/networks you need to handle, but providing a few source-based responses can be done with views. I've used this before to give lan clients a local address in the response and anyone else a public address.

acl "someclients" {
    1.2.3.4/24;
    5.6.7.8/24;
};

view "view1" {
    // directly specifying address(es) or ranges
    match-clients { 10.0.0.0/8; }; 

    zone "domain.com" {
        type master;
        file "view1/domain.com.zone";
    };
};

view "view2" {
    // example using a predefined group of addresses/ranges
    match-clients { someclients; }; 

    zone "domain.com" {
        type master;
        file "view2/domain.com.zone";
    };
};

view "view3" {
    match-clients { any; };

    zone "domain.com" {
        type master;
        file "view3/domain.com.zone";
    };
};

There's also a localnets acl by default that matches any networks local to the Bind server.

Note that when using views, all zones have to be inside a view. If you have a number of zone definitions that need to be present in all views I find it easier to move them all into a separate file, then add include "myzones.conf"; inside each view.

USD Matt
  • 5,321
  • 14
  • 23
  • 1
    I would just like to 2nd what USB Matt said regarding `This gets very messy`. Many people look at this and it seems simple, but when you have multiple dns admins; or worse, a team that manage this manually, it can get crazy and debugging problems can be maddening and can lead to extended outages. – Aaron May 19 '17 at 15:43