DNSServer: Resolving Internal Domain Names Without /etc/hosts
In a DNS server network, the local zone is responsible for resolving domain names within the network. A typical scenario involves the DNS server correctly resolving external domains, but failing to resolve internal domains. This issue can be resolved without relying on the /etc/hosts file.
Understanding the Problem
When using a DNS server, the /etc/hosts file can become redundant. However, if the DNS server fails to resolve internal domain names, it is necessary to troubleshoot the issue. One possible cause is the absence of internal domain names in the DNS server's local zone.
Configuring the DNS Server
To resolve internal domain names without using the /etc/hosts file, you need to configure your DNS server to include the necessary records. This process varies depending on the DNS server software you are using. Common DNS server software includes BIND, PowerDNS, and Unbound.
Example: BIND Configuration
In BIND, you can add a new zone to the named.conf file:
zone "internal.site" {
type master;
file "/etc/bind/db.internal.site";
};
Then, create the zone file (/etc/bind/db.internal.site) with the appropriate records:
$TTL 86400
@ IN SOA ns1.internal.site. admin.internal.site. (
2022030101 ; Serial
3600 ; Refresh
1800 ; Retry
604800 ; Expire
86400 ; Minimum TTL
)
@ IN NS ns1.internal.site.
@ IN A 127.0.0.1
Testing the Configuration
After configuring the DNS server, test the internal domain name resolution using the nslookup command:
$ nslookup internal.site
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: internal.site
Address: 127.0.0.1
References
- BIND - Internet Systems Consortium
- PowerDNS Authoritative Server
- Unbound - Validating, recursive, and caching DNS resolver
This article covers the process of resolving internal domain names without relying on the /etc/hosts file. By understanding the problem and configuring the DNS server accordingly, you can ensure seamless internal domain name resolution within your network.