zone
Build, rebuild, or delete a domain's DNS zone file from GoAdmio's zone records, and register it with BIND
- Command:
/go/zone - Category: DNS
- Required option: A domain, or
allwith an action - Output: Usually none; messages only for errors
- Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/zone manages the DNS zones that this server answers for with BIND, the DNS server software. GoAdmio keeps each domain's DNS records in a database. This command:
- adds a standard set of default records for a domain (website, mail, SPF, DKIM, and so on)
- writes the domain's zone file from the records in the database
- registers the zone with BIND and restarts it
- can delete a domain's zone
It matters only when this server is the authoritative DNS server for your domains, that is, when the domains' nameservers point at this server. If your DNS is managed at Cloudflare instead, use dns and cloudflare.
GoAdmio uses it when it creates an account (see create). You run it yourself to rebuild a zone, to refresh the default records, or to remove a zone.
The command raises its own privileges with sudo, so you can run it as any user with sudo rights. It needs a nameserver list in /etc/nameservers (see nameservers).
Quick start
# Refresh a domain's default DNS records and rewrite its zone file
/go/zone example.com update
Syntax
# Rewrite a zone file from the saved records, and register the zone
/go/zone <domain>
# Replace the default records, keep custom records, rewrite the file
/go/zone <domain> update
# Add the default records and rewrite the file
/go/zone <domain> reset
# Same as reset, for the nameserver's own domain
/go/zone <domain> main
# Delete the zone
/go/zone <domain> delete
# Rebuild every zone
/go/zone all reset
/go/zone all update
| Form | Behavior |
|---|---|
/go/zone <domain> |
Writes the zone files from the records already saved, registers the zone with BIND, and restarts BIND. Adds no records. |
/go/zone <domain> update |
Deletes the domain's default records (those not marked custom), adds fresh defaults, then does everything above. |
/go/zone <domain> reset |
Adds the default records, then does everything above. It does not delete existing records first, so records can be duplicated. Use update to refresh one domain. |
/go/zone <domain> main |
Like reset, but the domain doesn't need to be hosted on this server. Used for the domain of your nameservers. |
/go/zone <domain> delete |
Removes the zone from BIND's configuration, deletes its records from the database, and deletes its zone files. |
/go/zone all reset |
Deletes all zone records, then rebuilds every zone. |
/go/zone all update |
Rebuilds every zone, keeping custom records. |
Every run is recorded in /var/log/go/zone.log, with the time and the arguments you passed.
Options
| Argument | Required | Notes |
|---|---|---|
domain |
Yes | A hosted domain with a /home/<domain>/www folder, or all. With the main action, the folder isn't needed. |
action |
No | update, reset, main, or delete. With all, only reset and update do anything. Any other value prints Invalid action. |
--norestart |
No | Don't restart BIND at the end. Used when many zones are rebuilt in a row. |
[!WARNING]
/go/zone all resetdeletes every record in the zone database, including custom records you added yourself, before it rebuilds the defaults. To keep custom records, useall update.
Output
The command prints nothing when it works, except for all, which prints one line for each entry in /home:
Resetting DNS Zone example.com...
| Message | Meaning |
|---|---|
Please Setup a Nameserver. |
/etc/nameservers doesn't exist. Exit status 1. |
Domain "<domain>" not exists. |
No /home/<domain>/www folder (and the action isn't main). Exit status 1. |
Invalid action. |
The action isn't one of the allowed values. Exit status 1. |
named-checkconf messages |
BIND's own check of its configuration found a problem. |
The command exits with status 1 after delete, and after any all run, even when everything worked.
With all, any action other than reset or update does nothing and ends without a message.
Log
Each run appends one line to /var/log/go/zone.log:
[Nov 21 12:00:00]# zone example.com update
Examples
# Refresh a domain's default records
/go/zone example.com update
# Rewrite a domain's zone file from the saved records
/go/zone example.com
# Create the zone for the domain of your nameservers
/go/zone example.net main
# Remove a zone
/go/zone example.com delete
# Rebuild all zones and keep custom records
/go/zone all update
# Check a zone file for errors (RHEL family path shown)
named-checkzone example.com /etc/zone/example.com
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Please Setup a Nameserver. |
No nameserver list exists. | Set the nameservers with nameservers, then run again. |
Domain "<domain>" not exists. |
The domain isn't hosted here, or is misspelled. | Check the name. For your nameserver's own domain, use the main action. |
Invalid action. |
The second argument isn't valid. | Use update, reset, main, or delete. |
Nothing happens with all |
all needs reset or update. |
Add the action. |
named-checkconf prints errors |
A problem in BIND's configuration. | Fix the file it names. |
| BIND doesn't load a zone | The zone file has an error. | Run named-checkzone <domain> <zone file> and read the error. |
| Changes don't show up in DNS | BIND wasn't restarted (--norestart, or a delete), or the domain's nameservers don't point at this server. |
Restart BIND, and check the domain's nameservers at the registrar. |
Duplicate records after reset |
reset for one domain doesn't remove existing records first. |
Use update instead. |
| A record type is missing from the zone file | Only NS, A, MX, CNAME, and TXT records are written to zone files. | Other types aren't supported by this command. |
| A TXT value is cut short | TXT values are split at commas when they are read from the database. | Avoid commas in TXT values. |
| A secondary nameserver doesn't pick up changes | The zone serial doesn't change when records change. See Zone files. | Reload the zone on the secondary by hand. |
| Reverse DNS (PTR) doesn't work | The reverse zone file isn't loaded by BIND. | Set reverse DNS with your hosting provider. See reversedns. |
| Custom BIND options on Debian or Ubuntu are gone | The command rewrites /etc/bind/named.conf.options. |
Put your options in another included file, or change them again after each run. |
Details
Files and paths
| RHEL family | Debian and Ubuntu | |
|---|---|---|
| BIND service | named |
bind9 |
| BIND configuration | /etc/named.conf |
/etc/bind/named.conf.local |
| Zone files | /etc/zone/<domain> |
/etc/bind/zone/<domain> |
| Reverse zone files | /etc/zone/reverse.<domain> |
/etc/bind/zone/reverse.<domain> |
Records live in the Zone table of /var/lib/sqlite/zone.db. Records marked custom there survive update.
Default records
reset, update, and main add these records for the domain:
| Name | Type | Value | TTL |
|---|---|---|---|
| The domain | NS |
Each nameserver in /etc/nameservers |
86400 |
The first part of each nameserver name (such as ns1) |
A |
The server's IP | 14400 |
| The domain | A |
The server's IP | 14400 |
mail |
A |
The server's IP | 14400 |
| The domain | MX |
The domain itself, priority 0 | 14400 |
www, webmail, go, *, ftp |
CNAME |
The domain | 14400 |
| The domain | TXT |
v=spf1 +a +mx +ip4:<server IP> ~all (SPF) |
14400 |
dkim._domainkey.<domain> |
TXT |
The DKIM key, from installdkim |
14400 |
The * record makes every name you haven't defined resolve to the domain. The server's IP is its public IPv4 address, looked up from checkip.amazonaws.com.
Zone files
The zone file is written from scratch on every run, in this order: SOA, NS, A, MX, CNAME, and TXT records.
| Detail | Behavior |
|---|---|
| SOA | The first nameserver, the server hostname as the contact, refresh 3600, retry 1800, expire 1209600, minimum 86400. |
| Serial | The account's ID number, padded to 9 digits (000000000 if the domain has no account, such as the main domain). It does not change when records change. |
| Names with a dot | Treated as complete names and written with a trailing dot, so use full names for them. |
| NS, MX, and CNAME values | Always written with a trailing dot, so they must be full names. |
| TXT values | Written as one quoted string. |
The command also writes a reverse zone file for each domain, but BIND is not told to load it (the line that registers it is commented out in the command), so it has no effect.
During a run the command saves temporary copies of the records in /usr/local/goadmio/tmp/<domain>.zone and /usr/local/goadmio/<domain>.zone. They aren't deleted afterward.
BIND settings the command changes
These changes happen every time a domain is processed.
| System | Change |
|---|---|
| RHEL family | In /etc/named.conf, adds the server IP to listen-on port 53 and changes allow-query from localhost to any. Adds Restart=always and RestartSec=3 to GoAdmio's BIND service file if missing, so BIND restarts if it stops. |
| Debian and Ubuntu | Overwrites /etc/bind/named.conf.options with fixed settings: listen on localhost and the server IP (and ::1 for IPv6), allow-query { any; }, recursion yes, dnssec-validation yes. When BIND is restarted, it also appends firewall rules that accept port 53 (TCP and UDP) with iptables. The rules are appended each time, so duplicates build up. |
| Both | Registers the zone in the BIND configuration if it isn't there yet. |
After the changes, the command runs named-checkconf, which reports configuration errors only. It doesn't check the zone files.
flowchart TD
A["zone domain [action]"] --> B{"delete?"}
B -- "Yes" --> D1["Remove from BIND config, delete records and files, exit 1"]
B -- "No" --> C{"Nameservers set up, domain exists, action valid?"}
C -- "No" --> X["Print the error, exit 1"]
C -- "Yes" --> E{"all?"}
E -- "Yes" --> F["reset: clear all records. Then zone main, then each hosted domain with --norestart, then restart BIND"]
E -- "No" --> G["update: delete default records"]
G --> H["Adjust BIND settings, register the zone"]
H --> I["reset / update / main: add default records"]
I --> J["Write the zone file and the reverse file"]
J --> K{"--norestart?"}
K -- "No" --> L["Restart BIND"]
K -- "Yes" --> M["Skip"]
L --> N["named-checkconf"]
M --> N
See also
| Command | Description |
|---|---|
named |
Reinstall BIND and regenerate all zone files |
nameservers |
Change the nameservers for a GoAdmio server |
installdkim |
Install OpenDKIM and configure it for GoAdmio, create the DKIM key of a domain, and print the DNS TXT value for it |
dns |
Add one or all hosted domains to Cloudflare and set up their DNS zone, proxy and cache mode, nameservers, and SSL |
reversedns |
Check reverse DNS (rDNS) in GoAdmio |
create |
Create a GoAdmio account from the command line |