Настройка dnsmasq
ServBay включает службу dnsmasq и предоставляет гибкие параметры настройки. В этой статье подробно описывается, как изменить настройки dnsmasq в ServBay, включая расположение файла dnsmasq.conf
и общие параметры конфигурации.
Обзор
В ServBay конфигурационный файл dnsmasq находится в каталоге /Applications/ServBay/etc/dnsmasq
. Вот подробное расположение файлов конфигурации:
dnsmasq.conf
:/Applications/ServBay/etc/dnsmasq/dnsmasq.conf
domains.conf
:/Applications/ServBay/etc/dnsmasq/domains.conf
Конфигурация dnsmasq.conf
Файл dnsmasq.conf
является основным конфигурационным файлом для dnsmasq, который используется для настройки различных параметров DNS и DHCP.
Общие параметры конфигурации
Ниже приведены некоторые общие параметры конфигурации dnsmasq.conf
и способы их изменения:
Настройка DNS-серверов:
server=8.8.8.8 server=8.8.4.4
1
2Установка размера кэша:
cache-size=1000
1Установка домена:
domain=local
1Включение логирования запросов DNS:
log-queries
1Настройка диапазона DHCP:
dhcp-range=192.168.0.50,192.168.0.150,12h
1
Настройка пользовательских DNS-записей
dnsmasq позволяет настраивать пользовательские DNS-записи, что очень полезно для небольших сетей или тестовых сред. Файл конфигурации находится в domains.conf
.
STOP
domains.conf
будет автоматически перезаписан ServBay, пожалуйста, используйте управление локальной DNS-службой для внесения изменений.
Пример конфигурации
Ниже приведены примеры пользовательских DNS-записей:
- Настройка локального разрешения доменов:
address=/servbay.host/127.0.0.1
1
Перезапуск dnsmasq
После изменения конфигурационного файла dnsmasq необходимо перезапустить службу для применения изменений. Вы можете перезапустить её через интерфейс управления ServBay или с помощью командной строки с утилитой servbayctl
.
Перезапуск через интерфейс управления ServBay
- Откройте интерфейс управления ServBay.
- Перейдите в раздел
Сервисы
. - Найдите службу dnsmasq и нажмите кнопку
Перезапустить
.
Перезапуск через утилиту servbayctl
С помощью командной строки утилиты servbayctl
можно легко перезапустить службу dnsmasq:
servbayctl restart dnsmasq -all
Заключение
В ServBay конфигурационные файлы dnsmasq находятся в каталоге /Applications/ServBay/etc/dnsmasq
. Изменяя эти файлы, можно настроить DNS-серверы, размер кэша, домены, включение логов и диапазоны DHCP. Пользовательские DNS-записи также могут быть настроены через эти файлы. После изменения конфигурации можно перезапустить службу dnsmasq через интерфейс управления ServBay или с помощью утилиты командной строки servbayctl
для применения изменений.