 Let's consider a different example in IP addresses and then return to how the data was forwarded. So far we've considered some simple example of IP addresses that used a subnet mask of slash 24. It turns out it's very easy for us to consider cases where the same subnet mask, but subnets don't have the same subnet mask. They may have different subnet masks. It becomes quite complex in the internet how the subnet masks are allocated, we'll say something about that in a moment, but in general two different subnets may have different subnet masks. Let's consider an example with a different subnet mask. So I'm using my Wi-Fi on my laptop and if I look at the configuration of my wireless LAN interface my wireless LAN interface has an IP address 10.10.105.80 so you can convert that to dot a decimal. And as part of the configuration it also tells me, among other addresses, the subnet mask just listed here is the mask. The subnet mask is 255.255.240.0. Let's write those two addresses in binary. So the IP address 10.10.105.80, write that one in binary and then the subnet mask 255.255.240.0. So write them both in binary. You start. I'll just leave them up for a moment. Just the INET address, I'll highlight that one first, convert to binary. Easy task, write it on a piece of paper, 10.10.105.80, 10 is what, 0, 0, 4, 0s, 1, 0, 1, 0. There's the first 16 bits because it repeats. Someone will calculate 105 and tell us. So 10.10.105.80, 105.80, just convert to binary, but maybe wrong, correct? You have a calculator, you can confirm, okay? And the subnet mask, the subnet mask, what was it? It was 255.255.240.0. Write the subnet mask in binary, but I suggest line it up with the IP address. It's a little bit simpler to look at if you line it up. 255 is, of course, 8 ones, 255.240 is 4 ones and 4 0s. And dot 0, of course, is 8 0s. Here's a subnet mask which is different from our previous example of slash 24. This is a slash what? Slash 20. There are 20 ones in a row, 8 plus 8, 16 plus another 4. This is a slash 20 address. So we could also write the address, the subnet mask in a shortened form like slash 20. So just a different notation. But note, here, with a different subnet mask, the split between network portion, the split between network portion occurs if I line it up here after the 20th bit. We said that there's a special address that identifies the subnet. So in this example, the first 20 bits identify the network portion of the address, the last 12 bits identify the host portion. And our rules are that every device on the same subnet, for example, on the same Wi-Fi, the same wireless LAN as my laptop now, should have the same first 20 bits and a different last 12 bits. That's one of the rules of our IP addresses. Everyone on the same subnet, the same network portion. And we introduced a special type of address called a network address which has the same network portion, but the host portion is all zeros. Let's write that one down. So write it down with the same first 20 bits, but the last 12 bits are all zeros. The same first 20 bits, there's our split. And then the last 12 bits, that is the host portion of the address, all zeros. This is a special case address. And it's the address that we used to refer to that subnet. Remember, instead of calling it a blue subnet, we said it was subnet 1.1.1.0. It's called a network address. And we used it in the routing tables, in the routing tables, in the destination we had 1.1.1.0 to refer to the entire subnet. So this is just how we come up with that address. Network portion is the same, but the host portion is all zeros. So in fact, a computer cannot have this address. It's reserved just to identify the subnet. So you should never assign your computer an address where the host portion is all zeros. Because that's reserved for some other purpose. In this case, the purpose of identifying a subnet. Convert to dot a decimal. So this is the real network address. I'll list them on the slide later, but let's just note that this is what we call a network address. It identifies a network or more precisely a subnet, a subnetwork. In dot a decimal notation, if we do the conversion, we get 10 again. Dot 10, dot what? What's the next value? 96. 0, 1, 1, 0, followed by 4 zeros. It's 96.0. And this just highlights the fact that a network address, the host bits are all zero. It doesn't necessarily mean we always end with zeros. I mean, we will end with a zero in this case, but we... It doesn't mean we can easily convert to dot a decimal by adding a zero at the end. So to identify what is the network address, just take the network portion and set the host portion to all zeros and convert to dot a decimal then. So to identify the subnet that my laptop is on now, I can say it's subnet 10.10.96.0. Slash 20. In fact, I've omitted it in some of the routing tables, but even in the routing tables, we should always write the subnet mask to be precise. So I should be writing the subnet mask whenever I write an IP address. So that address could be used inside a routing table, for example. I'll show you some other special cases in a moment. Let's return to our example of the three subnets. Here it is. That is this example, but the example we just went through is the hosts, what do we say? Host 1.1.1.6 wanted to send data to 3.3.3. Let's say 44, because that's what my next slide covers. We want to send a datagram. This is the normal mode of sending data and we don't hear it a lot, but it's called unicast. It'll make sense when we look at the other modes of sending data. Unicast means one source sends to one destination. And we followed that in that with the routing tables, we created the routing tables, and this is what happens. The source host sends to the first router, which sends to the next router, and then to the direct to the destination. So this is IP forwarding using normal IP addresses. So the IP datagram at the top contains the source address and the destination address. Any questions on how that data is delivered? So just sending data across the internet, this is called unicast. One-to-one communications. So in summary, IP addresses, each host and router, more precisely, each interface has an IP address. And those IP addresses have some structure where every subnet has a unique host portion, sorry, every subnet has a unique network portion in the internet, and inside each subnet, the host portion of the devices must be unique while the network portion is the same. And we've identified one special type of address so far called this network address. In this example, it's this 1.1.1.0 address which refers to the entire subnet, not just one device. But there are some other special addresses so let's go through them. Sometimes I don't want to do unicast which is send one-to-one, I would like to do broadcast, send one to many. Broadcast in communications is sending to multiple destinations or all destinations at once. So there are some special case IP addresses that are reserved for, in this case, for what's called directed broadcast. Let's see how it works. Unicast is the normal mode of operation, send one from one source to one destination. That's what we normally do, one-to-one. But sometimes I'd like to send one packet and it go to many people. Broadcast, for example. In this case, I've got one IP datagram at my computer 1.1.1.6 and let's say I want to send it to everyone on this subnet 2.2.2.0. I want to get a message to everyone on a particular subnet. This is called directed broadcast. Direct this message to a particular subnet and deliver it to everyone on that subnet. The way that it works is that we set the destination address to this special directed broadcast address. Source is 1.1.1.6, destination is 2.2.2.255. Where does that come from? 255, binary? All ones, eight ones. A directed broadcast address is a special case address where the host portion is all ones. We just introduced the network address, a special cast address where the host portion was all zeros. Here's a different type. So let's say I want to send it to everyone on the red subnet. Let's create the directed broadcast address. The network address for the red subnet, remember, was how did we create the network address? Well, write the full address. 2.2.2. Dot, not the dot. The network address was, we set the host portion to all zeros in binary. The slash 24 tells us the split is after the 24th bit. That was one special case address. Another special case address is that we use the same network portion, 2.2.2 and set the host portion to all ones. Convert, this is called the directed broadcast. And when we convert, we'll get, in this case, 2.2.2.255 slash 24, it's the same subnet mask. These are two special addresses that we do not use to allocate to computers. We use them for A, the network address to identify a subnet, and B, the directed broadcast address. If I want to send to everyone on a particular subnet, I want to direct my broadcast to one subnet. And the way that we come up with them is the same network portion, but network address all zeros, broadcast address all ones in the host portion. And with such an address in the datagram, the routers handle it specially. The idea is that the source creates a datagram, the destination address is the special address for network 2.2.2.0 is the directed broadcast address where that one datagram is sent to the first router and then it's the role of that router to send it to everyone on that subnet. Broadcast send to everyone. Directed broadcast means send to everyone on a particular subnet. We direct it to one subnet. So that's the idea of this address. If you want to send a message to everyone on one subnet, you can set the destination address to this special address. If we wanted to send the message to everyone on the green subnet, the destination would be what? You can work out it would be 3.3.3.255 in this case. So you just find the network portion with a slash 24 and set the host portion to all ones. Questions on how to create the directed broadcast address. Host portion all ones. Questions on how to use it. It's only used for special purposes. So when you send data from your computer you normally don't use it but maybe for administrating a network, updating routing information it can be used. In practice, it's not widely supported for security reasons that the routers will not send it on. If it was supported it could mean I could do something like send one message and it have it delivered to everyone on Google's network. We can do some form of security attack to send the many messages without the permission. So in theory it allows to send to everyone on a subnet in practice many networks in the internet do not allow that. What's the directed broadcast address for my wireless, my laptop? So we had the network address. Remember the IP was 10.10.105.80. We found the network address was 10.10.96.0. So we could find the directed broadcast address. Same network portion. So the first 20 bits are the same but then the last 12 bits are all ones. The split with slash 20 is here which gives us a directed broadcast address. 10.10. what? What's this address? 111.96 plus 15 is 111.255 slash 20. So that one's a little bit more complex. We don't get this nice.255 always. That is here the split is at the 20th bit. So if someone wants to send in theory to everyone on the same wireless LAN that I'm currently connected to, someone out on the internet would create an IP datagram and set the destination address to be 10.10.101.255. And in theory it will be sent to everyone on the same Wi-Fi as I'm on, your laptop and so on. In practice for two reasons that's generally not possible because of security reasons and also some special filtering that's to translate addresses. But in theory we can send to everyone on one particular network. So these two addresses, all host bits zero and all host bits one are not allowed to be given to computers. They're reserved for a special purpose. So that limits the number of addresses in a particular subnet that can be given to computers. Return to which case? On our blue subnet, how many possible computers in total are devices? On our blue subnet which is network address 1.1.1.0 slash 24, how many possible devices can we attach to that subnet? Counting the ones that are already on it. So in total how many devices on the blue subnet are possible? How many? 200 and 254 devices. Remember the subnet mask is slash 24 means there's eight bits in the host portion. Of those eight, with eight bits in the host portion on this subnet means there are two to the power of eight or 256 possible values. But two of those values are reserved. One value of all zeros is reserved and the other value of all ones is reserved, leaving 256 minus two possible addresses we can give to devices. So on a subnet which has a subnet mask of slash 24, there are 254 possible devices we can attach. If we added 255 computers, someone would have a conflicting IP address. Two devices would have the same IP address which is not possible because then we don't know who to deliver the data to. So the subnet mask actually limits the number of computers on the subnet. What if I want more than 254 computers on my subnet? What do I do? What would I need? I'd need a different subnet mask. For example, slash 22 or slash 16 which would allow more computers on that subnet. So although we were not going to the details in practice, how do you get a subnet mask? There's some administration that will allocate those subnet masks in the network portion to different organizations. And it's usually done based upon what their demand is on the number of computers per subnet. But that's getting in a bit too much detail. We've got two special addresses so far. We've got two more. Any questions on network and direct to broadcast? Actually, three special cases. Three more. I've missed one I think. Oh no, here's two in one. Here's two new special case addresses. Sometimes you boot your computer and you don't have an IP address, okay? You enter SIT and you boot up. You want to connect to the Wi-Fi but your computer doesn't have an IP address. So it needs to discover an IP address. And one common way for your computer to discover an IP address is to use something called DHCP. You may have seen it when you look at your network connections. But the way that it can work is that if I don't have an IP address, what I can do is I send a special IP datagram to everyone on my subnet. So I send a special datagram saying can anyone on my subnet give me an IP address? So let's say I don't have an IP address. I want to ask another computer like a special server if it will give me an IP address. So what we can do is we create an IP datagram, we set the source address to all zeros or binary zeros which converts to all decimal zeros. Because I don't have a source address yet, I need to set it to something. So set it to this special startup source address of all zeros and set the destination address to all ones, all binary ones, which converts to this 255.255.255.255.255. This is called a local broadcast. The idea is to send to everyone on your subnet with the hope that one of them will reply and give you an IP address. Maybe one of these devices is a special server that will send back a response saying here is an IP address, 1.1.1.6, use that. So this is used in the special case when we don't yet have an IP address but we need to automatically discover one. You set the source of the datagram to all zeros called the startup source address and you set the destination to all ones in binary called the local broadcast address and that datagram is sent to everyone on your network. Just be careful, directed broadcast was sent to everyone on a particular subnet. It was directed to a subnet. Doesn't have to be yours, it can be other people's subnets. Local broadcast goes to everyone on your current subnet. Even if you don't know that network address, you can still send to everyone using the local broadcast address. So really used when you don't have an IP address. Last example, or last special case address. So we've got four so far. All zeros, startup source address, all ones in binary, local broadcast and then the two previous ones of network address and directed broadcast. The last one, sometimes you want to send to yourself for testing purposes. This is called the loopback address and in dot a decimal notation, it's normally something like 127.0.0.1. Send to yourself. It doesn't go outside of your computer. So for testing, you want to test some software on your computer. You don't want to send it out. Sometimes you can send it to 127.0.0.1 and you think it just is internally handled by your computer and received by your computer. It can be other addresses but it starts with 127 in decimal but the common one is 127.0.0.1. This is the loopback address. Sometimes called local host. Local host means the local computer. So there are some special case addresses that are used in the internet. Any questions on them? So finish on IP addresses. I've gone through the last few quite quickly but that's I think all we need for this course. Any questions? Clear? So especially understand the network address and how it's created and the directed broadcast address and how that's created. The other three, loopback, you just remember 127 address 127.0.0.1. And start up source and local broadcasts. Again, remember them. You'll see them in some cases. There are many other details of IP addresses especially of how do you get them? Who gives your computer an IP address? Who gives your, who gives SIT a network portion? And there are details of how addresses are allocated. That example you may try. How do you obtain or get an IP address allocated? There's actually some organizations that hand out IP addresses. On a global level, IANA, they distribute to regional network information centers in Asia Pacific, there's APNIC. So remember 32-bit IP addresses, there's only about four billion possible values. Some are allocated for Asia Pacific some for North America, some for Europe and so on. And when you start your company or you want to get your own IP address, then usually you go to a country level authority which will give you an IP address or a range of IP addresses. Like THNIC in Thailand is based at Rung SIT, an organization that allocate IP addresses to users inside Thailand. But normally you and I as end users don't get to choose our IP address, it's allocated by the organization who gives us internet access, like our ISP, our internet service provider, or say by the university. So the way that an ISP or the university gives our end computers IP addresses is up to the organization. And commonly something called Dynamic Host Configuration Protocol is used, DHCP, where when I boot my laptop, it automatically discovers an IP address that SIT will give my laptop. Those details you'll see in the lab next semester. We will not discuss them here.