Hi, Welcome to The TechWeirdo, I am Shounak. And welcome to the part 2. In the part one I talked a lot about special computers I mean servers, and how they work. Now let's talk about the next part, i.e. how the data (i.e. website/video) reach form that server to you device. Buckle up for an interesting journey.
A three part post about Basics of Webhosting:
IP Address, Domain and DNS
If you are new, it may sound complex, but you deal with this every day. The website address you types in the browser i.e. youtube.com
or techweirdo.net
these are domain names. And remember one large Facebook outage (2021) - It was DNS. And you must be familiar with these things, even if you are getting a managed hosting solution, you yourself need to manages this part.
IP address ( Home address but for the internet)
The best way to describe ip address is like your mobile number or your home address. Every device that connects to the internet must get an IP address. You mobile device have an IP address, the server serving the website has an IP address. And when you ask a server to get a data your device sends that request to the ip address of the server.
And you will see you have 2 address one is numericals like 123.45.67.89 which is IPV4 and one like "f4t:939:sji....... " which is IpV6. Like wise your server will also have an IpV4 address. The difference is, your phones IP changes always it is dynamic, but servers usually have a static IP, which won't change (mostly). And all the devices talk to each other using this IP address.
Now, in many instances, you may not get an IpV4 address anymore, especially for services where many sites share same resources (managed hostings, edge/serverless hosting etc), you will get something called CNAME (more on them later) which essentially resolves to ip addresses later on.
So basically the point is when you will host a website or get a vps, you will get a static IP address (process depends on the cloud providers). And you need the IP later on. What you need to keep in mind is it is better to get an IPV4 address, and it is much better if you can reserve the IP address (so that you can assign it to different vm later). But keep in mind, although most operators give ipv4 for free, AWS charges for IpV4, GCP charges IpV4 but not on free tier. Keep that charge in mind.
Ports (The windows of your house)
Ports are an essential part of your server setup, they are like windows but virtually defined by the server's operating system. Your server runs apps or services, but the incoming requests does not know which app(services) it needs to go to. Different requests are for different kind of traffics, like some may be web traffic, some may be ping or some SSH. To remove that confusion the os assigns different ports to different services.
For example http traffic usually goes to port 80 or https goes to 443. DNS runs on port 53 and ssh on port 22. So for a webserver you must open port 80 and 443 to receive https traffic. But if your app runs on different port for example Ghost runs on 2368, or Uptime Kuma on 3001 (you can change those) then for those services you need to open those ports in your server firewall. The process depends vendor to vendor, but everywhere you will find those documentations.
So to sum up, your server has an IP address, and some open ports your users have connect to that IP and port. The port side things will be taken care of the webservers and reverse proxies (not a topic for this post). For now the users need to get the IP address.
Domain Names (Your Identify)
Domain name is your unique identity on the internet. Everything on the web i.e. your reputation, links, everything. facebook.com
twitter.com
youtube.com
techweirdo.net
are all domain names. You go to Facebook by not going to 157.240.1.35
which is Facebook's IP address, you go to facebook.com.
Guide to get a good domain
You need your domain name to be meaningful to your use, at the end it should make sesense. But before that let's talk about parts of a domain. It has a name and a tld and a subdomain.
TLDs
It is the last part of your domain, like those .com
.net
.org
etc. ".com
" is the King of tlds as it is most recognisable but, increasingly it is becoming unavailable day by day. Finding even a good .com
domain at registration price is almost impossible now a days. The thing is the other tlds are gaining popularity and you can go for for your specific purposes. For example for a internet site you may get .net
or for ai sites .ai
is very popular. For a blog you may like .blog
the choice is yours.
gTLDs and ccTlds
All tlds are not same, some tlds are considered global tld, so Google thinks they are for global audience, and some are ccTLds i.e. country code tlds like .in
or .uk
or .us
. These are optimised for country specific. But some ccTlds are considered country tlds too like .ai
.io
.tv
.me
. These tlds are ccTLDs but Google consideres them as gTLDs for their popularity.
Domain Name
This is the body of the domain i.e the twitter
or techweirdo
part. This part represents your brand name. And how people will know you. So make it relevant, make an impression that lasts long.
Guide to Choose a Domain Name
Before you buy a domain, please consider these things:
- Easy to remember
- Easy to type (avoide
-
_
) - Short is better but not for SEO reasons, consider relevance of the name over domain length.
- Go for gTLDs and prefer
.com
over anything else. But if it is not available don't be shy in getting a fancy tld. They work just fine.
Subdomains
Well subdomains are seperate domains under your main domain. You can do seperate things with them, for example www.techweirdo.net serves this website. Where www
is the subdomain. But cdn.techweirdo.net serves all the static files on this site, (right click on any image and open it in new tab). You can host a completely different thing like let's say email.techweirdo.net may host an email server, news.tecnwirdo.net may host a news site like that. These suubdomains are not connected to your main domain aka root domain ( only techweirdo.net
part). Just remember Google also considers different subdomains as different sites. So they are not interconnected except www subdomain.
How to and Where to buy a domain
Buying a domain is easy if you keep these three things in mind. You lease the domain and as long as you pay (recurring yearly) it is yours. So you will buy the domain for the first year which is registration fees, and then you will pay every year to keep it, which is renewal charges. In an ideal world registration fees and renewal fees are same ( 10 dollars per year for a .com
domain).
The companies where you can register a domain name are called domain registrars. You may know GoDaddy or Namecheap etc as domain registrars from their extensive marketing. Your hosting providers like Wix, Squarespace, hostinger also have domain registrations, but they play a trick to squeeze sweet money out of your pocket.
You see, from them you get a domain name for free for the first year or for 1 USD for the first year, great. But after that first year, for the rest of your life (as long as you hold the domain) you will be paying them almost double the normal registration fees. Also you will be charged exorbitant extra for whois privacy protection (to hide you name, phone, and home address from public registry). So I recommend to buy domain name only from these two providers for now (no they are NOT sponsored) I use them personally.
Cloudflare or Porkbun
But why? Well Cloudflare charges you the exact amount it costs them to register the domain and that too for renewal. So you will get the cheapest price at Cloudflare. Porkbun usually charges about 50 cents more than Cloudflare because that is their business model. You get Whois privacy protection, SSL, DNSSEC for free from both of them. It is just plain simple. Porkbun has more list of tlds available than Cloudflare. There is one drawback for Cloudflare though. You are locked into using there nameserver and DNS, which is not an issue 99.999% of the time, I recommend everyone to use Cloudflare for DNS management and add their domain to Cloudflare as the first thing after you buy a domain name from any provider of your choice. Here is my guide to to do that.
DNS (the contact list of internet)
Well, I hope you are still with me. Now we have an IP address of the server and a domain name. Your visitor visits your domain name but in the background, your server connects to user with IP address. Well it is just like you phone dilar. You search and call your friend searching there name, but in reality it connects to your friends mobile number. And the contact list saves the number against the name.
DNS or domain name system also saves the domain name and the ip address and when someone visits your domain name, the service sends the ip address associated with that domain name to the user. You can check easily the associated ip address for any domain names in this tool: NSlookup - by TechWeirdo (go here, and click on nslookup. Insert any domain name, like youtube.com
or techweirdo.net
and you will get the IP address.
Now, what do you need to do? Well you need to attach the domain name you just bought. There are multiple types of DNS records, to A , AAAA , CNAME , TXT , MX etc to name a few. To attach a IpV4 address use A records. To attach a Ip address to the root domain use @ and the ip, for subdomains just use the subdomain name and the IP address. Usually when you will need to attach some domain record, you will get the instruction at that time.
I forgot to mention where, your domain registrar will offer this DNS service. But I would always (almost every time) want you to add your domain to Cloudflare and use there DNS service instead, it is free, fastest, reliable, and highly praised. Some other options can be NS1 by IBM, Gcore DNS, Bunny DNS, they offers more advanced features which in most of the time, you will never need.
I myself prefer to buy domains at Porkbun and add the domain to Cloudflare.
And the nameservers provided by Cloudflare or your domain registrars are known as Authoritative Name servers. I would love to tell you more, but this part is already too lengthy, and this Wikipedia page is detailed enough.
Domain name Best Practices
Now that you have pointed your domain name to your IP address. I want you to check a few things regarding that domain names.
- Please verify that you have auto renewal turned ON at your registrar. You don't wanna loose your domain (it is painful)
- Please verify you have readated your personal information and turned on Whois privacy at the registrar.
- Find DNSSEC settings at your registrar and turn it on. Every registrar have their own guide. You should just do it. But If you want to know what DNSSEC is here is a very technical article.
- Add your domain to Cloudflare. (optional but highly recommended)
- Ideally if you use cloudflare you should proxy the site through cloudflare if possible, to protect your original Server IP address.
I hope this post helps you in your early days of webhosting. I am trying to explain this things form a first time user's perspective. I hope, today's concept of DNS, IP address and Domains was easy to understand. If you give me any feedback commenting down below, it will be a great help. In the first part I explained servers, vps and Webhostings and in this part I explained how your user ultimately connects to your server from a domain name, but this is how 2000's internet worked. In the next part I will discuss about relatively mordern things like CDN, CMS, Control Panel backup and security to complete the topic of basics of webhostings.