Troubleshooting DNS Resolution Failures on FreeBSD and OpenBSD

Troubleshooting DNS Resolution Failures on FreeBSD and OpenBSD

Your BSD machine can reach the network, but every hostname seems to lead nowhere. Package downloads fail. SSH pauses before connecting. A website works from your phone yet refuses to load from your workstation. Before changing nameservers or restarting services, find out where the answer stops making sense. DNS troubleshooting becomes much easier when you separate application behavior, resolver configuration, cached answers, and authoritative records.

Three Checks That Narrow the Search

  1. Check which resolver your BSD system actually uses.
  2. Compare identical queries through local and independent resolvers.
  3. Ask authoritative servers before blaming stale caches.

Start With the Failure You Can Reproduce

Choose one failing hostname and write down the exact symptom. A timeout, an unexpected address, and a missing IPv6 record are different problems. Keep the hostname and record type consistent as you test. Comparing an A record on one server with an AAAA record on another tells you little.

Use a fully qualified name with a trailing dot in diagnostic commands. For example, www.example.com. makes the intended DNS name explicit. Replace that example with your failing hostname throughout this guide.

Check the network separately from name resolution:

ifconfig
netstat -rn
ping -c 3 1.1.1.1

A successful ping to a numeric address confirms some IP connectivity. It does not prove that DNS traffic can pass. A failed ping is also inconclusive because networks may block ICMP. Check interface addresses, routes, and access to a known service before treating the incident as DNS alone.

Note whether the failure affects every domain or only one. Widespread failures often point toward resolver reachability or local configuration. A single broken domain deserves closer inspection of its records, delegation, and DNSSEC validation.

Read the Resolver Settings Before Editing Them

Begin with the configuration that ordinary resolver routines read:

cat /etc/resolv.conf
cat /etc/hosts

Each nameserver entry identifies a DNS server. An address of 127.0.0.1 or ::1 points back to the machine itself. That arrangement requires a local resolver listening on the matching address. An internal address may belong to your router, workplace resolver, or VPN.

Inspect search and options entries too. Search domains can change how short names are expanded. A command that resolves printer may ask a different question from one that resolves printer.example.net.. An entry in /etc/hosts can also explain why an application receives an address that does not appear in direct DNS queries.

Follow FreeBSD Configuration Ownership

On FreeBSD, resolver settings may come from DHCP, a VPN client, or configuration managed through resolvconf. Inspect the file for generated content and identify which component supplies the nameservers. A manual edit may disappear after a lease renewal or network reconnection.

FreeBSD installations can use local_unbound for local resolution. If the machine is configured to use it, check its state:

service local_unbound onestatus
sockstat -46 -l

Look for a listener on port 53 and confirm that its address matches /etc/resolv.conf. Another resolver may be installed instead. Check the actual process before choosing a service command. On FreeBSD, /etc/nsswitch.conf also controls the sources consulted for host lookups, which can explain differences between DNS tools and applications.

Check OpenBSD Resolver Management

On OpenBSD, resolvd manages nameserver configuration using information supplied by networking components. When unwind is running, it can place 127.0.0.1 at the top of /etc/resolv.conf. Read the installed resolvd(8) manual for the behavior on your release.

rcctl check resolvd
rcctl check unwind
netstat -an -f inet
netstat -an -f inet6

An inactive unwind service is only a fault if your configuration expects to use it. A machine configured to query a remote resolver directly does not need a local caching daemon. If settings keep changing, investigate their source before repeatedly editing the generated file.

Ask the Same Question With dig and drill

Use whichever diagnostic tools are installed. FreeBSD commonly provides drill, and OpenBSD provides dig. Availability can vary with release and installed packages. Check before assuming a missing command means DNS itself is broken:

command -v dig
command -v drill

Start with a query through the configured resolver. Then query each nameserver address explicitly. These examples show equivalent A-record requests:

dig www.example.com. A
drill www.example.com. A

dig @127.0.0.1 www.example.com. A
drill www.example.com. @127.0.0.1 A

Use the loopback examples only when a local resolver is expected. Otherwise, substitute the nameserver address from your configuration. Explicit server selection helps you isolate one resolver instead of allowing fallback behavior to obscure the result.

Keep the full output initially. Read the response status, answer section, responding server, and TTL. With dig, the SERVER line identifies the endpoint that answered. This prevents a successful response from a fallback server being mistaken for proof that the first server works.

NXDOMAIN means the queried name does not exist in that DNS view. NOERROR with an empty answer can mean the name exists without the requested record type. SERVFAIL means the server could not complete the request. A timeout means no usable reply arrived before the tool stopped waiting. Each result calls for a different next step.

Compare What Another Network Can See

Once you have captured the local result, run a DNS lookup for the same public hostname and record type. This provides an external comparison point for checking whether an unexpected record is visible beyond the affected BSD system. Record the observation time and compare the returned addresses and response status.

