Check out a free preview of the full Full Stack for Front-End Engineers, v3 course:
The "How the Internet Works" Lesson is part of the full, Full Stack for Front-End Engineers, v3 course featured in this preview video. Here's what you'd learn in this lesson:

Jem discusses the broad question of how the internet works and walks through a simplified diagram of how a computer can use the internet to connect to a server. Terminology, including internet, intranet, LAN, and WAN are also covered in this segment.

Get Unlimited Access Now

Transcript from the "How the Internet Works" Lesson

[00:00:00]
>> So we have our server. We have our SSH key. We are now connected to our server. What we're gonna do next is we're gonna buy domain. So if you have a domain, and I know most of you probably squatting on a few, that's okay. If you haven't, I'm gonna walk-through how to buy one.

[00:00:14] And I won't say who to buy it from, but that's one of my opinion. And then, we're gonna put all together. We're gonna connect your domain to your server. And then now, now we're cooking. So now I'm going to roll up my sleeves because now is where we get really, really serious before some of the stuff you may have done before, creating SSH key, maybe even creating a server.

[00:00:34] But we're going to hook it all together and by the end, we're going to understand how the internet works, how does any of this work. So how does the internet work? Probably my favorite interview question. I don't ask it anymore because I'm known for it. So you're not getting any free passes if I ever give you an interview, but I like it because the internet is a complex piece of machinery.

[00:00:56] I said it before, but I'll say it again. The internet is one of mankind's greatest achievements. And what's great about is like it wasn't any one person's vision. Yes it was sort of quasi invented by DARPA, which is the military, the US government created a loose sort of internet, but nothing on this scale.

[00:01:14] They just wanted computers to be able to talk to each other. It's some loose way. Some universities wanted to talk to each other. But the internet itself where we are today is not the result of any one company or person or organization. It is a collection of people, a collection of organizations, a collection of technologies that somehow makes it so that I talk to you live in a completely different part of the world.

[00:01:33] And you're all tuning in and we're all creating these things. And that's just that's really cool. I don't know. I think we get so caught up in the day to day programming and arguing over frameworks and VI or vim or Emacs or just arbitrary things. We get caught up in our day to day and forgetting the magic of how all this stuff works together and it's incredibly complex.

[00:01:55] So I want to talk a little bit more about that. So normally when I say how does the internet work, people assume it's some magic, the browser talks to a server somewhere. How does the server talk back to you? Some other magic? I don't know. And that's usually the answer I get.

[00:02:12] The reason why I like to ask how does the internet work is because it gives you a chance to shine on any part of the stack that you want. Remember earlier we talked about what a stack means? The operating system, the web server, the application server. It doesn't matter.

[00:02:25] You can dive into any particular part and you can give me a good answer. That's why it's a really freeform answer that tells me how thoughtful you are, how much kind of research you've done. And kind of how curious you are because most of the stuff you don't need in your day-to-day if you're just creating webpages.

[00:02:42] You're not going to need to know how to spin up a server and open a firewall and things like that. That's probably done by someone else. But it shows me how curious you are and how much you pick up on the overall ecosystem that we exist in as front end engineers.

[00:02:59] The core of the internet is built on cooperation and rules. Some corporations monetize. So internet service providers. Well they get paid, we pay them to access the internet. And they're paid to maintain their part of the internet, the fibre lines, etc. But what about the other products? What about, I don't know, talking to a server?

[00:03:20] How's it that I can SSH into a server? Like who made Ubuntu to say you need to implement SSH and then OSX implement SSH and then made it so they can talk to each other? Well it's just cooperation, it's just saying hey here's a common standard we all agree on it let's implement it in this way and now we can all use it together.

[00:03:40] And that's what the internet is, just these series of decisions of all of us, how we came together. And I'm going on and on about it but again it's so magical how this all mysteriously works. By the time we get to the end of this, you'll be, how in the world do all these disparate pieces of technology come together and make it work even though they're completely unrelated to each other?

[00:04:03] This is a very, very simplified diagram of how requests works. You have your computer, your computer has a network card of some sort and interface outward. In the old days you had to buy a modem you had to buy an exterior modem. I don't know if any of you familiar with phone lines.

[00:04:19] I'm dating myself but there's something called a 56k modem that ran over your phone lines you had to plug it in and you couldn't use the phone at the same time as you're on Napster or something trying to download the mp3. Now I'm dating myself for sure. But all computers need a network card without that they can't talk to the internet.

[00:04:36] Pretty simple. It's built in now it didn't always used to be. If your network card is going to talk to a router somewhere, okay, maybe if you work in an ISP, you can plug directly into like one of the servers there. But if you do that on the way you're taking this course you probably know a lot more about networking than I do.

[00:04:52] But any network you connect to is connected to a router. The router enables so we can have one IP address. So we're here in Minneapolis right now. We might have one IP address that connects to the Internet, yet all of our computers have different internal IP addresses. And that's what the router gives us.

[00:05:11] It fans out and allows us to multiply our connections without making too many more. So your router will connect to probably a modem, maybe not, but probably a modem, I didn't even include that here. That connects to your ISP, the person you're paying to provide internet access to.

