You can run a website on an IP address like
http://192.0.2.4/. Doing so does not require a domain name. However, IP addresses are typically tied to a specific hosting company or internet service provider. If you want to move your website to a new host or ISP, your IP address will change.
Obtaining a domain name allows you to map that domain name to the current IP address of your website and to update that IP address when you change hosting. To get a domain name, you need to register one at a domain registrar. There is no way to get a domain name without going through a registrar.
Domain names have to be unique such that no to websites have the same name. This requires a central way of requesting names, registering names, and mapping names to numerical addresses. This system is the DNS system and is overseen by the "Internet Corporation for Assigned Names and Numbers" (ICANN). ICANN was created to fulfill this role by the US government in cooperation with the organizations that created the internet.
ICANN oversees a set of DNS servers known as the "root" servers. These servers are for the top level domains (TLDs) like
.org. They specify the IP addresses of the DNS servers for all the TLDs. ICANN also controls the number of top level domains and awards contracts to operate them.
Each top level domain is where registrations actually happen for individual websites. Each top level domain has its own policies for who can register a domain, with what domain registrars, and how much those domain names will cost.
Registrars are responsible for inserting records for each domain into the into the TLD servers. Those records specify the name servers used for the individual domain. So for example, to get the IP address of
example.com, all the following have to happen (although DNS caches everything so all queries don't happen every time):
- Query NS records from the root name servers for
- Query NS records from
.com's name servers for
example.com's name servers for the IP address of
It is also possible to run a website on a "third level domain" such as
my-sub-domain.example.com. Because anybody who runs a domain can in turn dole out domains underneath it, such subdomains are widely available. They can often be registered for free and with little hassle. They are often doled out in conjunction with dynamic DNS services.
There are some big disadvantages to running a website using a third level domain:
- Your rights to the name are not usually well protected compared to getting a second level domain. The name could be revoked for many reasons at the whim of the domain owner, or because the domain owner doesn't want to provide the service anymore.
- Browsers allow cookies to be set at the second level domain meaning that cookies can be shared between many sites which cat compromise security.
- Search engines take a dim view of third level domain sites. They find lots of spam on them and often penalize an entire domain with many unrelated websites under it. Search engines often give a bonus to a second level domain because paying $10 is a small sign of commitment and quality.