If the external result agrees with the unexpected local answer, the issue may extend beyond your machine. If it differs, investigate cache age, resolver policy, VPN routing, and split DNS. An external recursive resolver offers one additional viewpoint. It cannot establish that every resolver worldwide sees the same records.

For public names, you can also compare against an independent resolver directly, where network policy permits:

dig @1.1.1.1 www.example.com. A
drill www.example.com. @1.1.1.1 A

Keep private hostnames on approved internal resolvers. Public services generally cannot resolve internal zones. Different answers can also be intentional when a service uses geographic routing or when a VPN supplies an internal DNS view.

Separate Cached Answers From Authoritative Records

A caching resolver stores answers for reuse. An authoritative server publishes the records for a zone. To distinguish the two, obtain the zone’s nameservers and query their addresses directly.

dig example.com. NS
dig @AUTH_IP www.example.com. A +norecurse
dig @AUTH_IP example.com. SOA +norecurse

Replace AUTH_IP with an actual authoritative server address. Using an address avoids needing another hostname lookup before the test can run. Obtain those addresses from reliable DNS results or your DNS provider’s configuration.

Check for the aa flag in the response. It identifies an authoritative answer. If the hostname belongs to a separately delegated child zone, find that zone’s authoritative servers. Asking an ancestor server may return a referral rather than the final answer.

Query every authoritative server for the same name and record type. If they disagree, investigate zone publication or replication. Compare SOA serial numbers as supporting evidence. Matching serials alone do not prove that every relevant answer matches.

If authoritative servers return the intended address while a recursive resolver returns an older one, caching is a likely explanation. The TTL in a cached answer usually reflects its remaining cache lifetime. Some resolvers can serve stale records during upstream failures, which makes logs useful when results persist beyond expectations.

Missing records can be cached too. After creating a previously absent name, a resolver may retain an earlier negative answer until its negative cache lifetime expires. Repeated queries do not automatically force it to fetch fresh data.

Check Transport and DNSSEC When Answers Fail

DNS needs working transport as well as correct records. Compare UDP behavior with a TCP query:

dig @RESOLVER_IP www.example.com. A +time=2 +tries=1
dig @RESOLVER_IP www.example.com. A +tcp +time=2 +tries=1

Replace RESOLVER_IP with the resolver under investigation. If TCP works while UDP times out, inspect packet filtering and the network path. If small queries work but larger responses fail, investigate EDNS handling, fragmentation, and TCP fallback. DNS traffic may require both UDP and TCP port 53.

On either BSD system, packet capture can show whether queries leave and replies return:

doas tcpdump -ni em0 port 53

Use your actual interface name and an account with capture privileges. For a loopback resolver, inspect lo0 as appropriate. A query leaving without a reply points toward a different problem from a reply arriving that contains SERVFAIL.

DNSSEC validation deserves attention when one domain fails through a validating resolver. Compare these queries:

dig @RESOLVER_IP www.example.com. A +dnssec
dig @RESOLVER_IP www.example.com. A +dnssec +cdflag
date -u

If the ordinary query fails but the checking-disabled query succeeds, validation is a strong lead. Resolver policy can affect this test, so inspect logs and the domain’s signing configuration before drawing a firm conclusion. Check system time because signature validity depends on it. Treat disabled checking as a diagnostic test, not a permanent repair.

Repair the Layer That the Evidence Identifies

If direct queries to the configured upstream work but queries through a local daemon fail, inspect that daemon’s configuration, listening addresses, and logs. Capture the failure before clearing anything. A restart can erase useful evidence.

When you have confirmed a local cache or process problem, restarting the configured service is one option. It requires administrative privileges and can briefly interrupt local resolution:

service local_unbound restart

That command applies to FreeBSD systems using local_unbound. On OpenBSD systems using unwind, use:

rcctl restart unwind

If an upstream resolver owns the stale cache, restarting your local service will not clear that upstream cache. Wait for expiry or contact its operator. If authoritative servers publish the wrong record, correct the zone first. Cache clearing cannot repair authoritative data.

When DNS tools succeed but an application still fails, check application caching, encrypted DNS settings, proxy configuration, and host lookup rules. Test A and AAAA records separately. A valid IPv6 answer paired with broken IPv6 connectivity can cause application failures even though DNS returned the correct data.

Make the Next Lookup Predictable

After the repair, repeat the original query through the configured resolver and retry the affected application. Verify that resolver settings survive the network event that previously changed them, whether that was a lease renewal or VPN reconnection.

Keep a small incident record with the hostname, record type, resolver address, response status, timestamp, and authoritative result. Those details turn a vague report of broken DNS into a fault you can locate. On FreeBSD and OpenBSD, the dependable path is the same: establish which component answered, compare its answer with the source, and repair the layer where the evidence stops agreeing.

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *