 So we're looking at how the internet protocol works and generally how the internet works. We've gone through some parts of defining internet working basically connect different networks together. We have many lands and wide area networks distributed around but they use different technologies so internet working is about connecting them together using routers and we started to introduce the internet protocol just skip through some of those slides on IP. IP is the core of the TCP IP protocol stack that sits in the middle at the network layer different LAN and WAN technologies below it and above it we'll see probably today some different transport protocols and mention some application protocols. We distinguish between hosts and routers hosts are the end user devices like your mobile phone your PC, a server. So a server can also be a host. Routers are the devices that forward datagram through the internet usually connecting two or more networks together. IP routing finding the best path, IP forwarding, sending packets across the best path and we got through an example of IP forwarding using this picture last week where we showed the steps how source hosts forwards a datagram through the routers eventually to the destination host and that's where IP plays an important role. We got a quick look at the structure of an IP datagram. So an IP packet the other name is an IP datagram and it has a 20 byte header. The 20 byte header includes the version of the protocol like IP version 4 is what we're focusing on. The header length and I'll just go through the fields which are important the header length that is normally it's 20 bytes, but it can have some optional fields which makes the header length variable. The total length of the datagram which is just header plus data. Time to live is like a hop limit. We decrement the time to live as the datagram is forwarded by each router. So let's say it starts at 10, we send it to a router, it will decrement to 9, send it on. Once it gets to zero, it's no longer sent. Protocol field and we'll see more of that today identifies what is the protocol that put the data inside this datagram, the transport protocol specifically. And importantly and what we'll spend a lot of the next hour or so on is IP address of the source and destination. How many bits in the IP address? IP version 4, how long is it? 32 bits. Remember that you need to know we'll cover that in detail today and you see the source. The source address is the IP address of the computer that creates the datagram, the original source. And the destination is the IP address of the computer who's the final destination. It seems obvious, but note that we send the datagram via routers, which will also have IP addresses. So even though source host sends to router one, which has an IP address, the datagram destination address is not router one, it's our destination host. So the source and destination are the hosts, not the routers. And that just describes those fields, but I think we've talked about the main ones. We'll say a little bit more about routing tables with an example, but I think we know enough already that routing tables store in the simplest form to reach some destination who is the next node. And in the internet, that next node is usually a router. So for our source hosts, I'll flick through, to reach destination host, the next node is router one. And for the router to reach the destination host, the next node is router two. So those nodes, the hosts and routers will each have a routing table that keeps track of the path. So we use routing tables. The routing tables may be created manually. That is the person who runs the computer may program in the routing table. When we do our lab next semester, you'll get a chance to create your own routing table. Yes, we'll do all this in a lab next semester. So you can't forget it after the final exam. You'll have to remember it all. But in larger networks, instead of someone programming in the routing table, there's a protocol that automatically does it for us, a routing protocol. And there are different routing protocols that would do that for us. So they do the task of collecting the network status information, calculating the least cost paths, and updating the routing tables so that we don't have to do it for our computers. And there is a list of some of the names of routing protocols. IP focuses on forwarding. Given a routing table, and the example we went through, we see that a host has a routing table. It uses that to forward it to the first router, which will use its routing table to forward to the second router, and so on until it gets to the destination. So the hosts and routers look in the routing table to determine who to send it to next. IP has some other features which we will not go through. Fragmentation and reassembly is splitting the datagram into smaller chunks, into smaller fragments, and putting them back together. We don't see it very often and therefore we're not explaining it in any more depth. The time to live is included in the source, in the IP header, and it gives some lifetime of the datagram in the network. There are other features in the network layer which are not part of IP but really support IP, and some of them are listed here, but we will not touch upon them in this course. We just have a simple introduction to IP. Let's look at IP addresses. So in a previous lecture we had a quick example. An IP address is 32 bits, but for humans we represent it in a dotted decimal notation, four decimal numbers. Anyone not remember how to convert binary to dotted decimal? We just take the 32 bits, split it into four pieces of eight bits, four eight bit numbers and convert those eight bit numbers to decimal numbers, and when we get the dotted decimal notation. You need to remember that because as we go through these examples in more detail, we'll assume you can convert binary to dotted decimal. So let's look at IP addresses. They are 32 bits in length, so we're focusing just on IP version 4, the most commonly used version of IP. It turns out that the 32 bits, some bits identify the subnet that the device is attached to, and another set of those 32 bits identify that computer in the subnet. So there's really two parts of that address which we'll refer to as the network portion and the host portion. So we'll explain that with a few examples today. That the 32 bits is not just allocated to a computer randomly, that there's some structure in that address. And there's two parts really, network and host portion. And the structure is that in an internet, and in the internet that we use, the idea is that all subnets will have a unique network portion. Do we have a picture? I have to jump back a few slides to one of our earlier pictures. Here was our example internet which had nine subnets. Is it nine subnets here and connected by routers? The idea with the IP address is that the 32 bit address is split into network and host portion. Each network or subnet, LAN4 for example, will have a network portion allocated to itself. So LAN4 will have a network portion. WAN3 will have a different network portion. And they should be unique across that nine subnets, the network portion. Then the devices that attach to each network, for example the computer on LAN4 is a host inside that subnet. That computer will have an IP address made up of the network portion assigned to LAN4. And the remaining part of the address will be specific to that host. So for example if there are 20 computers on LAN4, they'll all have the same network portion, and all have different host portions of the address. And if there are 30 computers on LAN5, they'll all have the same network portion of the address, but different host portions of the address. So it turns out there's some hierarchy in the addresses. We'll see, it'll be clearer after we go through an example, but the 32 bit IP address, some bits are what we'll call the network portion that identify a subnet. And other bits, the remaining bits, are the host portion which identify one of the devices in that subnet. Let's go through and explain that with some different examples. Let's go back to the addresses. So a 32 bit address, we split into two parts, network and host part, or network portion and host portion. And it's typically done, the first n bits are the network portion, and the last h bits are the host portion. And there's different ways to split. That is of those 32 bits, it could be the first 10 bits, and the last 22, or the first 18, and the last 14 bits are the host portion. So of the 32 bits, we split into network and host. But where to split, there are different schemes to define how to do that. And over time, the way that IP addresses have been used, it's changed in how to split the addresses into network and host portion. We're focusing on the main one used today, it's called class less addressing. You will see, you'll make sense of some of those types of addresses. The original style class full, I think you may recognize as we go through the examples, but we'll explain just class less addressing, just to cut down on time. We'll see why to split in a moment after we go through how. First, quick one, make sure you can convert that to dotted decimal notation. Just convert that 32 bit IP address to dotted decimal notation. This is not about network host portion, this is what we did in an example last week. Everyone try to convert. Go through the steps of writing that in dotted decimal notation. Quick convert, 32 bits, four decimal numbers. You may need your calculator, you can do it in your head if you like. In the exam, you'll have your calculator. It helps to draw a line to split those parts of the address or wait till everyone's got it. Remember what we do? We split it into four 8-bit values, convert those 8-bit values into decimal and separate them by dots. So it's just a matter of converting the binary to decimal. What have we got? Say the first 8 bits, the first 8 bits, 1, 1 followed by 6 zeros. What's the value? What did you get? The first 8 bits, 192. So the calculator here does it for me in decimal, base 10 it's 192. So just a conversion from binary to decimal. So the first part is 192 followed by a dot and then you just do the next 8 bits. And it's hard for me to see. 1, 2, 3, 2, 2, 8. 2 to 8. And the next one? 20, 17. It's hard to make sure you line them up correctly. 17 and the last 8 bits, 57. Okay, everyone can convert. Just take, split it into four 8-bit values and convert them to decimal. Use your calculator if you like. This applies to all the 32-bit IPv4 addresses we see. We can convert them. The computer always use the binary representation but we will convert just to make it more convenient for us sometimes. Let's look at this concept of the host and network portion. This idea of classless addressing. So when we have an IP address of those 32 bits, some of them represent the network that this device is attached to and the remaining bits identify this device in that network. And so really we need to split those 32 bits up into two parts, two portions. So there are different ways into how to split. It's not fixed. There's no just one location to split. What we use in classless IP addressing is a subnet mask, sometimes called an address mask or just a mask. And the way that a subnet mask is used, it's another 32-bit value. So a 32-bit value where when we have a bit 1, it means the corresponding bit in the IP address is in the network portion. And when we have a bit 0, the corresponding bit in the IP address is in the host portion. Let's use this example to illustrate that and then we'll explain why we do it. So here's an example. The top at IP address is the actual IP address that we have. 32 bits, you could convert it to dot a decimal but there's no need to at the moment. Then IP addresses now have attached a second address called the subnet mask. So we'll see that each computer not just has an IP address but also has a subnet mask. And here's an example, subnet mask that goes with this IP address. And you see a subnet mask most commonly is a sequence of ones followed by zeros. Where the way to read it is that in this case, the first, how many are there? The first 22 bits in the mask are 1. The last 10 are zeros. That tells us that the first 22 bits in the IP address are the network portion and the last 10 bits in the IP address are the host portion. So the subnet mask tells us where the split is. Let's consider another example and then we'll go and explain why and how that's useful in knowing the subnet mask. Let's give you an IP address and then one that you may have seen and it's a very special case address or the range is but you often see it. Here's an IP address in dotted decimal notation. Convert to binary. 192 is an easy one. There's two ones followed by six zeros. And I'll just, although in the IP address there's no space, I'll just for the visual part have a space. What's 168? That's a zero. Is that correct? Someone convert, confirm my math. One, one, six, eight, one, zero, zero, one, zero, zero. One, zero. Right. What did I do? The wrong thing. I pressed the wrong button. There we go. One, zero, one, zero, one, zero, zero. Good that you're following. And one, seven zeros and one. We fit it in. So here's our IP address. But in fact, each IP address also comes with a subnet mask. And I'll give you the subnet mask in binary first, and then we'll see how it's used. So the subnet mask, that's right in this example. I'll try and line them up. Here's our subnet mask. And to save you counting, that's 24 ones followed by eight zeros. What it tells us is that this IP address 192.168.1.1, the first 24 bits identify the subnet for this device. So let's say my computer has this IP address and has this corresponding subnet mask. It says that my computer is on the subnet identified by the first 24 bits. And because that subnet may have multiple computers, my computer inside that subnet is identified by the last eight bits, the network, the host portion, the zero, zero, seven zeros and a one. So it shows us where the split is. And in this case, it lines up nicely here. So this is the network portion, the first 24 bits, and the host portion is the last eight bits. So each IP address for a device comes with an associated subnet mask. Same length, but the subnet mask is in this special format of a sequence of ones followed by the remaining zeros. Now, in the same way that our IP address can be written in dotted decimal notation to make it easier for us, we can also write the subnet mask in dotted decimal notation, convert. The subnet mask in dotted decimal notation, eight ones in decimal, eight ones is 255 and another eight ones. So dot 255 and another eight ones and the last eight zeros dot zero. So we have two addresses associated with the device, the IP address and the mask. And both can be written in either binary or dotted decimal notation. Now, with the subnet mask, there's a third way to write the mask and it's in a much shorter form because the mask is usually a sequence of ones followed by zeros. The third notation is called the slash notation where we just write slash followed by the number of ones. In this case, there are 24 ones. Slash 24. So this is just another notation, another shortcut for writing the address. So the blue one is the actual subnet mask, but we can write that in dotted decimal notation 255 dot 255 dot 255 dot zero or even shorter, we can write that as slash 24 because we have 24 ones. If it was slash 22, it means 22 ones, 10 zeros. So it's just a shortened way to write it. So these are the same value of the subnet mask and the top two are the same value of the IP address. And in fact, when we write an IP address, often we write both the IP address and the subnet mask together and a common notation would be to write the shortest notation in our example 192 dot 168 dot 1 dot 1. And then the subnet mask slash 24, saying that this computer has the address 192 168 1 dot 1 and subnet mask slash 24, meaning the first 24 bits of the address identify my subnet and the last eight bits identify my computer in that subnet. We split the network and host portion. Everything clear? Any questions? Really just the notation at the moment. We'll explain why we need the two in the moment. Correct, the first 24 bits identify the subnet in the internet. Yes, the last eight bits identify the device inside that subnet. And maybe we jump back in this picture. It's not the great example, but think that on each LAN there are some devices. There are computers attached. I just haven't drawn them. There's a computer, multiple computers attached to LAN4 as well as the router. So those computers, those hosts have IP addresses and the IP address is structured such that the first H bits, let's say in our example, the first 24 bits identify LAN4 and the last eight bits identify that computer inside LAN4. Some bits identify the subnet, the rest identify the device inside the subnet. Let's keep going with examples. We'll see this in more detail. Let's look at a different example. And this is a simple example of an internet with three subnets. The blue, the one in the middle, the red and the green subnet. And in this simple example, there are some devices, some hosts attached to the subnet. So the squares are hosts, computers. The clouds are the subnets. I don't show how they're connected. For example, the blue hosts may be connected via a switch in the middle, but we don't draw the LAN technology. Just draw it as a cloud saying that on this blue subnet, we have five hosts attached and the circle is a router. So in fact, on the blue subnet, there are six devices. On the red subnet, how many devices are attached? Four, two hosts, two routers on the red subnet. And on the green one, we have five devices attached. So hosts and routers, we need to consider them. The routers, remember, connect the subnets together. So our internet has three subnets. The idea is that we need to give IP addresses to our devices. Why? Well, in an internet, remember, we no longer have a fixed... We're no longer necessarily using 48-bit Ethernet addresses. We need an addressing scheme such that any device on any subnet can talk to any other device. And that's what IP addresses do for us. They allow us to have a common addressing scheme so that each device, in theory, has a unique address across the internet. And the way that we do it is that each subnet gets a particular network portion, a particular set first sequence of bits in an IP address, and each device inside that subnet gets a host portion. Let's go through this example. In this example, I'll just show the dot a decimal notation. I will not give the binary, but you can convert back to binary. We'll do it for a couple of examples, but not all. So in this case, in the blue subnet on the left, I say that the network portion... Well, first, in all three subnets, the subnet mask is slash 24. So that means just to keep it simple, in this example, all of them use the same subnet mask, 24 ones, eight zeros. We'll see some other examples later where it's not always 24. That means each subnet, think each subnet has a subnet mask. It doesn't have to be 24. It could be another value, but in this example, it's 24. It's not fixed to 24. So the blue subnet mask is slash 24, same with the other two. Then the network portion of the address must be different amongst those three subnets. Let's write them in binary, and then we'll see why we get 1110. I'll start with the binary address. This is an address of one of the devices in our example. And it's in dot a decimal notation is what value? 1.1.1.1.1, okay? So I've separated, you can slightly see the space. So it's 1.1.1.1.1, and the subnet mask, 24 ones, followed by eight zeros. So we'll write this one in full, 24 ones, followed by eight zeros, for this example. So the subnet mask tells us that the network portion is the first 24 bits, 24 bits, and the host portion is the last eight bits. Every device on this same subnet must have the same first 24 bits. And every device on the same subnet must have a different last eight bits. So that's how the network and host portion are used. Everyone on the same subnet, same network portion, but a different host portion. How many different host portions are available? Not eight. There's another 255 in theory values. That is, the host portion is eight bits in length. So there are 256 possible values. Here's one of them, all zeros and a one. So there are 255 other possible values. Let's not list them all, but let's just write one more example. The same first 24 bits, so the same first 24 bits, but let's give it a different last eight bits. And the last eight bits is two in this case. The IP address is 1.1.1.2 in dot a decimal notation. So these, the two black ones, are two different IP addresses. If we use this subnet mask, then we know that these two IP addresses identify devices which are on the same subnet because they have the same first 24 bits, and they are two different devices because they have a different host portion. And if, let's say, we add a third computer to this same subnet, then we must give it the same first 24 bits and a different last eight bits, and so on. What about this third IP address? Assuming the same subnet mask, I will not write again, but assuming this subnet mask of slash 24, this third IP address, what does it tell you? It's an IP address of a computer, which, what are the characteristics? Compared to the other two. It's on a different subnet. So the third computer is on a different subnet because the first 24 bits are different from the previous two. So we see, assuming the same subnet mask, it's actually 2.2.2.2, different subnet. Note that this one is 2.2.2.2, the host bits, 6.0s, 1.0, and in the previous address, 1.1.1.2, it's the same host bits, but that's allowed because they're on different subnets. So you must have unique host portions within a subnet, but across different subnets, the host portions may be reused. So three IP addresses in this case. The first one, 1.1.1.1, the second one, 1.1.1.2, those two devices are on the same subnet, and the third one, 2.2.2.2 is on a second subnet. They are the IP addresses for some of our examples here, so I've given the actual dotted decimal notation for, the router has IP address 1.1.1.1.1, they all have subnet mask slash 24. Here's the second computer, 1.1.1.2, and our third example was 2.2.2.2 slash 24. They're on a, it's on a different subnet. So, so far, recognize the point that when we assign IP addresses to devices, we must make sure we follow these rules of devices on different subnets have a different network portion of the address, and devices on the same subnet have the same network portion, but must have a different host portion. And if you check these addresses, if you convert them back to binary, you'll see that's the case. In the conversions from binary to dotted decimal, you may see some shortcuts, not much space, but let's try and write down these addresses in dotted decimal. The first one was 1.1.1.1, the second one, this address was 1.1.1.2, and the third one was 2.2.2.2.2. So, that's the dotted decimal notation. When the subnet mask is slash 24, then it's, then we can see that the first three decimal digits identify the network portion. 1.1.1 is the network portion in dotted decimal notation. The last digit, 1 or 2, identifies the host portion. It's because a slash 24 subnet mask splits on this dot. Okay, that the first 24 bits, the last eight bits. So, that's a shortcut sometimes. If you have a subnet mask, which is slash 24, you can quickly identify what is the network portion, what is the host portion of the address. Or a slash 16, but it's split on the second dot or a slash eight split on the first dot. That's only a shortcut that you'll, you'll get to learn as you practice these conversions. Give me an IP address on subnet 2.2.2. You want to attach a new computer to the subnet of this third example here, what's 2.2.2.3 is a possible value, or 2.2.2.4, 2.2.2.2. Anything where anything, because it's eight bits, can range from zero up to 255. So 256 possible values for devices on that subnet. So a new thing is that the subnet, and we're going not off track but on a slightly different topic before we get back to our example, a subnet 2.2.2.2. anything means this subnet, which the third host is on, and the way that we identify a subnet is adding the host portion to zero. We'll write that out in full. Now we're always in this example using a subnet mask of slash 24. I think you recognize before that all the devices on the same subnet as this one, we said 2.2.2.3.4.5.6, they're all on the same subnet because they all start with 2.2.2 or in binary this sequence of 24 bits. So when we want to talk about that particular subnet, all the devices on that subnet, there's a special address that we use and what we do is we take the 2.2.2 and set the host portion to all zeros in binary which turns out to be a zero in decimal. So your computer gets an IP address, a router gets an IP address, their device is on a subnet, but a subnet we can also give an IP address. It's not a particular device, it refers to the entire subnet and the subnet, the way that we get the address of the subnet is we take the first 24 bits and then set the last 8 bits to all zeros and this is a special case address and it's shown in this example the blue subnet instead of me calling it a blue subnet, I can call it subnet 1.1.1.0. So it's like the name for the subnet. So the blue one is 1.1.1.0, the middle red subnet is 2.2.2.0 and the green subnet is 3.3.3.0. So this is a special address that we don't give to devices but we give to subnets. A quick question, which subnet has the most devices in this example? Which subnet has the most devices? You said the blue one which is correct but instead of calling it the blue one the official name is 1.1.1.0. That's the idea that instead of talking about a blue subnet in the internet we use the actual this special address of 1.1.1.0. That's how we use it. And of course in the internet when we have hundreds of thousands if not millions of subnets we can't use colors or letters, we again use this special type of address. But you're correct that 1.1.1.0 has six devices attached. There should be some questions, any questions? Some things we haven't covered yet which we need to but any questions on this so far? A few things we haven't explained yet. Conversions, okay, binary to dot a decimal, the rules. On the same subnet same network portion. On the same subnet must have a different host portion. Different subnets must have different network portion addresses. And that's what we see in this example. The devices on the same subnet on subnet 1.1.1.0 they all have the same first 24 bits. And they all have a different last eight bits. Dot 1.2.3.4.5.6. And comparing the three subnets they all have different network portions. They all have first 24 bits which are different. Questions? All right, good question. Which devices have IP addresses? So IP addresses are for devices. Both hosts and routers have IP addresses. And to be more precise, an IP address is not for a computer or a device, it's actually for an interface. Remember last week we talked about my laptop has a wired ethernet interface. It has a wireless LAN interface, a Bluetooth interface. Each of them may have a separate IP address. And a router would normally have two or more interfaces. For example, our first router has an interface connecting to 1.1.1.0 subnet. And another interface, think another cable plugged in for the middle subnet. Each interface has an IP address. Normally hosts we only use one interface at a time. So normally we only have one interface at any one time, or one IP address at any one time. And typically routers will have two or more IP addresses. So you see that in this example. I've given each host the squares IP addresses. And I've also given the routers, so they're drawn in the middle near the circles IP addresses. So this router that attaches the first two subnets is IP address 1.1.1.1 and a second IP address 2.2.2.1. There doesn't have to be a relationship between those two IP addresses. In this example it turns out this is .1 and this is .1. It doesn't have to be true. It just has to be that the IP address of this interface matches our rules that the right interface on this router is on the subnet 2.2.2.0. Therefore it must start with 2.2.2. And the last part of the address must be unique inside the subnet. So this is .1, this is .2, .100, .101 for those two hosts. So yes, a router normally has two or more IP addresses because it normally attaches to two or more subnets. One for each subnet it attaches to. So why? Why have this complex scheme of an IP address split into two parts? Well it makes things easier in forwarding data and routing data especially. And we'll try and illustrate that with an example. We'll look at the routing tables of some of these devices. But before we do that, any questions on this picture? We have a number of hosts attached to three different subnets and I've already given them IP addresses. Where did they get an IP address from? It's actually a configuration of the computer. I think you may know that your computer, you can view the settings and view the IP address. You can even change the settings and change your IP address. It should be the responsibility of the computer owner or the network administrator to make sure the IP address matches the rules. That is, the IP address given to this computer does start with 1.1.1. And the last part is unique in the network. If it's not, there can be unpredictable consequences. Things can go wrong. We may send a packet and never get to the destination. For now, we'll assume that each device in our internet is given a correct IP address. By correct, I mean it follows those rules of unique in the subnet and unique across subnets for subnet addresses. We'll go through a routing example and then we'll make it even more complex by changing the subnet mask. Here's our example. I'm going to draw the routing tables for some of these devices. Remember, in the internet, hosts and routers have routing tables. And the way that we use routing tables, when we want to send data, we look in the routing table. Who's the destination and who do I send to next? Let's say our host 1.1.1.6 has data to send to 3.3.3.33, for example. It has data to send. First, I'll create some example routing tables. The first routing table I'll draw, don't copy it, because I'll show you that it's wrong or it's not a good one, but we'll show and explain first. So I'm going to draw the routing table for our source host 1.1.1.6. Don't copy this one, but remember a routing table with a simple way we can think of it. It contains a column to identify the destination that we want to reach and a column for the next node in the path to reach that destination. How many rows, so for the routing table for a host 1.1.1.6, how many rows in our routing table? How many possible destinations? Six, which six? Five? Two, no. Six, five, two, no. No. How many from our host 1.1.1.6, how many possible destinations are there in this internet? At least all of the other hosts. We could also include the routers as well. I may want to send to .4, I may want to send a 1.1.1.5, that may be a destination. I may want to send to 2.2.2.101 or to any of these over here. So the 10 hosts we should have destinations to. Is there 10? The hosts are the squares, there are circles of the routers. So we should at least have routes. We should at least have paths in the routing table to reach all possible destinations. Remember the idea of the internet is to allow anyone to communicate to anyone else. Let's add some of them. Again, don't write this because I'll change it in a moment. All right. If I want to send to 1.1.1.2, who's the next router? I want to send, I am, this is the routing table for host 1.1.1.6. Okay. I want to send to the destination 1.1.1.2. Who's the next router? I hear 3.2. Right. One way to think of it. All right. Where should I send the IP datagram? Where should I send it? To the router. Which router? Right. In this case, we don't send to the router. When the destination is on your subnet, there's no need to send to a router. The router is forgetting the data to another subnet. So in this case, the destination is on my same subnet. So don't send to 1.1.1.1, don't send to a router. So sometimes we, instead of writing a router here or the next node, we either write the actual address 1.1.1.2 or we use some special notation. I will just write, don't forward it, just send direct. There is no next router. If you think of this column meaning next router or next node in the path, well, there is no next router. Just use the LAN to send direct. For example, if we're connected via a switch, if there's a switch in the middle of this subnet, send to the switch, the switch will send to 1.1.1.2. So when the destination is on your subnet, send direct to them. We're using whatever technology is underlying the network. So I'll write direct. It's not used inside your computer, but the concept is send direct, don't send to a router. Let's fill in this routing table. What about 1.1.1.3? I want to send from 1.1. I am 1.1.1.6. I want to send to 1.1.1.3. What's the next node? Direct. It's on my subnet. Don't send to a router. Dot 4. Okay, it's still on my subnet. Dot 5. And we could also include it potentially to 1.1.1.1.1. I may want to send to the router in some cases. So we should include that there as a possible destination. Don't write this one down. I'm going to delete it. What about, let's try some others. 1.1.1. Right. To send to 2.2.2.1.1, the next router is this router here, which is 1.1.1.1. Not direct. So this is just our normal routing table to reach some destination on another subnet. Send to my router. And my router has the address, 1.1.1.1. So here's the router, which is on the same subnet as my source host. There are others here to reach 2.2.2.100. Same next router. Okay, some people are writing it down. Okay, that's fine. I didn't draw that in the middle subnet, there are actually 99 more, actually 97 more hosts. Okay, so let's imagine now that there are another 97 squares on the middle subnet. There are 2.2.2.3.4.5 and so on. Keep writing down the routing table. You're writing it? Keep, what's the route to 2.2.2.3? If there was a host here 2.2.2.3, the route would be 2.2.2.3 next and for 2.2.2.4, it would be the same. So you write down the routing table and you have 100 rows there just for all the devices on that subnet. And I think you see if I have the routes to 3.3.3.33 next is still 1.1.1.1.1. So in fact, we don't need to use the actual destination address here. We can simplify and the split of the addresses into network portion and host portion allow us to simplify. I'll add a few more and then I think you'll see the pattern. All right, what do we have? 3.3.3.33. What were the others? 44 and so on. The problem with this approach is that our routing table needs an entry for every device in the internet. How many devices in the internet? Billions. So your computer needs a table with billions of entries, billions of rows and of course it needs to update as things change. It's not feasible to do that. So we use the structure of the address to identify not a specific destination but a destination subnet. So instead of saying destination host 1.1.1.2, 1.1.1.3 and so on, we can say destination subnet 1.1.1.0. Why did I write a zero here? That's a mistake. This should have been a one here. But no one's copying it down, so that's okay. That was the router address. Let's write that different, that routing table. We can use these special addresses to identify the destination. These addresses at the top, 1.1.1.0. What's the next node? To reach, so that the meaning of this address is anyone on the network 1.1.1.0. Direct. Anyone on the network 2.2.2.0. The next node is 1.1.1.1. And anyone on the network 3.3 is also 1.1.1.1. Here we use what's called a network address. This dot zero address is called a network address. It identifies a specific network or subnet and it's used in routing tables and it greatly simplifies the storage of the information and the maintenance of the information in routing. Without such a address structure, we would not be able to do routing in the internet. Because if we have entries for every different device, it would be too complex. So the way that we interpret it is this routing table now. If the destination of my datagram is anyone on the subnet 1.1.1.0, send direct. If they are on the subnet 2.2.2.0, send to 1.1.1.1. And so on. So just three entries, one for each subnet. Who drew this routing table? Can you make it simpler? Here's my routing table. What if there was a fourth subnet out here? 4.4.4.0 attached to this green one. Update the routing table for our source host 1.1.1.6. What happens? What would it be? Let's say there's a router on the green subnet. Sorry, I'm using the green one. And then attach to the fourth subnet. Therefore, we need a new entry in our routing table. 4.4.4.0. Next node would be 1.1.1.1.1. That is, there's a new subnet, but still from this source host, we still need to send via our router 1.1.1.1.1. And imagine there are 100 more subnets out here from this source host perspective. For each destination subnet, the next node would still be 1.1.1.1.1. So we can greatly simplify that by introducing a wildcard. One last update for this routing table. If the destination is on my subnet 1.1.1.0, then send direct. Else, and I'll write it as a star meaning any value, send a 1.1.1.1. That's a much simpler routing table where this star is just notation to mean any other value. If we read it row by row, we check the destination of our datagram against each row. If it matches, send to the next. If not, try the next row. So instead of having rows for every device in the internet, we can cut it down in this case to just two rows. Where the second row, we sometimes call the default route. This is by default, send a 1.1.1.1. No matter who the destination is. Draw the routing table for our router in the middle. Try, for the router that connects the left two subnets, draw the routing table. Write the routing table. A common exam question. Fill in the routing tables for an example network. Try it for that one. That is this router which has an IP address 1.1.1.1 and it's also got an IP address of 2.2.2.1. It's on two different subnets. Think of the possible destinations we may want to reach and who are the next nodes to those destinations. What's a possible destination for this router? The subnet 2.2.2.0 is a possible destination. Others 1.1.1.0 and also 3.3.3.0. In this case, there are three possible destinations but you may use a wild card and asterisks to capture some of them in a simplified version. If you do it for the three different rows, that's okay. In this case because we have three subnets as the first attempt. Three different rows and consider what's the next node in the path. I'll write the full three rows. You can simplify. To reach 1.1.1.0, next node is from here, no. That is me. This is the routing table for the router with address 1.1.1.1. So that would say send to myself and then I would send to myself again and send to myself all the time. I want to reach the blue subnet. I am this router here which is attached to the blue subnet. I send direct. That is I don't send to a next router as the way to interpret direct here. There is no next router. The destinations are on the same subnet that you're on. Use the ethernet or the Wi-Fi or whatever technology you have to send to them. It's not an issue with IP anymore because we're on the same subnet. The role of IP is to getting across multiple subnets. So we'll denote that as just send direct. If I want to reach someone on 2.2.2.0, again I'm the router here. Next is also direct. I'm attached to two subnets. If I want to reach someone on 3.3.3.0, next, no, no, no, no. Here I am. I'm the router. I want to reach the green subnet. So I'd need to send a 2.2.2.2. The router which is attached to my subnet and also attached to the green subnet in this example. We'll do it quickly for the next router and it's similar for the router connecting the red and the green subnets. I'll actually do it in a different order. Last entry for this second router. I've done it just in a different order saying if I want to send a subnet, I'll call it subnet2, send direct because I'm attached to this subnet. If I want to send to the green subnet 3.3.3.0, send direct because I'm also attached to that. If I want to send to the blue subnet 1.1.1.0, I need to send to router 2.2.2.1. So there's the routing table for our second router. And you could create the routing tables for all the other hosts. And you'll find with the hosts normally they're very simple in just two entries. For example for this host 2.2.2.1.0, there'll be an entry for its local subnet. Actually that's an exception. I forgot about that one. That would have three entries. I'll let you work it out. We don't need it for our example at this stage. Any questions on our three routing tables? How to create them in the exam in two weeks time? Yes. Routing and IP is in the exam. Forwarding is easy now. If we have an IP datagram at source 1.1.1.6, it creates the IP datagram. The source address is its own address. And the destination address is that it wants to send to. And we just look up the routing tables. For example, I'll not draw it. But if we, so I am this 1.1.1.6, I want to send data to 3.3.3.33. I create the datagram. Destination address 33333. Look in the routing table which destination matches. The first row does not match. The destination is not on subnet 1.1.1.0. It's on subnet 33330. So the second row, meaning any other value, does match. It tells me send the datagram to router 1.1.1.1. We send it to there. That router looks for the destination in its routing table. The third row matches. It sends to 2222. Looks for the destination. Remember the destination is 3.3.3.33. Looks in the routing table. Send direct. Which means because we're on the same subnet, use the technology there to send. We must be able to communicate with everyone else on the same subnet. If it's a ethernet switch, send to the ethernet switch and it will send to the eventual destination. We assume that we can send across the local subnet. This is one example that illustrates the benefits of splitting between host and network portion. The routing is done based upon subnets. We route to subnets, not to individual hosts.