DNS or Domain Name System can be defined as: translating a host name or URL to an IP address. For example, if we type domainanda.com in a browser, the DNS server translates the domain name to the corresponding IP address. Since IP addresses are hard to remember all the time, DNS servers are used to translate hostnames like domainanda.com to 121.xxx.xx.xxx (the IP the server has). Remembering the domain name is easier than having to remember the IP address.
Here are the steps you can follow to configure DNS on CentOS 7:
1. Please login to the SSH server that you have, you can use the putty application or the SSH remote application that you usually use.
2. Install bind9 on your server with the following command:
yum install bind-utils -y |
3. After installing bind9, please edit the /etc/named.conf file.
Warning: before editing the /etc/named.conf file, you should backup the original /etc/named.conf file by running the :
cp /etc/named.conf /etc/named.conf-backup |
Next, after backing up, please edit the /etc/named.conf file by running the command:
vi /etc/named.conf |
Add the script as shown in the red config:
[root@server ~]# vi /etc/named.conf dump-file “/var/named/data/cache_dump.db”; /* dnssec-enable yes; /* Path to ISC DLV key */ managed-keys-directory “/var/named/dynamic”; pid-file “/run/named/named.pid”; logging { zone “.” IN { zone “domainanda.com” IN { include “/etc/named.rfc1912.zones”; |
4. Create a DNS ZONE file
Adding DNS ZONE files please do so in the /var/named/ directory, the step to do the addition please run the :
vi /var/named/domainanda.ca |
then add the script:
$ORIGIN domainanda.com. IN NS ns1.domainanda.com. |
Note: This step is an example with the domainanda.ca file name according to the addition of the script in step 2 and for the IP, please change it according to the server IP you have.
4. If you have finished creating DNS ZONE please do the command:
systemctl enable named systemctl start named |
5. If the stages of points 1-4 have been done, just set the domain pointing to the server ip and please wait for it to be resolved between 1x24 hours.