Implement intelligent resolution for domestic and international users to resolve to different servers using the VIEW feature of BIND.

by liq330 on 2008-04-25 12:59:12

Use BIND intelligent resolution to direct domestic and international users to different servers.

Prerequisite: Assume you already have BIND installed and tested successfully.

Assume:

- The IP 192.168.0.2 is the IP of the domestic server.

- The IP 192.168.0.3 is the IP of the international server.

The main feature used here is BIND's VIEW function. Below is the code for the intelligent resolution functionality in the `named.conf` file:

```plaintext

options {

directory "/var/named";

};

acl "domestic" {

1.2.3.4/24; // Replace with the actual IP range of domestic users

localhost;

localnets;

};

acl "international" {

5.6.7.8/24; // Replace with the actual IP range of international users

};

view "domestic" {

match-clients { domestic; };

recursion yes;

zone "example.com" IN {

type master;

file "db.example.com.domestic"; // Zone file for domestic users

};

};

view "international" {

match-clients { international; };

recursion no;

zone "example.com" IN {

type master;

file "db.example.com.international"; // Zone file for international users

};

};

```

### Explanation:

1. **ACL (Access Control List):**

- Define two ACLs: one for domestic users (`domestic`) and one for international users (`international`).

- Replace the placeholder IP ranges (`1.2.3.4/24` and `5.6.7.8/24`) with the actual IP ranges for your domestic and international users.

2. **View Configuration:**

- The `view "domestic"` block serves DNS records from the `db.example.com.domestic` zone file for domestic users.

- The `view "international"` block serves DNS records from the `db.example.com.international` zone file for international users.

3. **Zone Files:**

- In the `db.example.com.domestic` file, configure the record pointing to the domestic server (e.g., `A 192.168.0.2`).

- In the `db.example.com.international` file, configure the record pointing to the international server (e.g., `A 192.168.0.3`).

This setup ensures that domestic users are directed to the domestic server, while international users are directed to the international server.