[00:05:26] Everybody has an ISP of some sort. That ISP may be a Tier 1, it may not be a Tier 1, but that ISP eventually is gonna connect to a Tier 1 ISP. Those ISPs are known as the backbone. The backbones of the internet are the big players. They keep everything running, the backbone goes down.

[00:05:44] You feel it. And we've seen it a few times and probably the past year. Usually, every year something some part of the internet goes down. And it's usually one of these backbones that go down due to some mis configuration or something like that. From there, the backbones usually talk to another backbone, and these backbones are really, really fast.

[00:06:01] These Tier 1 ISPs, they process speed at probably a hundred gigs a second or something like that, and that's pretty slow these days, but that's the minimum you need to become a Tier 1. Those ISPs will likely connect to a data center somewhere in the world, whether we talk about Rackspace, ORs or digital lotion.

[00:06:17] They're connecting to a data center. That data center is going to is going to have a server cluster that server clusters owned by you or me or any corporation or company. From the server cluster you usually had a load balancer of some kind. So you don't just connect to one server, that would make a lot of sense.

[00:06:34] You overload that server for all hitting the same ones. We have a load balancer to balance that out, and that ultimately connects to your server. And if I say how the internet works and you have this slide or you have this in your mind, you're doing pretty well.

[00:06:46] I left out a lot. There is a lot here not shown. We didn't talk about BGP. We talked about modems a little bit. We didn't talk about interconnection agreements and how does a ISP in the US connect to an ISP in England? And how do they talk to each other?

[00:07:02] Where do those cables run? Again, it's amazing this all works. Look at all these different steps to pull up a web page. And we didn't even talk about the software you need. We didn't talk about browsers, the standards they run on, that can read TCP requests and HTTP requests and translate those into something that is renderable.

[00:07:23] There's a whole ecosystem. So think back to that iceberg picture from the beginning of class where you see front end and you see everything else. This is part of the everything else that makes everything around us work. So some terminology. The internet is a network of networks. That's all it is nothing fancy.

[00:07:43] In the beginning days, it was just some university nerds talking to each other on their very slow mainframes. Now, we're all part of the internet, and intranet is a private network. If you work at a big corporation, they have an intranet. Most people do these days. That's just a private internet, it is connected the outside world but it doesn't let people in and we do that via firewalls VPNs, etc.

[00:08:09] LAN is something you don't hear as much. Anybody remember LAN parties? Yeah. Yeah. See, I can tell how old you are already based on if you're nodding long enough to tell me very clear. Because in the old days before the internet when the internet was too slow to actually do that much, you had to be on the same network and play the same games in the same room generally or in the same building.

[00:08:32] Yes, LAN is great because, like Mark was saying there's no latency, generally speaking, and then there's something called a WAN a wide area network, not something as used as much but similar to a LAN. It's just say multiple buildings at this time, but that's generally been replaced by internets.

[00:08:53] And I keep saying IP, IP, IP address, etc. IP just stands for Internet Protocol. Remember the internet is built on rules and cooperation. So those rules are general in the form of standards and protocols. Internet Protocol just specifies, hey, what is an address connecting to a computer? What does that look like?

[00:09:12] What are the rules around it? Are there letters allowed in there? Is there spaces? In Internet Protocol just says no. Here's what an IP address is. Here's the number of blocks we have and I'll talk about that one second when we get to IP addresses. And here's the rules that govern how these how this protocol works.

[00:09:32] An IP address is just a label assigned to any internet connected device. Every single device on the world has an IP address of some sorts. Now, a lot of times because they're behind a router, that internet address is just 192 dot 168 dot something those are considered local addresses.

[00:09:49] But again, they're wider when you connect to a wider net you're going to have generally one IP address. And that's the beauty of the router, it allows this multiplexing. So I don't think people know this but company's own blocks of the internet in different forums they own blocks of IP addresses.

[00:10:08] So I forget off the top of my head which governing body owns IP addresses but somebody does. And somebody says hey, let's get an example, Cloudflare, Cloudflare owns 1.1.1 and they own an entire block. Google owns an entire block of addresses. Amazon owns this entire block of addresses.

[00:10:31] The government owns probably the biggest block of IP addresses. And again, you have to buy these things from other people. So it's a weird dichotomy here where the internet's open and free, but it's also not, it's also owned by people too. But it generally all works out this private public cooperation.

[00:10:50] So way back in the day, and this is more of a math thing, people said, hey, let's create an IP address. An IP address will have four places, four different blocks to specify the location of the IP address. So when we take IPv4, so it's going to be something like that 127.0.0.1, etc.

[00:11:12] People are like, that's enough. That gives us roughly 4.3 billion addresses, that should be plenty, right? In 1990 when they're coming up with all these standards in the 90s and the 80s. That seemed like a lot, we'll never have 4 billion connected devices to the internet. It turns out we ran out of IP addresses quite a while ago, this was a problem.

[00:11:33] 4.3 billion is not enough. Hence, we created IPv6. IPv6 has 340 undecillion, I'm pronouncing that right addresses. So that effectively means we will never run out of IP addresses. I say this now they find that the same thing 30 years ago, we're never gonna run out of IP addresses but I think we're pretty safe with IPv6.

[00:11:56] IPv4 is 32 bits IPv6 is 128 bits so that is exponentially larger. So we're not really gonna dive into IPv6 too much but if you ever see it is a legitimate address it's just one of the more modern standards.