DEV Community

Cover image for How the internet works ?
priyanka prasad
priyanka prasad

Posted on

How the internet works ?

We all use the internet for a multitude of purposes and on a range of devices connected using different technologies. However, this complexity s hidden from us and does not seem to matter, because we can connect to the same services and have a similar experience no matter which device and connection we use.

Connecting to the internet
The networks you connect to at home, work, or out and about all connect to the internet using another network. This secondary network comes from an internet service provider, or ISP.

ISPs connect with one another directly or through other networks. Large corporations and telecommunications providers also connect to these networks. The connections might use fibre-optic cables, satellite links, or radio transmissions, and this vast web forms the infrastructure of the internet.

The internet gives you access to networks hosting thousands of servers. These ‘server farms’ provide services such as email, storage, media streaming, and more.

Finding the IP address
An app on your smartphone may connect to the internet using a dedicated server, with a fixed IP address. In this case, the app will have the destination IP address built into its software.

If you’re using a web browser, you can enter the exact URL of the site you want, follow a link on a web page, or use a search engine to find a website.

Once you have the URL you want, your browser tries to find the IP address belonging with that URL. This is where a domain name server, or DNS, comes in: the browser sends a query to its local DNS asking for the IP address of the URL in question. If the server knows the IP address, it replies with that address. If not, it sends the query on to a DNS server with a more global list of URLs. Eventually, your device will get back the IP address matching the URL.

Routing the IP packets
Once it has the IP address it needs, your device encapsulates your data in an IP packet with the destination address of the server. The IP packet travels over the network to the first router. But how does the router know where to send the packet next?

Your home router only knows about the local networks it’s connected to: it only has one default connection to the internet and the ISP.

More complex routers that your IP packet passes through will use the IP address to identify the network they need to reach. For example, all IP addresses starting 200.11 belong to a large telecom company. Inside the company, routers advertise the networks they know about to neighbouring routers. The neighbours advertise to other neighbouring routers, throughout the whole organisation. This way, the routers know which link to use to send an IP packet to reach any networks within that organisation.

These large organisations then advertise their summary routes to each other. This dramatically reduces the number of individual networks that each router must learn.

With this information, each router can quickly send IP packets via the best links on its journey around the globe. Routers can also choose between multiple paths based on speed or bandwidth.

On the way, the changing links encapsulate the IP packet in a variety of different frames.

Finally, the IP packet arrives at a router connected to the same LAN as the destination server, and the IP packet will be delivered to that device.

Servers respond
The server responds, sending data back to the source. This data usually consists of many thousands of bytes, split into a series of fragments. Each fragment is encapsulated in its own IP packet and sent back over the internet.

This quantity of data could potentially congest the network and cause it to fail. So the returning packets may take different routes back through the network, and may arrive out of sequence.

The destination device reassembles the packets, decapsulates the data, and passes it to the app or web browser that requested it.

Top comments (0)