How does the internet work?

What happens under the hood when you type www.facebook.com in your browser?

Posted by Sheia Anandaraj on September 07, 2020 · 3 mins read

The internet is a large network of interconnected routers. The routers are connected through cables, wifi, satellite and even undersea cables (see this video to see the astonishing network of undersea cables).

The internet is governed by protocols, which are conventions that machines use to communicate with each other.

DHCP (Dynamic Host Configuration Protocol) is the protocol used to assign IP addresses to devices. The first time a device is connected to the internet, it connects to other computers around it and asks to be assigned an IP (Internet Protocol) addresses. Each device is then assigned a unique address in the form of #.#.#.# where each # represents a number between 0 and 255.

When a computer sends a request to a server, it uses its own IP address to say where the request came from. DHCP also gives the computer the IP address of the nearby DNS server from where the computer can get the IP address of any destination domain name.

DNS (Domain Name System) converts domain names to IP addresses and vice versa. When a user enters a domain name say www.facebook.com, the device will contact a nearby DNS server and ask for the IP address for this domain. The DNS server returns the IP address for the requested domain. The device then sends a request to this IP address via the internet.

The internet is a large network of interconnected routers. Redundancies are purposely built-in so as to avoid any single point of failure. Upon receiving a request, a router or gateway passes it on to another router, sending the request nearer to the destination each time.

TCP (Transmission Control Protocol) is the protocol that guarantees delivery (with high probability). It mandates that if any packet of data is not received at the destination, it should be resent. TCP also distinguishing the type of information such as HTTP, email, chat, etc. So while sending the request the sender should mention the TCP Port number in the request so that upon receiving the request the receiver knows the type of service being requested.

UDP (User Datagram Protocol) is a protocol that says that if any packet is lost in transit, it should not be re-transmitted. Such a protocol would be useful in live streaming or video conference, where it would be preferred to stay real-time rather than waiting for the retransmission of lost packets.

HTTP (hypertext transfer protocol)/HTTPS (hypertext transfer protocol secure) is the protocol that governs what type of messages goes inside the packets of data and how the messages should be formatted when communicating between the web browser and server.

The response from the Facebook server would be an HTML message which will tell the web browser what to display and the format in which to display the content. Upon receiving this response from the Facebook server, the web browser will display your newsfeed.


Reference: CS50’s Computer Science for Business Professionals