> For the complete documentation index, see [llms.txt](https://utm-1.gitbook.io/utm-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/programmnoe-obespechenie/linux-servera/sistemnoe-po/bind-dns2-slave-rezhim.md).

# BIND (DNS2 - slave режим)

## Установка

**Установка BIND в Ubuntu:**&#x20;

```bash
sudo apt update
sudo apt install bind9
```

## Настройка

### Каталог /var/lib/bind/zones

<pre class="language-bash"><code class="lang-bash"><strong>sudo mkdir /var/lib/bind/zones
</strong>sudo chmod g+w /var/lib/bind/zones
sudo chgrp bind /var/lib/bind/zones
</code></pre>

### Настройка зон в *named.conf.local* <a href="#bd-2-set-up-zones-in-namedconflocal" id="bd-2-set-up-zones-in-namedconflocal"></a>

&#x20;файле *named.conf.local* определяем локальные зоны, которые будут работать в **SLAVE** режиме

```bash
sudo nano /etc/bind/named.conf.local
```

<details>

<summary>Содержание файла /etc/bind/named.conf.local</summary>

[Ссылка на файл в GitHub](https://github.com/utenkov-maxim/all-configs/blob/main/Servers/utm-server4/etc/bind/named.conf.local)

```
//
// Do any local configuration here
//

// sudo nano /etc/bind/named.conf.local
// sudo systemctl restart bind9

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

# Forward zone
zone "utmhome.ru" {
    type slave;
    file "/var/lib/bind/zones/db.utmhome.ru";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.1.0/24
zone "1.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.1.168.192";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.2.0/24
zone "2.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.2.168.192";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.3.0/24
zone "3.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.3.168.192";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.4.0/24
zone "4.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.4.168.192";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.5.0/24
zone "5.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.5.168.192";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.10.0/24
zone "10.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.10.168.192";
    masters { 192.168.1.3; };
};

# Reverse zone 192.168.20.0/24
zone "10.168.192.in-addr.arpa" {
    type slave;
    file "/var/lib/bind/zones/db.20.168.192";
    masters { 192.168.1.3; };
};
```

</details>

**Запуск службы BIND9**:

```bash
# Запуск
sudo systemctl enable bind9
sudo systemctl start bind9

# Перезапуск
sudo systemctl restart bind9

# Проверка
sudo systemctl status bind9
```

**Проверка работы BIND9:**

```bash
dig @192.168.1.4 utmhome.ru
nslookup utm-server5.utmhome.ru 192.168.1.4
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/programmnoe-obespechenie/linux-servera/sistemnoe-po/bind-dns2-slave-rezhim.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
