Network Stacks and the Internet - Computerphile

When You're Not Really Browsing the Web

When you browse the web, you're not really browsing the web. You're fetching bits of it in looking at it locally right, so you're sending out to a server and then receiving some data back from that server. You're viewing it on your screen in your browser, which sends another request to some server either the same or a different one. Pull some more data down you look at that on your screen, and so you've got to have a process for how you send that request and then how you get the responses sent back to you.

This process starts with your web browser sitting above kind of a bunch of libraries. What's going to happen is you've got some data that starts out in your browser, which is your original request. This request will get sent down through these libraries eventually into the operating system. But what's going to happen there? Is that this chunk which is your original data? Maybe it's going to get encoded as a TCP segment, one of the basic protocols used for transferring data over the internet.

TCP stands for Transmission Control Protocol, and it's a connection-oriented protocol that ensures reliable data transfer between devices. When you send a request from your browser to a server, it's typically done using HTTP (Hypertext Transfer Protocol), which is also a connection-oriented protocol. However, TCP is used to ensure that the data is delivered in the correct order and without errors. So when you make a request, your browser will first establish a connection with the server using TCP, and then send the actual request.

But how does this process work? Let's dive deeper into what happens at each step of the way. When you type in a URL or click on a link, your browser sends an HTTP request to the server. This request typically includes information such as the URL, headers, and any data that needs to be sent. The request is then sent over the internet using TCP, which ensures that the data is delivered correctly.

Once the request reaches the server, it's received by the server's operating system, which processes the request and sends a response back to your browser. This response typically includes information such as the status code of the request, any relevant headers, and the actual data being requested. The response is then sent back over the internet using TCP, which ensures that the data is delivered correctly.

But what about when you're not really browsing the web? What happens when you're just looking at a webpage or scrolling through social media? Well, even in these cases, the process is still happening behind the scenes. Your browser is still making requests to servers, and the responses are still being sent back to your browser.

However, in many cases, the requests and responses are not as complex as they would be for actual web browsing. For example, when you're just looking at a webpage, the request may only include information such as the URL of the page. This can reduce the complexity of the process and make it faster and more efficient.

The Abstraction Provided by TCP

TCP provides an abstraction that makes it possible to transfer data over the internet in a reliable and efficient way. When you send a request or receive a response, your browser and server are communicating with each other using TCP. However, this communication is abstracted away from the actual protocol used.

For example, when you make a request to a server, your browser will use HTTP to communicate with the server. However, beneath the surface, TCP is being used to ensure that the data is delivered correctly and reliably. This abstraction makes it possible for devices to communicate with each other over long distances and in different environments.

TCP also provides a way to handle errors and disconnects. If there's an error or disconnect during the transmission of data, TCP will automatically retransmit the data until it's received correctly. This ensures that the data is delivered reliably and efficiently.

The Store-and-Forward Network

So how does this process work? Let's look at a more detailed example. When you make a request to Google.com, your browser sends an HTTP request to the server hosting Google.com. However, Google.com itself may not be located on the same network as your device. In fact, it could be located on a different continent or even in a different country.

In this case, the data needs to travel over multiple networks and devices before it reaches its final destination. This is where IP comes in. IP stands for Internet Protocol, which is used to route data packets across the internet.

When you make a request, your browser sends an IP packet to the server hosting Google.com. However, this packet may not be able to reach its final destination directly. Instead, it needs to travel over multiple networks and devices before it reaches its final destination.

This is where the store-and-forward network comes in. Each device on the internet acts as a node in the network, storing packets of data and forwarding them to their next destination. This process is repeated until the data packet finally reaches its destination.

The Hop-By-Hop Network

Another way to think about this process is as a hop-by-hop network. In this model, each device on the internet acts as a node that stores packets of data and forwards them to the next node in the chain. This process continues until the data packet finally reaches its destination.

For example, when you make a request to Google.com, your browser sends an IP packet to the server hosting Google.com. However, this packet may not be able to reach its final destination directly. Instead, it needs to travel over multiple networks and devices before it reaches its final destination.

Each device on the internet acts as a node in the network, storing packets of data and forwarding them to the next node in the chain. This process continues until the data packet finally reaches its destination. For example, if you're in the United States and you make a request to Google.com, which is hosted in Europe, the data packet will travel over multiple networks and devices before it reaches its final destination.

The Continuation of the Process

This continuation of the process is what makes the internet such an efficient and powerful technology. By using IP packets and TCP protocols, devices can communicate with each other over long distances and in different environments. This allows for a vast range of applications to be built on top of the internet, from social media and online shopping to video streaming and cloud computing.

However, this process is also what makes the internet so complex and difficult to understand. With so many devices and networks involved, it's easy to get lost in the details. But by breaking down the process step by step, we can gain a better understanding of how the internet works and how it enables us to communicate with each other.

Conclusion

In conclusion, the process of making a request on the internet involves several steps, from the initial request to the final response. This process relies heavily on TCP protocols and IP packets to ensure that data is delivered correctly and reliably over long distances and in different environments.

By understanding how this process works, we can gain a better appreciation for the complexity and power of the internet. Whether you're building a website or streaming a video, the internet provides an essential infrastructure for communication and commerce.

