How do a domain name and website connect?
I was discussing this with my children yesterday that I had to change a credit card because a domain name was renewing and we got into discussing all the parts of how a website works. Realized a lot of people (at least aged 6-9,) don’t have a great grasp on how things work, you do so you don’t need to read this, but here’s a quick rundown.
Domain names, the actual text name like “pocketables.com” or “google.com” are handled by Domain Registrars. You’ve probably heard of Tucows, Google Domains, ICAAN, etc…
All a domain name registrar does (in this scenario) is take your $12 bucks and say you’re the owner of this domain for the next year. Where should we point the nameservers at?
While a domain registrar can host nameservers and DNS, this is a separate thing… most host the nameservers now, but they don’t really have to.
Nameservers are not DNS servers. (but can be)
Nameservers point to DNS servers.
A nameserver is sort of like a phone book (you’ll need to Google what one of those is kids,) in that it looks up where the DNS server is. Basically the name server that the domain points to will provide DNS server information for someone out there.
DNS stands for Domain Name System. The DNS server contains information about the contents of the domain. It tells the world where mail goes, where the www goes when you click it, and can contain special information such as text records that prevent spammers from impersonating you.
The DNS server contains several entries, but the most common are address records, and mail exchanger records.
The above picture is from a tool called NSLOOKUP which is installed on every Windows machine I’ve ever seen. Start, run, nslookup. Go ahead and try it, you can’t hurt anything.
The A records (address) and AAAA (ipv6 address) are the IP addresses that Pocketables responds at. In this case, I’ll save you the trouble, that’s over on a service called Cloudflare. We’re not going to talk about content distro networks like Cloudflare because that’s too confusing. Let’s just say that’s where Pocketables lives (it doesn’t).
The A/AAAA records point to a web host where the Pocketables files are/where your browser needs to ask for information.
A web host usually is shared and runs several thousands websites at once. You’d be surprised how much free time these web host computers have because it takes a millisecond or 80 to do everything and then it’s just sitting idle.
Web hosts are places like SiteGround, Bluehost, as well as offered by many registrars. You can feel free to click those, I’m not getting any referral money and also not recommending anything. Pick your own, avoid putting all your eggs in one basket because when you lose your site on Big X you’re not getting it back and dealing with headaches.
Web hosts generally allow you to install management software (such as WordPress) and offer ways to put and pull content from the computer it’s sitting on. WordPress is pretty much fully featured, so no need to FTP/SFTP, know a whole lot about PHP and backends of anything.
When you sign up for a web host you’re given a login. Once logged in you deploy software (such as WordPress.) Once the software is deployed you’re given an IP address where that software lives. You place that in your DNS record, and now when people look for “pocketables.com” it comes to the web host.
Most web hosts use the same IP for several thousand web sites, but the web browser connects and asks for a specific one.
Advanced, skip this part.
When you’re developing a site, you might want to see the site before others do, or you might be waiting for the internet to catch up with the new DNS settings. You can edit a local file on your computer called hosts.txt (on Windows,) and fake your own DNS.
I only mention this because I do this quite often.
How this all relates to the browser
I enter “pocketables.com” in my browser
The browser talks to my DNS servers and asks who the name server is for pocketables.
The name servers for pocketables are given to my browser or my DNS server, and asked asks who the official in charge of DNS is?
I’m given the DNS servers for Pocketables and connect to them (I don’t know if the browser pulls this or my DNS server pulls this honestly,)
The A or AAAA records are pulled (ip4/ip6) and given to my browser
The browser connects to the IP address it wants to and requests from that server “pocketables.com”
That server does its magic and sends you a web page.
What is sent in this web page?
The server sent your browser nothing but text. In this text were HTML tags that tell your browser what to do next. If your browser sees something like “img src=cow.jpg” your browser will request a file called cow.jpg. You can google HyperText Markup Language to see what is what, but that’s how your browser starts requesting hundreds of pieces of data per web page.
Want to play with NSLOOKUP?
Mentioned above nslookup is included with everything. Run it.
- set q=ns (returns the name servers when you type the domain name)
- server x.x.x.x (go to a new DNS server)
- set q=any (returns all the info that server feels like giving without explicitly being asked)
- set q=mx (returns mail server addresses and which to try first)
Here’s an example
nslookup set q=a pocketables.com (you get back some IP addresses here) set q=mx pocketables.com (you get to see the mail server information) exit
Did I get it wrong?
Let me know, I’ll fix it.