Решение проблем Сравнение версий

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
wiki:руководство_по_ubuntu_server:служба_доменных_имен:troubleshooting [2012/06/15 15:32]
[Тестирование]
wiki:руководство_по_ubuntu_server:служба_доменных_имен:troubleshooting [2013/04/27 13:32] (текущий)
Строка 54: Строка 54:
 ===named-checkzone=== ===named-checkzone===
  
-A great way to test your zone files is by using the named-checkzone ​utility installed with the bind9 packageThis utility allows you to make sure the configuration is correct before restarting ​BIND9 and making the changes live.+Хороший способ проверить ваши файлы зон - это использовать утилиту **named-checkzone**, установленную вместе с пакетом **bind9**Эта утилита позволяет вам убедиться в корректности настроек до перезапуска **BIND9** и применения изменений.
  
-    To test our example Forward zone file enter the following from a command prompt+ 1. Для тестирования нашего файла прямой зоны из примера введите следующее в командной строке
- +<​code>​named-checkzone example.com /​etc/​bind/​db.example.com</​code>​ 
-    ​named-checkzone example.com /​etc/​bind/​db.example.com +Если все настроенно верно, вы сможете увидеть вывод, похожий на
- +<​code>​ 
-    If everything is configured correctly you should see output similar to+zone example.com/​IN:​ loaded serial 6 
- +OK 
-    zone example.com/​IN:​ loaded serial 6 +</​code>​ 
-    OK + 2. Аналогичнодля тестирования файла обратной зоны введите следующее
- +<​code>​named-checkzone 1.168.192.in-addr.arpa /​etc/​bind/​db.192</​code>​ 
-    ​Similarlyto test the Reverse zone file enter the following+Вывод должен напоминать следующее
- +<​code>​ 
-    ​named-checkzone 1.168.192.in-addr.arpa /​etc/​bind/​db.192 +zone 1.168.192.in-addr.arpa/​IN:​ loaded serial 3 
- +OK 
-    The output should be similar to+</​code>​ 
- +<​note>​Serial Number ​вашего файла зоны может отличаться.</​note>​
-    zone 1.168.192.in-addr.arpa/​IN:​ loaded serial 3 +
-    OK +
- +
-The Serial Number ​of your zone file will probably be different.+
  
 ====Журналирование==== ====Журналирование====
  
-BIND9 has a wide variety of logging configuration options availableThere are two main optionsThe channel ​option configures where logs goand the category ​option determines what information to log. +BIND9 имеет широкий набор доступных опций настроек журналовСуществуют две основные опцииС помощью опции **channel** указывается где вести журналыа опция **category** определяет какую информацию писать в журнал.
- +
-If no logging option is configured the default option is:+
  
 +Если опции журналов отсутствуют,​ по умолчанию применяется следующее:​
 +<​code>​
 logging { logging {
      ​category default { default_syslog;​ default_debug;​ };      ​category default { default_syslog;​ default_debug;​ };
      ​category unmatched { null; };      ​category unmatched { null; };
 }; };
 +</​code>​
 +Этот раздел раскрывает как настроить BIND9 посылать отладочные сообщения,​ связанные с DNS запросами в отдельный файл.
  
-This section covers configuring BIND9 to send debug messages related to DNS queries to a separate file. + 1Сначала нам надо настроить канал (channel) для определения в какой файл посылать сообщенияРедактируем ​/​etc/​bind/​named.conf.local ​и добавляем следующее
- +<​code>​ 
-    First, we need to configure a channel ​to specify which file to send the messages toEdit /​etc/​bind/​named.conf.local ​and add the following+logging { 
- +    channel query.log {       
-    logging { +        file "/​var/​log/​query.log";​ 
-        channel query.log {       +        severity debug 3;  
-            file "/​var/​log/​query.log";​ +    };  
-            severity debug 3;  +}; 
-        };  +</​code>​ 
-    }; + 2. Затем настраиваем категорию (category) для отправки всех ​DNS запросов в файл
- +<​code>​ 
-    Next, configure a category ​to send all DNS queries to the query file+logging { 
- +    channel query.log {       
-    logging { +        file "/​var/​log/​query.log";​  
-        channel query.log {       +        severity debug 3;  
-            file "/​var/​log/​query.log";​  +    };  
-            severity debug 3;  +    category queries { query.log; };  
-        };  +}; 
-        category queries { query.log; };  +</code>
-    }; +
- +
-Note: the debug option can be set from 1 to 3. If a level isn't specified level 1 is the default. +
- +
-    Since the named daemon runs as the bind user the /var/​log/​query.log file must be created and the ownership changed:+
  
 +<​note>​Обратите внимание на опцию **debug**, которая может принимать значения от 1 до 3. Если уровень отладки не указан,​ о умолчанию используется 1.</​note>​
 + 3. Поскольку сервис **named** запускается от имени **bind**, надо создать файл и сменить ему пользователя:​
 +<​code>​
     sudo touch /​var/​log/​query.log     sudo touch /​var/​log/​query.log
     sudo chown bind /​var/​log/​query.log     sudo chown bind /​var/​log/​query.log
 +</​code>​
 + 4. Перед тем как сервис **named** сможет писать в новый файл журнала нужно изменить профиль AppArmor. Сначала редактируем файл /​etc/​apparmor.d/​usr.sbin.named,​ добавив:​
 +<​code>/​var/​log/​query.log w,</​code>​
 +или так:
 +<​code>/​var/​log/​** rw,</​code>​
 +Затем перегружаем профиль:​
 +<​code>​cat /​etc/​apparmor.d/​usr.sbin.named | sudo apparmor_parser -r</​code>​
 +На версии 12.4 работает следующая команда:​
 +<​code>​sudo apparmor_parser -r /​etc/​apparmor.d/​usr.sbin.named</​code>​
  
-    Before named daemon can write to the new log file the AppArmor ​profile must be updated. First, edit /etc/apparmor.d/​usr.sbin.named and add:+Дополнительную информацию по **AppArmor** смотрите в разделе [[wiki:​руководство_по_ubuntu_server:​безопасность:​apparmor|AppArmor]].
  
-    ​/var/​log/​query.log w,+ 5. Теперь перегружаем BIND9 для применения изменений:​ 
 +<​code>​sudo service bind9 restart</code>
  
-    Next, reload the profile: +Теперь вы можете увидеть файл ​/​var/​log/​query.log, заполненный информацией о запросахЭто простейший пример использования опций журналирования ​BIND9. ​По использованию расширенных опций смотрите раздел [[wiki/​руководство_по_ubuntu_server/​служба_доменных_имен/​references#​дополнительная_информация|Дополнительная информация]].
- +
-    cat /​etc/​apparmor.d/​usr.sbin.named | sudo apparmor_parser -r +
- +
-    For more information on AppArmor see AppArmor +
- +
-    Now restart BIND9 for the changes to take effect: +
- +
-    sudo service bind9 restart +
- +
-You should see the file /​var/​log/​query.log ​fill with query informationThis is a simple example of the BIND9 logging optionsFor coverage of advanced options see More Information.+
  
 ---- ----
Строка 136: Строка 132:
 [[wiki:​руководство_по_ubuntu_server:​служба_доменных_имен:​configuration|<​-назад]] |  [[wiki:​руководство_по_ubuntu_server:​служба_доменных_имен:​configuration|<​-назад]] | 
 [[wiki:​руководство_по_ubuntu_server:​служба_доменных_имен:​references|далее->​]]</​style>​ [[wiki:​руководство_по_ubuntu_server:​служба_доменных_имен:​references|далее->​]]</​style>​
-