Hello, I'm going through the DevOps Pre-Requisite Course and I'm in the DNS sect . . .

Shasten Marshall:
Hello, I’m going through the DevOps Pre-Requisite Course and I’m in the DNS section under the Networking Basics section. I have a technical question that I can’t really figure out. I think the delivery was very well done and I understand 99% of it but there is just one doubt that I have about setting up the DNS server. There’s a part where you can set the /etc/hosts file to call an alias such as db, and then those get transferred with the nameserver command in the /etc/resolv.conf file. My question is how exactly are they transferred if there is nothing in the /etc/hosts file? For example, I want my network to recognize the alias “db”, how do I do that specifically? That’s was the only unclear part in the video. I’m sorry if this is the wrong place for this, but I didn’t see any other channel for this. Any help would be very appreciated.

Javid Salmanov:
Hi,
Let me ask the question if i understood your issue. There is nothing in /etc/hosts and you would like to know how to add alias there?

Shasten Marshall:
Thanks for getting back to me. Not quite. So, in the video, he first shows how to set the alias in the /etc/hosts file as a demonstration of how things used to be done. Then, he says that the /etc/hosts entries are no longer necessary when you make a nameserver entry in the /etc/resolv.conf file. This sets up the DNS server. My question is if I want that alias used in the DNS server, how do I do that or where would the aliases be determined for each ip address? I just need a little elaboration on that because that part wasn’t clear to me.

Javid Salmanov:
It means that you have dns server to resolve the IPs’ domain name. You have to add the A record in dns server for the db server.

Shasten Marshall:
OK, and where do I add the A record? /etc/resolv.conf or somewhere else?

Javid Salmanov:
https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/#:~:text=What%20is%20a%20DNS%20A,210.9|https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/#:~:text=What%20is%20a%20DNS%20A,210.9.

Javid Salmanov:
No, DNS should be up and running as a separate service.

Javid Salmanov:
https://www.cloudflare.com/learning/dns/what-is-a-dns-server/|https://www.cloudflare.com/learning/dns/what-is-a-dns-server/

Javid Salmanov:
Did it help you?

Shasten Marshall:
A little. I am still a little lost. I’m not sure how to set the A record for the db server though.

Javid Salmanov:
Okay, do you have a dns sever?

Shasten Marshall:
Yes. I do.

Javid Salmanov:
Can you add an A record?

Javid Salmanov:
And all your servers should point to this dns server.

Shasten Marshall:
I got that part

Shasten Marshall:
Give me a second. I might have figured this out.

Shasten Marshall:
Alright, I think I got it figured out. Thank you so much for your help @Javid Salmanov, I really appreciate it.