From the moment a user types a domain in his browser, a series of internal requests are executed that end up translating the domain name into an IP address, which is the address of the server that hosts the web page.
To have an IP address, internally a query is made to a DNS server, which contains the domain information. So, the first step is to identify the DNS servers of the domain. Once the server that has the correct information has been identified, the IP address of the web server is queried directly.
Once the IP address has been 'resolved', the server is asked ('HTTP' or 'HTTPS' request) and it responds with the content of the web page.
The Hostnames assigned to the domain (also called Nameservers or Name Servers): this is nothing more than the name of one (or more) DNS server in charge of transforming the queried domain into IP.
Two or more servers will have the information, with which the computer of the user who wants to enter 'swhosting.com', will locate the domain in question. There must be at least two records (i.e. two servers): the primary or 'Master' and the secondary or 'Slave'. The primary is the one that houses all the information of the location of the files of the server and the secondary is the one that replicates the information of the primary server.
From the panel in charge of managing our domain, as SWPanel, we can modify at any time the Hostnames of our domain so that these, point to a different DNS server (for example, in case of changing server).
To modify the Hostnames of your domain in SWPanel, access the menu 'Domains and Certificates' > 'Domain Portfolio' > menu '···' of the corresponding domain > 'DNS Data'.
The Whois of a domain: it is possible to consult the Hostnames assigned to any domain by means of a WHOIS query, for example, on the ICANN website (organization in charge of the assignment of names and numbers):
https://whois.icann.org/en (from the result, see section "Name Servers").
On Linux you can perform this query from the terminal itself (from the result, see section "Name Server"):
Do not confuse the Hostnames/NS records assigned to your domain (the ones that appear in the Whois query) with the NS records of the DNS server. Although they must be the same, they do not have the same function.
The DNS resolution: Once we know the Hostname (DNS server) of the domain we will be able to consult (or 'resolve') any information about the domain. The requests can be from the A record or the 'www' record (associated to a web page), the MX record (associated to mail), SPF (associated to mail sending), ...
The A record of the domain, which provides the IP where the domain is hosted.
The CNAME record (Canonical Name), which identifies aliases or subdomains equivalent to a domain. For example, 'swhosting.com' is equal to 'www.swhosting.com', the CNAME being 'www'.
At DNS server level, there are also NS records (Hostnames) with the purpose of informing which is the authoritative server for the domain, but this record does not determine to whom the query is made, but, as we have seen previously, it will be the Hostname assigned to the domain that determines it.
The TXT records, allow you to add the text you want to the DNS zone and allow you to set the SPF, DKIM and DMARC records that we will explain below.
There are other DNS records such as the MX record (Mail Exchanger), in charge of defining which is the email server for the domain. There can be several MX records, depending on priorities.
In relation to email, there are a number of records designed to increase email security, either to certify that the sender is who he claims to be or to limit the spread of SPAM:
Some of the most important email providers (such as Gmail) require the presence of these rules to exchange email with them.
In summary, "Hostnames" and "DNS" are the mechanism for translating domain names into a set of numbers that form the IP address of the computer or server.