DNS config files, Zone file example and DNS Resource Types
The original dns config file. This file is the parent configuration file, we can include other conf file inside this one.
[code language=”text”]
/etc/named.conf
[/code]
The host configuration file
[code language=”text”]
/etc/host.conf
[/code]
When there is a change made to the dns config file, the dns server needs to be restarted. To restart the dns server
[code language=”text”]
sudo /etc/init.d/named restart
or
sudo service named restart
[/code]
DNS debug tools
[code language=”text”]
ping codexpedia.com
or
nslookup codexpedia.com
or
dig codexpedia.com
[/code]
DNS Zone file example
[code language=”text”]
$ORIGIN example.com. ; designates the start of this zone file in the namespace
$TTL 1h ; default expiration time of all resource records without their own TTL value
example.com. IN SOA ns.example.com. username.example.com. (
2007120710 ; serial number of this zone file
1d ; slave refresh (1 day)
2h ; slave retry time in case of a problem (2 hours)
4w ; slave expiration time (4 weeks)
1h ; maximum caching time in case of failed lookups (1 hour)
)
example.com. NS ns ; ns.example.com is a nameserver for example.com
example.com. NS ns.somewhere.example. ; ns.somewhere.example is a backup nameserver for example.com
example.com. MX 10 mail.example.com. ; mail.example.com is the mailserver for example.com
@ MX 20 mail2.example.com. ; equivalent to above line, "@" represents zone origin
@ MX 50 mail3 ; equivalent to above line, but using a relative host name
example.com. A 192.0.2.1 ; IPv4 address for example.com
AAAA 2001:db8:10::1 ; IPv6 address for example.com
ns A 192.0.2.2 ; IPv4 address for ns.example.com
AAAA 2001:db8:10::2 ; IPv6 address for ns.example.com
www CNAME example.com. ; www.example.com is an alias for example.com
wwwtest CNAME www ; wwwtest.example.com is another alias for www.example.com
mail A 192.0.2.3 ; IPv4 address for mail.example.com,
; any MX record host must be an address record
; as explained in RFC 2181 (section 10.3)
mail2 A 192.0.2.4 ; IPv4 address for mail2.example.com
mail3 A 192.0.2.5 ; IPv4 address for mail3.example.com
mysite.example.com. A 192.0.2.6 ; Ipv4 address for mysite.example.com
[/code]
A zone file is referenced by the dns configuration named.conf or any other conf files included in named.conf.For example, assume the zone file is located at /var/named/db.example.com, the dns conf file need to have this
[code language=”text”]
zone "example.com" { type master; file "/var/named/db.example.com"; };
[/code]
DNS Resource Records
[code language=”text”]
A IPv4 Address record. An IPv4 address for a host.
AAAA IPv6 Address record. An IPv6 address for a host. Current IETF recommendation for IPv6 forward-mapped zones.
A6 Experimental. Forward mapping of IPv6 addresses. An IP address for a host within the zone.
AFSDB Location of AFS servers. Experimental – special apps only.
CNAME Canonical Name. An alias name for a host.
DNAME Experimental. Delegation of reverse addresses (primarily IPv6).
DNSKEY DNSSEC.bis. DNS public key RR.
DS DNSSEC.bis. Delegated Signer RR.
HINFO Host Information – optional text data about a host.
ISDN ISDN address. Experimental = special applications only.
KEY Public key associated with a DNS name.
LOC Stores GPS data. Experimental – widely used.
MX Mail Exchanger. A preference value and the host name for a mail server/exchanger that will service this zone. RFC 974 defines valid names.
NAPTR Naming Authority Pointer Record. Gross misnomer. General purpose definition of rule set to be used by applications e.g. VoIP
NS Name Server. Defines the authoritative name server(s) for the domain (defined by the SOA record) or the subdomain.
NSEC DNSSEC.bis. Next Secure record. Ssed to provide proof of non-existence of a name.
NXT Domain record type. Obsolete use NSEC.
PTR IP address (IPv4 or IPv6) to host. Used in reverse maps.
RP Information about responsible person. Experimental – special apps only.
RRSIG DNSSEC.bis. Signed RRset.
RT Through-route binding. Experimental – special apps only.
SIG DNSSEC. Obsolete use RRSIG. SIG(0) is used as a special meta RR in DDNS and zone transfer security.
SOA Start of Authority. Defines the zone name, an e-mail contact and various time and refresh values applicable to the zone.
SPF Sender Policy Framework (v1). Defines the servers which are authorized to send mail for a domain. Its primary function is to prevent identity theft by spammers.
SRV Defines services available in the zone, for example, ldap, http etc..
TXT Text information associated with a name. The SPF record should be defined using a TXT record and may (as of April 2006) be defined using an SPF RR. DKIM (RFC 4871 also makes use of the TXT RR for authenticaing email. How to define DKIM/ADSP RRs.
WKS Well Known Services. Deprecated in favour of SRV.
X25 X.25 address. Experimental – special apps only.
[/code]
Search within Codexpedia
Search the entire web