"WEBVTTKind: captionsLanguage: enWhen you browse the web you're not really browsing the web. You're fetching bits of it in looking at itLocally right, so you're sending out to a server server sending you some dataYou're viewing it on your screen in your browserYou on something it sends another request to some server either the same or a different onePull some more data down you look at that on your screenAnd so you've got to have a process for how you send that request and then how you get the responses sent back to youSo let's say you were say this is your web browserAnd then that's sitting above kind of a bunch of librariesAnd so what's going to happen is you've got some data that starts out in your browserSo that's the request and then that's going to get sent down through these libraries eventually into the operating systemAnd what's going to happen there? Is that this chunk which is your original data?Maybe is going to get encoded as a TCP segment one of the basic protocolsThat's used for supporting the world wide web so on the front of that is going to stick some TCPInformation and then a short while later normally what will happen is all of thatIt's just now thought of as data and then you'll get some Ip information on the front of it, and then a short while laterAll of that will be thought of as data and then get some ethernetInformation from and a little bit on the end as well and again for differentversions of IP so ipsec you can end up with some information getting stuck on the end so you click on something?That's got to turn into a piece of data the user wants to get to this particular urlYeah, then that has to go down through a bunch of libraries, so I sort of missed out step hereBut that thing there which might just be the urlMight have to get turned into something here which is going to be a get right url?This is the HTTP protocol, okay?So it's turned that into this sort of more valid piece of http and then that is going to getTreated just as a chunk of data doesn't matter what's in there, Via, urlCould be an image could be anything you wantIs where the notion of a networking stack or a protocol stack comes from these things stacked up?each of these different layers provides a different set ofAbstractions it sort of builds the abstractions provided by whatever's below it and it provides some abstraction of the thing above it for exampleIf you look at an header nowI'm not gonna try and draw all this out by memory because I will get wrongEssentially you've got a sequence of stuff on there, so you start out with the destination addressyou have a source addressdepending on precisely the version of ethernet you're running you have some information about the protocol of what's coming nextThen you might have some other header information where you might just get the data this destination source address will beSix bytes each I think it's two bytes. normal and then if you look inside, what's happening at this layer?So it's that that stuff. There is the data that was put in the framesoLet's say this protocol here indicates that is actually IP going next and the IP header you'll have things like there's a versionThere's a length of source address the destination addressAnd then some other information that Ip needs to operate weight Ip does this is then the IP?header and then eventually you get to the data transmitting the data transmitting in this case would start with aTCP header not even trying to get this in the right order nowBut you've got you know source port you'll have a destination port and some other things that TCP needs to do the things TCP doesEach of these layers is providingDifferent features to layer above so in the case of ethernet for example it provides this functionality for going from one machine to another machineSo the addresses it uses of the Mac addresses addresses your ethernet card, so these are the machine addressesIt's a little bit more fuzzy now with wireless cards because a lot of time you can set the Mac address from Software inSome of those and that can make things more complex and opens up all kinds of security holes and other possibilities for exampleBut basically yes, they should be uniquely identifying that particular network card, so there's a six bytesThey should be uniquely generated by the manufacturer the cardSo normally speaking you split them into the first three byteswhich is which indicates which manufacture it was so whether it's me or apple or dell orIbm or someone and then the other three bytes which in which is just a counter that that manufacturer will assign in some way allThat ethernet really is concerned with you getting that data from the transmitting it to somebody else connected to the same networkBut immediately so again getting it to an immediate neighborSo ethernet is not concerned with the internet as a whole it's not concerned with getting something to want toGoogle service or something it's just concerned with getting it to the next computersort of next computer some kind I pee on top of that then says okayWell the abstraction that's to provide is the idea that we've got an indicatorBefore we've got a bunch of computers that are all interconnected they can all see otherAnd we can now get data to move between networksSo if the person the computing you want to talk to is not immediately adjacent to youIP kind of handles that andThere's a set of protocols that let ip do that by for example figuring out that actually if you want to get to this guyWe don't know where he is right now, but what we can do is we can send it to a routerThat might be bit close to the destination, and so you have this idea that when you started out up hereAnd you were trying to get to google.comAs a bunch of other translations happen and ultimately that comes down to the Ethernet layer which effectively ends up sayingOh, I don't have to get to Google com by nowLet's get to your home router.Your home router might know how to get to google.com. So I'll send it there first that receives its Ethernet frameThen your home rooter has to take off the ethernet bits. Look at the IP bits and go okayWhere's this trying to get to what should I do with it and typically your home router is going to say wellI don't know how to get to google.com either in fact at that pointIt's not google.com is just addressI don't know how to get to, you know, some string numbersBut I do know that this route upstream from me and your ISP's network your internet provider's networkThat might have a better ideaso I'll send it there and then that router is going to pick it up and it gets sent they're usingSo it might get centers for ethernet more likely it'll get sent there. No over the DSL line thatYou've got cable modem or something that's different set of standards again to EthernetSo it doesn't have to be ethernet nowThere can be something else and that's going to get to the root when your internet Providers NetworkIt's going to take off those bits that aren't interesting anymore. It's look at the IP bits and go, okay. WellAgain, I don't know how to get to google become exactly I don't know where that is exactly but this other router in your internetProviders network is closer to it so I'll send it there and it's this sort of continual putting inside an envelopePassing it on guy takes next route to takes out the envelope looks how it goesThat direction, and it's that sequence of things which is what causes ip to be older, Hop-By-Hop network or a store and forward network?So this each rooter is kind of storing the pack of a little bit looking at it thinking about itSend it on with the next placeWe'd like to thank audible.com for supporting this videoAnd if you like your books as zeros and ones and what computerphile doesn't why not download a free audiobook at audible.com slash?Computer file I'd recommend Outliers by Malcolm, Gladwell, but my taste isn't always the bestSo I asked Sean who also works on computer file, and he recommended the books by neal Stephensonof an epic series he thinks highly of it. So why not check them out?audible.com Slash computerphileYou can download a free audio book and this is an offer for in the us and Canada at the momentThanks to them for supporting our videos and thank you for watching be back soon\n"