Imagine for a moment that the internet is like a giant, global postal system. Each website you visit or email you send is akin to sending a letter or package to a specific address.
- Writing the Address:When you type in a URL (like www.example.com) into your web browser or send an email, it’s like writing an address on an envelope. Just like how a postal service needs to know the address to deliver your letter correctly, the computer needs to know the IP address (Internet Protocol) of the website or email server to deliver your request or message.
- The Postal Office:Your Internet Service Provider (ISP) acts like the local post office. When you click “send” or hit “enter” after typing a URL, your computer sends the request to your ISP. Your ISP then examines the IP address of the request and determines the best route for it to take to reach its destination quickly and efficiently.
- The Mail Route:The request then begins its journey, hopping from one router to another, similar to how a letter may travel from one sorting facility to another within the postal system. The internet’s network of routers, much like a system of interlinked postal offices, work together to ensure the request reaches the right destination.
- Reaching the Destination:When the request finally reaches its destination server (equivalent to the recipient’s local post office), it’s like the letter arriving at the recipient’s house. The server reads the request, prepares the requested information or acknowledges the received message, and sends a response back.
- Return Journey:The response, which could be the web page you wanted to load or a confirmation that your email has been received, then makes the journey back to your computer following the same postal route. Your ISP delivers this response to your computer, and the web page loads on your browser, or the confirmation of email delivery pops up.
How Internet Actually Works?
Internet is a computer network consisting of all the computers in the world which are interconnected to each other by way of certain protocols. A protocol is a set of rules defining the way in which data is stored or transmitted.
First of all, we need to understand what a data packet is. A packet is a unit of data which travels over a network. When you provide data to the computer to be sent over a network, the data cannot be sent all at once. Therefore the data is fragmented or broken down into packets by the concerned protocol and then those packets are transmitted over the network. A packet usually contains the following:
- actual data
- details of sender
- details of receiver
- any other options related to the transmission of data (e.g. how fast/slow the data needs to be sent, etc)
These ingredients except the actual data is bundled together into what is usually called “header”. Different kinds of packets have different kinds of details in their header and handle data in different ways.
Now, to understand how the internet works, we need to know about a few protocols as follows.
Transmission Control Protocol (TCP)
TCP is a connection oriented protocol which helps two devices to communicate over a network. Here “Connection oriented” means that there is a proper connection between the two devices to help us have reliable connection over an unreliable network. For TCP, a connection between the two devices is required.
TCP works by ensuring the establishment of a reliable connection between the two devices. Once this connection is established, the actual data transfer is done. This data is transferred by fragmenting the data into small packets and then sending those packets over the network using TCP. The packets are reassembled into original data at the receiver end. TCP also ensures that the data is error-free and re-transmits the data if there has been some error in transmission. TCP also ensures that the destination is not overwhelmed by the data sent from receiver by limiting the amount of data that is sent to the destination.
When the transfer is done, the connection is properly closed as per the specifications of the protocol.
PORTS: This TCP connection is done between Device A and Device B by using something called “ports” or “internet sockets”. The usability of port can be understood by an analogy to the ports used by ships. When something needs to be sent via ships, the material will need to be sent via ports. Thus a ship starts from a particular port and reaches its destination port. Similarly, when data needs to be sent over a computer network, it is sent via virtual addresses on the device called “ports”. Different protocols use different port numbers. Port number 0-65535 exist on TCP indicating that a device can theoretically accept 65536 connections simultaneously.
For a more detailed post on TCP, click here.
User Datagram Protocol (UDP)
Whereas TCP is a reliable protocol to ensure that data is transmitted reliably between two devices, the UDP is a connectionless protocol. “Connectionless” here indicates that there is no formal connection creation or closing as is there in the TCP. The UDP does not do any error checking or data re-transmission. It simply sends a packet and forgets about it placing trust on the intermediate devices that they will send the packet to the correct destination. There is no mechanism of acknowledgement in UDP. Thus, data loss may occur in UDP. It is because of this reason only that UDP is not used in mission-critical tasks or any programs where data integrity is essential. UDP Communication is again done over ports. UDP ports too exist from 0-65535.
For a more detailed post on UDP, click here.
Internet Protocol (IP)
IP is a protocol for addressing and routing packets across the internet. It is again a connection-less protocol. Since TCP requires a connection between the two devices, it is easy to imagine TCP connections when the two devices are on the same network and can communicate with each other. But when they are on different networks, they cannot communicate with each other directly. Thus this communication between two devices in different networks (i.e. inter-network communication) is done by the IP. IP defines how packets on the internet move from a source to a destination. The TCP and IP are together responsible for the internet working seamlessly and are together known as TCP/IP.
For a more detailed post on IP, click here.
How do the packets traverse the internet?
The devices on the internet that help a packet move from its source to destination are called routers. Routers receive packets from a device, see its destination and then send the packet on a forward route towards its destination. This happens until the packet reaches its destination. A router does not need to know the location of all IP addresses on the internet. For each packet it receives, it simply needs to know to which neighbor should it send the packet.
Understanding Internet Addressing: A Tour of Digital Street Signs
Let’s imagine the internet as a vast, sprawling city. Within this city, every house (or in internet terms, every device) needs a unique identifier or an address. In the world of the internet, these addresses are known as IP addresses. These IP, or ‘Internet Protocol’, addresses are the unique labels assigned to each device connected to the internet.
- IP Addresses – The Unique House Numbers:An IP address is a unique string of numbers and/or letters that identifies each device using the Internet Protocol to communicate over a network. In our city analogy, think of it as the specific house number and street name of every house in the city. There are two types of IP addresses that are commonly used: IPv4 and IPv6. IPv4 uses a numeric string separated by periods, such as 192.168.1.1, while IPv6 uses both numbers and letters, separated by colons, like 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
- Domain Names – The Easier Language:While computers and servers are perfectly comfortable communicating using numerical IP addresses, humans find it challenging to remember long strings of numbers or alphanumeric combinations. To make it easier for us, the Domain Name System (DNS) was created. These are the website addresses that we type into our browsers, like www.example.com. In our city analogy, a domain name is like a nickname for an address, easier to remember and often indicative of who or what resides there.
- DNS Servers – The Helpful Map Guides:DNS servers act as the helpful guides within our city, translating the easy-to-remember domain names into the numerical IP addresses that computers understand. When you type a domain name into your browser, your computer sends a request to a DNS server, which then matches the domain name to the correct IP address.
- URLs – The Specific Paths:Finally, within each ‘house’ or server in our internet city, there are many ‘rooms’ or webpages. To direct your browser to a specific webpage, we use a URL (Uniform Resource Locator). A URL is a specific set of directions to a particular ‘room’ within a ‘house’. It includes the domain name, and additional information, like the specific path and protocol to be used. For example, in the URL “https://www.example.com/aboutus”, “https” is the protocol, “www.example.com” is the domain name, and “/aboutus” is the path to a specific page.
How are the devices on the Internet addressed?
Devices on the internet are addressed by using something called Internet Protocol Address (IP address in short). An IP address is a set of 4 numbers where each number is between 0-255. All the 4 numbers are written together and separated by a dot, e.g. 126.96.36.199. Such an address is specifically called IP v4 address since this addressing came up in the version 4 of the Internet Protocol. Network prefix is the same for all devices that connect to the internet through the same connection. Each device on the internet has an IP address and a router knows the IP address of all the devices connected to it.
Each router comes pre-configured with some routes, i.e. which way to send a particular packet. If it receives a packet for which it is not aware of the router, it asks one of its neighbors for the same and stores it for packets received later on. This way, the router builds up what is called “routing table”. Whereas communication to other devices outside a private network is made by using IP addresses, communication within a network is made by using MAC (Media Access Control) address. This MAC address is unique for every device whether it is in a public network or a private network. MAC addresses are linked to the actual hardware of the computer that do network communication.
A Public IP address refers to IP address of a device that is visible on the internet. Such a device can be directly addressed and accessed over the internet. A Private IP address refers to IP address of a device that is inside a local network and is not visible on the internet. Such a device will communicate with the internet as described below. The IP addresses from 10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255, or 192.168.0 0 to 192.168.255.255 are reserved as private IPs for use on local networks. IP addresses assigned to a device may be assigned manually or automatically by another protocol called Dynamic Host Configuration Protocol or DHCP. To read more about it, click here.
If you consider the number of IP address combinations possible with the 4 numbers between 0-255, it comes down to 2^32 (i.e 2 raised to the power 32). Thus, theoretically there can be only 2^32 devices on the internet. But the number of devices in the world is far more that that and the internet still functions fine. This is possible by something called Network Address Translation (NAT) wherein a public IP address is assigned to a device and all devices within the local network use that public IP address for connecting with other devices on the internet. NAT modifies the network address information in the packet headers while they are crossing a router. This needs to be done since a router cannot forward packets from one private network to another private network as it can only forward packets from one private network to another router and vice-versa. Thus, a device with NAT will hide the entire local network behind it and all communication from the entire local network will appear to be coming from the device with NAT functionality.
Network Address Translation
Think of the internet as a sprawling city bustling with activity. In this city, every home or device has a unique address, also known as an IP address. However, not every home’s address is directly accessible to the outside world. Some homes might be part of a larger apartment complex or community, and their addresses are known only within that community. These internal addresses aren’t recognized by the postal service (the wider internet) and need to be translated into a common, recognized address to interact with the outside world. This is essentially what Network Address Translation (NAT) does.
- Private and Public Addresses: In our city analogy, private addresses are like the apartment numbers known only within an apartment complex. They’re used within local networks and aren’t directly exposed to the internet. Conversely, public IP addresses are like street addresses, recognizable and accessible from the internet.
- The Role of NAT: In an internet-connected network (our apartment complex), each device (apartment) might have its own private IP address. But to the outside world, all traffic from this network appears to come from a single address – the public IP address. The NAT acts as an intelligent post office, keeping track of all outgoing and incoming requests and making sure they reach the right device.When a device within the network sends a request to an internet service, the NAT system on your router changes the source address of the packet (from the private IP) to the public IP of your network. It also keeps a record of this translation to ensure that when the response comes back, it knows which device to route it to.
- Benefits of NAT: NAT provides several benefits. Firstly, it allows the reuse of private IP addresses, mitigating the problem of IP address exhaustion. Secondly, it provides an extra layer of security, as devices are not directly exposed to the internet with their unique IP addresses. Lastly, it allows seamless internet connection sharing within a network with a single public IP address.
A problem associated with the above mentioned IP v4 is that the address space of the IP v4 addresses is less keeping in view how fast technology is growing and internet usage is expanding. All the approximately 4 billions IP addresses are not enough to handle the number of devices present on the internet today. Thus IP v6 addresses have come up which provide an almost unlimited number of IP addresses. Difference between IP v4 and IP v6 will be discussed in another post.
Since it would be difficult for humans to remember numbers, there are Domain Names which correspond to IP-Addresses (e.g. an IP address of www.google.com is 188.8.131.52). This mapping is always working seamlessly in the background through something called Domain Name System (DNS) which helps computers convert human readable domain names to IP addresses. To read more about it, click here.
In closing, data between two devices over the internet is transmitted by TCP/IP protocol using data packets where the addressing of the devices is done by using IP addresses.
For Wikipedia entry on Internet, click here.
For more posts on Internet, click here.
For more posts in The Cyber Cops project, click here.