 So, we've mentioned the IP addresses of our devices. We know the structure of them. We also know that the IP address of a device comes with a subnet mask. The mask tells us where we split between the network and host portion. And we've introduced one special case address, a network address. So, rather than just identifying a device, we can also identify an entire subnet or a network inside the Internet, and that's the network address. And we mentioned a second special case address, the director broadcasts. And there are a couple of other special cases that we'll mention today. So, we know the structure. You've done the quiz, I hope, and let's just go through the special case IP addresses. And the next few slides will give examples of them. Let's give another example using my computer. We will not do this one just yet. Let's have a look at the IP address of my computer. First, while I look at mine, I want you to look at your IP address. Find your IP address on your laptop or phone. Open up your phone. The only lecture in this semester that you should be using your phone in the lecture, open your phone, find your IP address or your laptop should be there. And maybe some other addresses with your device. How do you find it? Maybe somewhere in the settings on your phone. Maybe go to the settings, advanced settings, something about network. I don't know, it would differ on Android, iOS, and other systems. Find something about settings or status, what's it called? How did you get there? So you can tell him. So you should be able to find your IP address. Different operating systems will present it in different ways. My computer presents it by using this command to look at it. And I see that the internet address, my IP address. And you may also see some other addresses associated with your device. So your IP address should be there. And maybe even the mask, okay? In my case, the mask is shown here. 255.255.240.0. Everyone's found their IP address. Keep looking if you haven't. You got yours? Have a look, find it. It's not so hard to find the settings in your phone. Your calculator won't have an IP address. Try, okay, doing the quiz, fine. Okay, right, right. So in Windows you can find it by the command prompt or the connection information. You got it? Not using a web search, find it on the device itself. So go into the settings, all right? And under in iOS, where do you go? You go into settings, Wi-Fi, we'll go. And then you can see the details. And you'll see things like DHCP, BootP, StaticP. And under DHCP, you should see your IP address. That's in iOS. Make sure everyone can see their IP address. Is it an IP address? Yes. It's similar to mine, correct. Go to Wi-Fi settings. Is there a menu item? Okay. Find one. Right. So, right. In iOS, you go to Wi-Fi settings. In Android, it's go to, in iOS, go to Wi-Fi settings and then click on your access point. Like click on W-S-I-I-T. There you go. In Android, go to about device and status. In Android, about device and then status. In iOS, you go to your Wi-Fi settings, click on your Wi-Fi network you're connected to and it'll show the details. So, different operating systems have different approaches. Mine's 10.107.40. Does anyone have the same address? Anyone have this address? Well, in theory, we should have unique addresses. Now, it's a little bit more complex because in different subnets, sometimes internal subnets may duplicate addresses if they're on separate network, but that's a special case. They should be unique inside S-I-T and we have a mask 255255.240.0. Let's write them down. What's the mask of mine in slash notation? The mask in my case, in slash notation 255 is eight ones. So, we have 16 ones. What's 240? How many ones in a row? 240. How many ones? So, it's an eight-bit number, 240 minus 15, so we need to subtract the last four ones. So, it should be four ones in a row. Slash 20, which is equivalent to a mask of 255, in my case, 255, 240.0. And I know you've got plenty of practice in binary, but let's do it 10. That's 10 in binary, 10, 107, that's gonna test me, 107 and 40. So, there's my IP address and the mask will write it down underneath. We have 20 bits in a row, 16, and then the remaining 12 bits are zeros. The mask tells us my IP address splits between the network and host portion at this location. The first 20 bits identify the subnet I'm on, and if you're on the same subnet, you'll have the same first 20 bits. And if you're on the same subnet, your last 12 bits will be different from mine. That's the rules that we follow when we set up IP addresses. So, this, all right, and the network address for this subnet that I'm on, which subnet am I on? Well, we can determine the network address. So, I'll say this is my device IP address, device, the network address. We take the first 20 bits, the first 20 bits and set the last 12 bits to all zeros. And that identifies my subnet, which is, in fact, 10.10.96.0. And usually we should write the subnet mask with that. So, that's my subnet. If I want to, in theory, if you want to talk about the subnet that I'm on in the internet, you can say it's 10.10.96.0 slash 20. That's one special case address. Another one is that sometimes when you want to send a packet to someone, you don't necessarily want to send to one device. You may want to send to many devices. And a very common thing that we want to do is to send to all devices on one subnet. Sending to all is called broadcast. So, there's a broadcast address that we can use such that we can send one packet, and it will go to all devices on a subnet. And I think we've mentioned how to derive the broadcast address, but let's do it again. The directed broadcast address, we call it the directed broadcast. There's a slightly different one later. We have the same first 20 bits, and then we split, and the host portion is all binary ones, which is 10.10. What's this? 96 plus 15 is 111.255. So, the directed broadcast is a second special case. We cannot use it for a device. Similar, we cannot use the network address for a device. They are reserved. The network address refers to my subnet. The directed broadcast can be used if you want to send to everyone on that subnet. So, if you want to send an IP datagram to my computer, you would set the destination address to 10.10.107.40 to go to my computer. But if you want to send a datagram to everyone on my subnet, you would send the destination address of 10.10.111.255. So, this is a special case such that what should happen is that in that subnet, every computer attached will receive a copy. Send to everyone on a specific subnet in the internet. We'll see another variation of broadcasts shortly. What else do we want to do? What if... All right, another special case, an easy one. What if I want to send to myself? What do I set the destination to? What if I want to send from my computer to my computer? What would the destination IP address be? Well, it could be 10.10.107.40. That's my IP address. But in fact, there's a special case, another special case address to send to yourself. It's called the local host address or the most precisely the loopback address. And it starts with 127. And then it can be any three decimal digits, but the commonly we see 127.0.0.1. That is the destination address that we can use to send to our self. Sending to yourself doesn't send out on the link. It's just internal on the computer. As an example, I can ping my computer. When I ping my own IP address, I'm only sending internally on the computer. It's only performed in software on my computer. Nothing goes out of my computer. So it's really just an application on my computer sending to itself. And it measures the time it takes as due to the processing time in my computer. But instead of knowing or using my specific IP address, I can ping the special loopback address, in this case 127.0.0.1. This is our loopback address. And every computer would support that. It doesn't matter what your actual IP address is, you can still contact yourself using this address. Why would we want to send to our self? Mainly for testing purposes. I want to test that my network software is working. Maybe I'm running a web server on my own laptop and I want to test my web development. Then you can access the web server, which is on your computer, by simply using the loopback address. So that's another special case. Where does my IP address come from? Or in your phone's case, did you enter in your IP address? Look at your phone again. Do you remember entering that IP address when you set up your phone? How did you get your IP address? What's your IP address? You can use your tablet, find it. Where did the value come from? Did you choose your IP address? It may not show the mask, that's because you've got poor software, a bad operating system. It depends upon the software, how much detail it shows you. But you did not set that IP address. I don't think you went to your phone and you typed in the IP address. Somehow it was magically given to you. Your device. Well, there's actually a protocol that does that commonly. And on some of your phones, it may show the acronym DHCP. So in fact, what commonly happens is you don't set your IP address. When you connect to a subnet, there's a special protocol called DHCP that allows you to obtain an IP address. I obtained that one. So what happens when you first join a network is that DHCP is used to obtain an IP address. And the way that it works is that when you join a network, you send a message to everyone in that subnet saying, is there anyone there who can give me an IP address? So you broadcast a message to the entire subnet saying, can someone give me an IP address? And that someone that gives you the IP address must be a special computer or a special running special software, a DHCP server. Most networks will have one. Maybe it's your home ADSL router. Maybe it's a special server inside SIT. What you do is you broadcast a message saying, is there a DHCP server out there that can give me an IP address? Because it's broadcast, everyone receives a copy. The DHCP server will then respond saying, yes, here use the address 10.10.107.40. And that's how my computer got an IP address. And with most operating systems, that happens when you plug in your LAN cable or when you connect to a wifi network. If you choose WSIIT, then that triggers DHCP to go to work and get you an IP address. The result is that the server keeps track of who has which address and can ensure that they are unique. The other result is often you may get different IP addresses. Today, I may be 10.10.107.40. Tomorrow I may have a different address because it's assigned to be by someone else. How do we get an IP address? Well, we use DHCP. The interesting thing is that DHCP actually sends IP packets. So the challenge is send an address, a send a message to everyone saying, I want an IP address. But who do we send that message to and what is the source address? If you want to send a message to someone, an IP datagram, there should be a source address. Where did it come from? But since you don't have an IP address, you can't set the source address. So there's a special case IP address. If you don't have an IP address and you need to send an IP packet, you can set the source address to all binary zeros, 32 zeros. And then the other challenge is, who do you send it to? There's a second broadcast address called local broadcast, send to your entire subnet, which is all binary ones. So let's see those last two special broadcast addresses. So we'll use this example to explain these special cases. Very simple example with three subnets. I've assigned the network addresses at the top, one dot one dot one dot zero, slash 24 to keep everything simple. The blue subnet, the red one, 2220, the green one, 3330. So we have three subnets. We have some hosts, the squares, with some IP addresses. Everything is slash 24. So it means the first three decimal digits are the network portion. The last decimal digit is the host portion. And two routers. Two routers connecting those three subnets. So the first normal case, let's say we are the blue host on the left, one dot one dot one dot six, that's our computer. Let's say we want to send to one of the green computers. Just want to send. So the normal case, this is called unicast, send to one. So to deliver to one computer is simply called unicast. Broadcast means send to all, send to everyone. There's also multicast, send to a subset of all, send to multiple, but we will not see that today. I want to send a three dot, three dot, three dot 44. What my computer does is it creates an IP datagram at the top. The source address is my computers, 1116. The destination address is who I want to send to. So that's simple. The IP datagram, we set the source and destination in the header field. Where would my computer send that IP datagram? Well, the picture shows us it would send this first router. Why send there? The routing table would be set up to say, for host 1116, if you want to send to anyone in any of the other subnets, the green or the red subnet, the default router you send to is 1111. So the routing table would tell my host, if the destination is 33344, send to 1111. That router would have a routing table saying, if the destination is on subnet three, the green one, send to next router 2222. And this one would say, we are directly attached to the green subnet, send direct to 33344. So the routing tables would determine the path that this datagram takes through the internet. We'll not show them here because the routes are very simple. There's not many options. Let's consider the special case addresses and see how they're used. First one, well, before we show it, you can look. The blue subnet, we know the network address. What is the directed broadcast address for the blue subnet? I suggest you write it, maybe down here. The directed broadcast address for the blue, red, and green subnets, what are they? Remember, directed broadcast, same as the network address in the network portion, all binary ones in the host portion. In this example, it's quite simple. With slash 24, it means the first 24 bits will be the same and the first 24 bits is the first three decimal numbers. Each decimal number is an 8-bit value. So the directed broadcast address for the blue one, it must start with, so here, this is the network address at the top and the directed broadcast, the first three decimal digits will be the same and the last eight bits will be all binary ones, convert to decimal and you get 255. For the red one, the first three digits would be the same. You can always convert to binary and check, but I'm using the shortcut with a slash 24, it means the first 24 bits is the same as the first three decimal digits. And 255 is eight ones in a row and the green one. So these are simple examples. Every subnet has a network address and a directed broadcast address. A computer on that subnet cannot use one of those. They're reserved for these special cases. If you assign your computer to use one of them, maybe your operating system will say you cannot or if it allows you, then something will most likely go wrong. You may not receive packets or be able to send. So how do we use it? Well, if someone wants to send to everyone on the green subnet, then the destination will be set to the directed broadcast address 333255. If someone wants to send to everyone on the red subnet, 222255. And we see that in this example. My computer, 111.6, wants to send to everyone on the red subnet. Everyone in this example is four devices, two routers and two hosts. So it's not just the hosts, it's the routers as well. So with, in this case, assuming I know the directed broadcast address of the red one, it's 222255. I create an IP datagram. Source address is me. Destination is the directed broadcast address. I send one IP datagram from my blue computer. I send it to my router. And the router gets this and recognizes this is a special address. It's a special destination. The router recognizes this datagram must be delivered to everyone on my red subnet. So what the router does is makes a copy. It makes a copy and sends it to 222100, 101 and the other router. The router will know who's on its subnet and it will send a copy to everyone. There are some optimizations of how to send the copy depending upon the LAN or the subnet technology, but the idea, the router will send a copy to everyone on that red subnet. And as a result, we've delivered by sending one packet to four different devices. How do I do the same using Unicast? What if I want to use Unicast? Can we do the same? That is, my computer wants to send the four devices on the red subnet. I could use Unicast, what I would do, if I don't want to use broadcast, then what I would do is, this computer wants to send to everyone on the red subnet. It could send one datagram to the router. Destination address would be 222.1. It could send a second datagram to 222.100, a third to the second router, and a fourth to the other host. This is the Unicast or the simple approach of sending to everyone. Just send a copy to every possible destination. Where the destination address is the normal address. It's not the direct to broadcast. What's the problem with this approach? Why is this not a good idea? And compare it to the slide with direct to broadcast. You may visually see. In this case, everyone receives a copy. That's good. Same with here. Everyone receives a copy of that message. How many did my computer send with direct to broadcast? I only send one packet. Here I send four packets. So that's the problem here. If I simply use Unicast, I actually have to send four separate packets. With direct to broadcast, I send just one. And it's up to the router to deliver to the destination. So we can greatly reduce the overhead of sending the same data to multiple destinations. Imagine you have a hundred or a thousand computers on the subnet, then sending a thousand packets versus sending one. Sending one is much better. So that's the main advantage of direct to broadcast. Another problem in this approach, I must know the IP addresses of all the devices on this network. And I must know how many devices. So I need to know that there are four devices and I need to know their exact IP addresses. With direct to broadcast, I don't need to know how many devices there. I just need to know that there is a subnet and that the address is 2.2.2.255. There could be four devices, there could be 200 devices. My computer doesn't know that, doesn't necessarily know, and can still send to all of them. So that's the other advantage of direct to broadcast. What's the disadvantage of direct to broadcast? And maybe, although we haven't covered it in this course, think about security things that could go wrong. If I can send one message and have it be delivered to everyone on a subnet, if that worked, then what I could do? Let's say I want to overload all of the computers inside Tullalongkorn University and another university. Then if I know their subnet address and use their direct to broadcast address, I could send one packet and it would be delivered to all the computers in their subnet. Very easy for me to send one packet and goes to everyone in their subnet. Now, if I can repeatedly do that, sending thousands of packets per second from my computer, then let's say there are a thousand destination computers and I'm sending a thousand packets per second, that's millions of packets per second going into the Tullalongkorn University subnet. I can start to overload their network very easily by sending a few packets, but they start to receive many packets. This is called a denial of service attack. I overload a network by sending a little bit, but contributing a lot of overhead or a lot of packets to their network. So the problem with direct to broadcast is a security issue. If we allow this, in theory, it allows anyone to send one packet and it be delivered to many others. And people, when this was initially allowed, use that to perform attacks. The result, it's blocked in most networks. You cannot use direct to broadcast in practice, except in your own network. That is, I cannot send one message and it'll be delivered to all of Tullalongkorn because the routers along the way would say, no, you're not allowed to send to this address. They have security policies that block it. In theory, send to everyone on one subnet, in practice, it's not supported in most subnets in the world. Used only really to send to everyone on your subnet. Send to everyone on the blue subnet, it would work, but if I try to send to everyone on the red or the green subnet, the routers along that way would drop the packet because it's a potential security violation. We said the loopback address was another special case. That's easy. You don't actually send the packet out of your computer. If you send to destination 127001, the packet stays internal to your computer. It's like it loops back, as if you have a cable coming out of your computer coming back in. It's just processed in software on your computer and you receive it. Useful for testing. And the last two special cases. The startup source address and the local broadcast address. What are the values? The local broadcast address is all binary ones. 32 binary ones. 255.255.255.255. And the startup source address is all binary zeros. Zero, dot, zero, dot, zero, zero. Two special cases. How are they used? The most common places we would see them used is, and we may see it next semester in a lab, is when you don't have an IP address, when you start up your computer boots or joins a network, then what it may do, so in this case let's say I don't yet have the address one, dot, one, dot, one, dot, six. I don't know my IP address. I send a message to everyone on my subnet. Now I don't know my IP address and I don't even know my subnet address. So to send to everyone on my subnet, I use the local broadcast address as the destination. 255.255.255.255. And this is interpreted as send to everyone on your subnet. So when I send that, everyone on my subnet gets a copy. It's broadcast on my subnet. And the way that it's, well, and I have to set the source address to something. If I don't have an IP address, then I set the source address to the special case all zeros. All binary zeros, all decimal zeros. And the common way that that's then used is maybe a DHCP server would receive this special message saying I'm looking for an IP address and then may respond saying, please use the address one, dot, one, dot, one, dot, six using Unicast and all broadcasts and then I can use that IP address. So the startup source address is used when you don't have an IP address and it's only the source address. Local broadcast send to everyone on your currently attached subnet. Direct to broadcast send to everyone on a particular subnet in the internet. It could be yours, it could be someone else's. And these two are often combined to discover IP addresses. Questions before we finish on IP addresses. You should be experts after your quiz, after several lectures, after using your phone. You need to be able to be experts in understanding the different types of IP addresses. Any problems? Okay, we have an expert at the back. Good. There's more details about IP addresses, especially how they are assigned and which we will not cover in this course. Your IP address at home, maybe you'll see your home computer gets an IP address 192.168.1.something. And it's the same IP address that I have in my home. So you may see duplicates. And this is because some range of addresses, these are the three ranges, are reserved only for use inside a network. So if your address is 192.168.1.1, and even the 10 addresses that we have inside SIT, they are only used inside SIT. When your packet goes out to the rest of the world, that address is not used. There are some special devices that translate that address into a different one called network address translation devices, NATS. So that's why you often see these 192.168 addresses. They are just used locally internal for a network that are called private addresses. In this course, we're going to assume that we will never use the local addresses. We'll always use public addresses, one which are unique across all computers. But in practice, there are some private network addresses. I think we've mentioned before, where do you get IP addresses from? You, your device, gets an IP address often using DHCP from some server on the LAN. Where does SIT or the organization get the subnet address from? There are some organizations inside each country that allocate the network addresses, like the Tide Network Information Center, and then one in Asia Pacific that allocates to the Asian Pacific countries. And then there's a global organization that keeps track of all of the range of addresses across the world, the Internet Assigned Numbers Authority.