What is DNS?
Domain Name Service (DNS) is an Internet service that maps IP addresses and fully qualified domain names (FQDN) to one another. It allows us to resolve human-friendly names to unique addresses. Computers that run DNS are called name servers. The most common program used for maintaining a name server on Linux is BIND.
What is DOMAIN NAME
A domain name is a human-friendly name that we are used to associating with an internet resource. For instance, “google.com” is a domain name. Some people will say that the “google” portion is the domain, but we can generally refer to the combined form as the domain name.
The domain name system allows us to reach the Google servers when we type “google.com” into our browsers.
IP ADDRESS
An IP address is what we call a network addressable location. Each IP address must be unique within its network. IPv4, the most common form of addresses, are written as four sets of numbers, each set having up to three digits, with each set separated by a dot. For example, “111.222.111.222” could be a valid IPv4 IP address. With DNS, we map a name to that address so that you do not have to remember a complicated set of numbers for each place you wish to visit on a network.
Top-Level Domain
A top-level domain, or TLD, is the most general part of the domain. The top-level domain is the furthest portion to the right (as separated by a dot). Common top-level domains are “com”, “net”, “org”, “gov”, “Edu”, and “io”.
SubDomain
DNS works in a hierarchy. TLDs can have many domains under them. For instance, the “com” TLD has both “google.com” and “e2enetworks.com” underneath it. A “subdomain” refers to any domain that is part of a larger domain. In this case, “e2enetworks.com” can be said to be a subdomain of “com”. This is typically just called the domain or the “e2enetworks” portion is called an SLD, which means second-level domain.
Fully Qualified Domain Name
A fully qualified domain name, often called FQDN, is what we call an absolute domain name. Domains in the DNS system can be given relative to one another. A proper FQDN ends with a dot, indicating the root of the DNS hierarchy. An example of an FQDN is “mail.google.com.”.
NameServer
A name server is a computer designated to translate domain names into IP addresses. These servers do most of the work in the DNS system. Since the total number of domain translations is too much for anyone server, each server may redirect requests to other name servers or delegate responsibility for a subset of subdomains they are responsible for.
Zone Files
A Domain Name System (DNS) zone file is a text file that describes a DNS Zone. A DNS zone is a subset, often a single domain, of the hierarchical domain name structure of the DNS. The zone file contains mappings between a domain name and IP addresses and other resources, organized in the form of text representations of resource record (RR). A zone file may be either a DNS master file, authoritatively describing a zone.
There are mainly two types of zone files:
- Forward Zone file
- Reverse Zone file
PATH Of These Files: /var/named/
We can configure these zone files here.
Record Types
Within the zone file, we can have many different record types. We will go over some of the more common types here.
SOA Records
The Start of Authority, or SOA, the record is a mandatory record in all zone files. The start of authority record looks something like this:
@ IN SOA ns1.domain.com. admin.domain.com. (
12083 ; serial number
3h ; refresh interval
30m ; retry interval
3w ; expiry period
1h ; negative TTL
)
Let’s Explain each part :
- IN SOA: The “IN” portion means the internet (and will be present in many records). The SOA is the indicator that this is a Start of Authority record.
- Ns1.domain.com. : This is the primary name server for this domain.
- Admin.domain.com. : This is the email address of the administrator for this zone.
- 12083: This is the serial number for the zone file. Every time you edit the zone file you should increase the serial no.
- 3h: This is the refresh interval for this zone.
- 30m: This is the retry interval for this zone.
- 3w: This is the expiry period.
- 1h: This is the amount of time that the name server will cache a name error if it cannot find the requested name in this file.
A and AAAA Records
Both of these records map a host to an IP address. The "A” record is used to map a host to an IPv4 IP address, while “AAAA” records are used to map a host to an IPv6 address.
The general format of these records is this:
Host IN A IPv4_address
Host IN AAAA IPv6_address
The record could look something like this:
ns1.domain.com. IN A 111.222.111.222
CNAME Records
CNAME records define an alias for a canonical name for your server (one defined by an A or AAAA record). For instance, we could have an A name record defining the “server1” host and then use the “www” as an alias for this host:
server1 IN A 111.111.111.111
www IN CNAME server1
Mx Records
MX records are used to define the mail exchanges that are used for the domain. This helps email messages arrive at your mail server correctly.
Unlike many other record types, mail records generally don’t map a host to something, because they apply to the entire zone.
IN MX 10 mail.domain.com.
The MX record should generally point to a host defined by an A or AAAA record
So, let’s say that we have two mail servers. There would have to be records that look something like this:
IN MX 10 mail1.domain.com.
IN MX 50 mail2.domain.com.
mail1 IN A 111.111.111.111
mail2 IN A 222.222.222.222
NS Records
You should have at least two name servers defined in each zone file in order to operate correctly if there is a problem with one server. Most DNS server software considers a zone file to be invalid if there is only a single name server.
IN NS ns1.domain.com.
IN NS ns2.domain.com.
ns1 IN A 111.222.111.111
ns2 IN A 123.211.111.233
PTR Records
The PTR record is used in the reverse zone file. The PTR records are used to define a name associated with an IP address. PTR records are the inverse of an A or AAAA record. PTR records are unique in that they begin at the .arpa root and are delegated to the owners of the IP addresses.
Here is an example of a PTR record for 111.222.333.444 would look like:
444.333.222.111.in-addr.arpa. 33692 IN PTR host.example.com.
Further help please follow the link
Start using our Compute Intensive cloud servers here