{{tag>projects cloud club computing virtualization machines VMs AWS Azure GCP}}
[[cloud_club|About the Club]]
==== Cloud Club Topics - Domain Name Servers ( DNS ) ====
==== Name servers ====
- Creating servers is great and memorizing IP addresses on a small network is OK. But, names are a lot easier to remember than IP address, especially on a large netowrk ( eg. the internet ).
- The original way to name servers is to use a file ( /etc/hosts )
==== Hands-On naming servers ====
- Edit the /etc/hosts file on your server(s). It should look like the following
27.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
- Add the following content at the bottom - ( replace the webserver IPs and names + the LB IP and name )
.cloudclub.edu
.cloudclub.edu
.cloudclub.edu
- View the websites with curl
curl http://.cloudclub.edu/
curl http://.cloudclub.edu/
curl http://.cloudclub.edu/
==== Understanding DNS ====
- DNS is the Domain Name System
- Examples of DNS software:
^ Name ^ Supported OS ^
| Bind 9 | Linux, Windows Server 2012+, Windows 10+ |
| DNSmasq | Linux, Mac |
==== Hands-on installing a DNS server ====
- Create a Rocky Linux server ( if you don't already have one )
- Assign an IP address from your range
- Install bind9 ( dns server software )
sudo dnf install bind bind-utils -y
sudo systemctl enable --now bind
==== Hands-on configure a DNS server ====
- Edit the config file ( /etc/named.conf )
- Configure main options
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
directory "/var/named";
...
allow-query { any; };
};
- Define you domain
zone "cloudclub.edu" {
type master;
file "/var/named/cloudclub.edu.db";
};
- Create the directory if it doesn't already exist ( it does on our server )
sudo mkdir -p /var/named
- Create the zone file ( /var/named/cloudclub.edu.db )
$ttl 38400
cloudclub.edu. IN SOA dns.cloudclub.edu. admin.cloudclub.edu. (
1611368586
10800
3600
604800
38400 )
cloudclub.edu. IN NS dns.cloudclub.edu.
dns.cloudclub.edu. IN A 192.168.1.11
repo.cloudclub.edu. IN A 192.168.1.11
- Enable/start bind service
sudo sytemctl enable --now named
- Check your configuration doesn't have errors
sudo named-checkconf /etc/named.conf
- Check that you get a result from a basic query of your domain
sudo dig @localhost cloudclub.edu
- Open the DNS port/service in the firewall
sudo firewall-cmd --permanent --add-service=dns
sudo firewall-cmd --reload
- Test query your DNS server for one of the addresses you added
dig @192.168.1.11 repo.cloudclub.edu
; <<>> DiG 9.16.23-RH <<>> repo.cloudclub.edu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 394
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 81331712b590bb610100000068085e3f33d592afa55f8a0c (good)
;; QUESTION SECTION:
;repo.cloudclub.edu. IN A
;; ANSWER SECTION:
repo.cloudclub.edu. 38400 IN A 192.168.1.11
;; Query time: 2 msec
;; SERVER: 192.168.1.11#53(192.168.1.11)
;; WHEN: Tue Apr 22 20:27:59 PDT 2025
;; MSG SIZE rcvd: 91
- Request the short result with **__only__** the answer
dig +short @192.168.1.11 repo.cloudclub.edu
192.168.1.11