cancel
Showing results for 
Search instead for 
Did you mean: 

How does a Browser find a Website?

Strat
Community Veteran
Posts: 31,320
Thanks: 1,609
Fixes: 565
Registered: ‎14-04-2007

How does a Browser find a Website?

I'm talking here about hosting companies that have hundreds of servers in a building with multiple sites on each server.
A request for a particular site arrives at the building.
What happens from there on in?
It's puzzled me for some time but never got round to asking and there is a specific reason for asking now.
Windows 10 Firefox 109.0 (64-bit)
To argue with someone who has renounced the use of reason is like administering medicine to the dead - Thomas Paine
8 REPLIES 8
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: How does a Browser find a Website?

In simple terms...
1) You enter www.plus.net in your address bar are click go
2) Your browsers sends www.plus.net to a DNS server (which has a table of domain names and IP addresses) and the DNS server returns an IP address of a web server where the website resides
3) The browsers establishes a http connection to the IP address given and passes the domain name to the web server.
4) The web server has a table which defines what websites it hosts and what local directory it uses in its disk sub-system.
5) If the domain name matches one it knows it hosts, it returns the default web page of that website to the browser or the web page within the website you request.
6) The browser shows the page, finds any links to pictures etc and sends back multiple requests to the same IP address for the images etc which the web server returns.
The same thing happens each time you click a link.
Its DNS (Domain Name Server) which controls where things are. Every website resolves to an IP address where a web server is listening for connection requests. From there the URL determins what the web server returns.
Strat
Community Veteran
Posts: 31,320
Thanks: 1,609
Fixes: 565
Registered: ‎14-04-2007

Re: How does a Browser find a Website?

Thanks Peter.
So each of those servers in the building has it's own public IP or do they all have private IPs and use NAT at the building's perimeter.
Windows 10 Firefox 109.0 (64-bit)
To argue with someone who has renounced the use of reason is like administering medicine to the dead - Thomas Paine
zubel
Community Veteran
Posts: 3,793
Thanks: 4
Registered: ‎08-06-2007

Re: How does a Browser find a Website?

In almost all circumstances each server will have (at least) one public IP.
B.
Strat
Community Veteran
Posts: 31,320
Thanks: 1,609
Fixes: 565
Registered: ‎14-04-2007

Re: How does a Browser find a Website?

Thanks guys.
The DNS system I understand. What was arousing my curiosity was the bit where there are many sites hosted at one location.
Your collective answers have satisfied my curiosity.
It's an amazing system when you start to think about it Shocked
Thanks
Dick
Windows 10 Firefox 109.0 (64-bit)
To argue with someone who has renounced the use of reason is like administering medicine to the dead - Thomas Paine
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: How does a Browser find a Website?

Not quite.... Things may get complicated....
Most major web hosting companies have multiple public IPs which terminate at a internet facing router / load balancer. From there the router/load balancer will direct the connection to an internal web server or other load balancer which would be on an internal IP address.
Also websites can have multiple public IP addresses - just do an nslookup of www.microsoft.com.
So you can have a single IP going to multiple internal web servers serving one or many websites each. Or multiple IPs going to a single or multiple webservers serving one or many websites.
Often webserver farms are connected to single or multiple disk farms containing the web pages.
So yes, they would use a NAT like set-up but not in the way your router does.

Strat
Community Veteran
Posts: 31,320
Thanks: 1,609
Fixes: 565
Registered: ‎14-04-2007

Re: How does a Browser find a Website?

Things are never as simple as they first appear. Smiley
Thanks
Windows 10 Firefox 109.0 (64-bit)
To argue with someone who has renounced the use of reason is like administering medicine to the dead - Thomas Paine
samuria
Grafter
Posts: 1,581
Thanks: 3
Registered: ‎13-04-2007

Re: How does a Browser find a Website?

Also when you request a page from DNS it may not know were the page is but it knows who owns the host so it then has to pass your request onto another local dns server.
So if you ask for microsoft.visualbasic.com then the dns wont know were visualbasic is but it knows from the host name that its controlled by MS so it passes you request to MS who hopefully then knows were to find visualbasic within its own domain.
Another problem is that xp caches dns requests so when you ask for MS if you had been there before it wouldnt send out to a dns server it would look at its cache find it and off you go.
It could again not go to dns if you have the site in your host file it would look there first. You can speed up you connection a lot if you visit the same sites a lot by putting them in the host file so the pc doesnt have to go to the dns all the time
notheruser
Grafter
Posts: 139
Registered: ‎08-01-2008

Re: How does a Browser find a Website?

samuria - your explanation is almost right, but not completly. In your example, your local dns would not know that the website was controlled by microsoft, because URL's are resolved from right to left. Local dns would have to go to the .com dns servers which ought to be able to resolve the query for visualbasic.com. This would point to another dns server which would then resolve microsoft.visualbasic.com. If you had written visualbasic.microsoft.com then your explanation would have been correct.
Putting web sites in the host file is not a good idea! DNS entries can and do change - the company I work for has changed several times. (Usually this is because the person in question hosts their own site, and has moved ISP). If you put entries in your hosts files you may get no site at all, or an old version of a web site. It will contribute virtually nothing to speed improvements - once the first dns query is made, your PC will hold the response in its cache, so subsequent queries do not need to query again. In any case, DNS queries are very small transactions and happen quickly, so compared to the time for a page to download, they are not much of an overhead.