Modify dnsmasq Settings
ServBay comes with the dnsmasq service and provides flexible configuration options. This article will detail how to modify the dnsmasq settings in ServBay, including the location of the dnsmasq.conf
file and common configuration items.
Overview
In ServBay, dnsmasq's configuration files are located in the /Applications/ServBay/etc/dnsmasq
directory. Below are the specific locations of these configuration files:
dnsmasq.conf
:/Applications/ServBay/etc/dnsmasq/dnsmasq.conf
domains.conf
:/Applications/ServBay/etc/dnsmasq/domains.conf
dnsmasq.conf Configuration
The dnsmasq.conf
file is the main configuration file for dnsmasq, used to set various options for DNS and DHCP.
Common Configuration Items
Here are some common configuration items in the dnsmasq.conf
file and how to modify them:
Set DNS Server:
server=8.8.8.8 server=8.8.4.4
1
2Set Cache Size:
cache-size=1000
1Set Domain Name:
domain=local
1Enable DNS Query Log:
log-queries
1Set DHCP Range:
dhcp-range=192.168.0.50,192.168.0.150,12h
1
Custom DNS Records
dnsmasq allows you to customize DNS records, which is very useful for small networks or development environments. The configuration file is located at domains.conf
STOP
The domains.conf
file will be automatically overwritten by ServBay. Please use ServBay's Manage Local DNS Service for modifications.
Example Configuration
Here are some examples of custom DNS records:
- Set Local Domain Name Resolution:
address=/servbay.host/127.0.0.1
1
Restart dnsmasq
After modifying the dnsmasq configuration files, you need to restart the service to apply the changes. You can restart it via the ServBay management interface or using the servbayctl
command line tool.
Restart via ServBay Management Interface
- Open the ServBay management interface.
- Navigate to
Services
. - Find the dnsmasq service and click the
Restart
button.
Restart via servbayctl
You can conveniently restart the dnsmasq service using the servbayctl
command line tool:
servbayctl restart dnsmasq -all
Summary
In ServBay, the dnsmasq configuration files are located in the /Applications/ServBay/etc/dnsmasq
directory. By modifying these files, you can set DNS servers, cache size, domains, enable logs, and configure DHCP ranges. Custom DNS records can also be configured through these files. After modifying the configuration files, you can restart the dnsmasq service via the ServBay management interface or using the servbayctl
command line tool to apply the changes.