So next what we're going to do is we're going to do a deep dive on a router and understand what a router actually is. So we're going to talk about routers. A router is very representative of other devices. So if you understand how router works internally, that you're going to understand switches and firewalls and all these other devices because they're made up in a very similar way. So what is a router exactly? Well, if we can look inside a router, there's a few pieces of it. So first of all, a router is a lot like a computer. In fact, early routers were computers. They were just special-purpose computers. Early routers had purely traditional computer architectures. They had Von Neumann architectures. There's a CPU connected to DRAM over a bus. There is input, output, and so on. Then sometime in the 1980s, companies started to realize that they could take IP, they could take the Internet protocol. They could implement that in a hardware. That was such a smart thing to do because it's hard to take a protocol that was designed for software and implement it in hardware. But there's such a huge performance improvement from that. This came out with the advent of E6, this special purpose integrated circuits that we could build and company started building E6 for IP routing and different networking protocols. This offloaded IP packet processing to hardware and they could forward packets at much higher speeds because of this. So if you could look inside a modern network router, it's got this traditional computer architecture up in the control plane. Inside the Data Plane, it's got a few pieces, it's got these physical interfaces where packets arrive and it's got interfaces where packets leave. Oftentimes, these are the same network interface. You might have an Ethernet cable and packets can come in and go out and over that cable, that's fine. But I'm going to draw them separately here just to keep the diagram clear. There's also queues to handle bursts of congestion. So this is something that was controversial and there's been a huge amount of debate about queues over the years in the academic community and industry about how big queues should be, should routers even have queues. The whole idea behind queue is if you're router sitting there and you have packets coming in, the packets might come in too fast for you to process them all. Maybe your inbound connection is faster than your outbound connection. In situations like this where you have a big burst of packets arrive, what do you do? You could drop them. That might be a fine thing to do, but if you have a little bit of memory there, we're going to queue up packets and store them and smooth out the burst, it'll help you because you can get those packets out, it'll help later routers because you smoothed out the bursts. You've slowed down the packets a little bit, spaced them out a little bit. So in general, the idea of having queues has really taken off inside routers. So routers have typically queues and is typically not just one queue for the whole router, there's a queue per interface so that when packets arrive they can be queued up until the router has time to process them. To get between these queues, there's something called a backplane. So the backplane is a switching fabric inside the router. It takes packets from inbound queues and sends them to outbound queues and it figures out where to send them. So it comes in this interface but where does it go out? The backplane takes care of transporting the packet from an input interface to an output interface. So if we look at a typical router architecture, there's a few pieces here. There's input and output interfaces and they're connected by a backplane. Now, the backplane can be implemented in a few different ways. In its simplest form, it could just be shared memory. So in the old days where we would just have a computer forwarding packets when we didn't have special-purpose hardware, this is what we do. We'd have a CPU and we'd have DRAM. We'd use DMA to clock the packets into the shared memory. We do a lookup using the CPU to determine the next hop and then we'd use DMA to get that packet out to the outbound network interface. So this is a design that worked but it's low capacity compared to what we can do with other architectures because all this memory is shared. If all of these inbound and outbound ports there's one bottleneck is this shared memory. So another architecture is to have a shared bus. So you have one bus running down the middle of the router. That's nice because it offloads the packet processing functionality from the CPU in memory, it let's packets be routed directly between network interfaces over the shared bus. On the other hand, it's a shared bus. So if you have one inbound interface that lead to another outbound interface and then another inbound interface saying to another outbound interface, they clyde over that bus. So you still have a shared bottleneck. More powerful routers have what's called a switched bus. The idea here is you have a backplane, but you don't just have one shared bus. You have multiple different connections inside there between different input queues and output queues. It's almost like having a little routed topology inside of the router. There's different topologies for that. There're things called butterfly networks and sorting networks and there's different tricks to take a whole bunch of packets at the same time and send them to the right outbound port and do routing in ways that packets don't collide or minimize the number of collisions. So as you go down this list, you get more powerful because you can send larger numbers of packets in parallel. But you also increase cost. If you have a switched bus, you need a lot of nodes inside there to forward packets, you need a bigger processing fabric and that costs more money. So it's appropriate for higher end routers and high capacity routers. So when router vendors sit down and they decide to make a router, it's a business decision. What they're going to do is they're going to do market surveys, they're going to study the market and they're going to figure out what the market needs and how much they can charge and what characteristics the routers should have and they're going to do all that. Then they're going to go back to their engineers to help them design something that meets those needs. There might be a back and forth process. Maybe the engineers come up with some design that achieve something better, they can charge more. But in general, there's this process where you figure out what you need and then you figure out how to build it. So this gets into router architecture because after you figure that out, you need to sit down and figure out how to design the router. So you have all these different pieces, you can decide where to put them, what speeds to make them, and so on. So what router architects do is they do an analysis process where they look at the speedup of different components and how to connect them together. There's a few numbers that are worth keeping in mind here. The first thing to pay attention to is the backplane. The backplane needs to be fast enough. If you think about the backplane has a hard job because all these packets are coming in from these individual input ports and they have to go to all these output ports but the backplane is one thing in the middle. You can make the backplane parallel but it's still one thing in the middle that needs to do all this work. So it needs to be fast enough. There's a question of how fast it should be. So you might think the backplane should be fast enough to handle traffic from every port to every outbound port. That's one possible way to design a router. But what we've noticed in networks is that networks are rarely saturated. So if you think about a network cable or a switch, the chances that everyone on your network is sending traffic at their maximum rates is very unlikely. So there's this notion of statistical multiplexing which is this observation that if you have a cable and you have a bunch of users using that cable, you actually need to provision less bandwidth for that cable than the aggregate total maximum capacity for all the users. So what a lot of router vendors do as a trick is they'll design the backplane to have less forwarding capacity than the number of input ports. So if you have 48 input ports and each one is one gig, it's very unlikely you're going to have 48 gig backplane because that would be really expensive. Instead you might just have an eight gig backplane. So if you buy a router, you need to look at the data sheet, you need to look at the speed of the ports that's important but also look at the speed of the backplane because that gives you the maximum total capacity that the router can forward in parallel. What you're going to notice with a lot of routers is that's limited a lot. A router vendor might say why of a 48 port router but actually you can only use eight of those ports at maximum capacity at any point of time? They do that to save costs. If you really do care about that, they do make routers with any to any full capacity. So you can buy more expensive routers to do that but that's a more expensive backplane. So the cost of the router increases. So in general, the backplane needs to be fast enough to handle the offered load from the all the ports that you care about. So what router architects are going to do is they're going to perform various sorts of calculations and analysis to figure out how to design the router. There's a few numbers that are useful to keep in mind. First, they're going to look at the input capacity and the output capacity. These individual network interfaces, how fast are they? Are they one gig or 10 gig? Then, there's the speed of the backplane. So what's the aggregate transfer capacity through the backplane? How much capacity can we send at any point in time? Then there's the capacity to get traffic into the backplane and off of the backplane. If you think about it, these things have to match up. It's not going to do any good to have a really fast backplane. If your backplane input capacity is too low because you can't get packets in there fast enough to actually use that bandwidth. So a few numbers are useful to keep in mind are backplane speedup which is the ratio of the backplane's speed to the input capacity. We could also think about the input speedup which is the ratio of the port capacity to the capacity to forward traffic onto the backplane, and the output speed up which is the speed which with we can get packets off of the backplane and out the output port. So when you design a router, you're going to think about all these parameters and determine how to design the router. As someone who purchases routers, you can look at the data sheet and find out all this information. This can help you make educated decisions about what kind of routers to deploy in your network.