 We've introduced the internet protocol, or generally internet working, and we're going to continue on describing how IP works and get to IP addresses. But just going back, forward, back, remember an internet is made up of connecting smaller subnets together. So this picture is an example of an internet with our multiple LANs and wide area networks, the subnets, and they're connected together via these routers. And routers are datagram packet switches. We send a packet to the router. The router will use its routing table to determine who to send to next, the next router, which will send to the next router and eventually to the destination. This concept is called internet working, and the complete network we get is called an internet work, or simply an internet. And the protocol to support sending data via routers that we use is called the internet protocol, IP. It uses datagram packet switching. The layer, if we look at our five layer stack, and we'll see it in the picture in a couple of slides, is in the middle. It's what we call the network layer, that's where IP sits. IP is very simple compared to some of the other protocols we may learn about, in that when we have data to send with IP, we just create an IP datagram and send it. We use the routing table to determine who to send to, but then we just send it. We don't set up a connection in advance, like circuit switching and virtual circuit packet switching. Before we send data with those, we set up a connection, then send the data. With IP, we do not set up connections, so sometimes we say it's connection less. There are alternative protocols that did set up a connection. Not setting up a connection makes it very simple. We just send the data, and that's one of the benefits of IP. The key thing of IP is that it defines the addresses that we give to our devices, so that they communicate across an internet, not just inside their subnet. One small feature which we will not cover in any detail is that what can happen is that if we have a datagram that is too large to be sent across the subnet, IP can split it into smaller fragments. So maybe we have a datagram with 10,000 bytes, but the wired network only supports sending frames of 1,500 bytes. So we split it into six, seven different fragments and send the fragments one at a time. So this is called fragmentation, and at the receiving device, it reassembles back to the original one frame. That's something we will not cover in any more detail because we do not see it in the simple cases that we look at, because normally the applications or the protocols being used will try to send data such that this is avoided. Now try and send the right sized data so that there's no need to split it up any further. Splitting up takes some processing time and it also introduces extra header overhead. So we try to avoid it. We're focusing on IP version 4, there's also IP version 6. IP does not have any error control. If we send a datagram across the internet and it doesn't get to the destination, too bad. IP will not try and fix it. It will not try to retransmit. It's left to the other protocols like TCP to try and fix any errors. There's no concept of flow control. If we send too fast with IP, we may overflow the receiver. IP will not try and slow down. And there's some other features which IP doesn't do which are left to some other protocols used in the internet. For example, status reporting. Reporting an error in the network or some diagnostics. There's another protocol called ICMP that's used for that. IP doesn't do that. And one of the points here is it doesn't do these things is it makes it very simple. And that's one reason why it's being widely deployed. It's simplicity. It can be used for many different cases. There's some terminology there. If I mention some of those terms and you don't remember, you'll go back and read what they mean. We've covered a lot of them before. So in terms of our five layer protocol architecture or stack, from the bottom up, layer one is a physical layer. Layer two is the data link layer. Together, we often think about them together because they're both about getting data across a link. Or with respect to the internet, across a single subnet. So inside a subnet, we have a specific physical and data link layer technology. Like Ethernet, wireless LAN, Bluetooth or in wide area networks, ATM, PDH and many others. So there are many technologies here. The network layer is about getting data across multiple subnets, across the internet. And the key protocol is IP, the internet protocol. And in accessing the internet, IP is the core of the protocols we use to access the internet. There are some supporting protocols. Some other ones which are not as important as IP or maybe they use, but IP is the core part for delivering data. So we'll not cover them in any detail. The other ones will focus just on IP. Above that, we say at the higher layer, at the transport layer, there are some protocols about getting the data between applications. And you know from your assignment, you studied using IPERF and you tried two different transport protocols. Most of you did, you tried TCP and UDP. Anyone remember which one gave the best performance in your assignment? You should have said if you did test with UDP and TCP, which one was better? TCP, who got the higher throughput? In my test, I got higher throughput with UDP. We'll see what you got. It may depend upon different conditions. What's the difference between them? We'll see maybe next week when we close this topic. But basically UDP does nothing more than IP. It almost does nothing when it delivers the data. All it does is we've got some data to send with UDP. It attaches a header and then sends it. There's no flow control, no error control, no setting up connection. So it's almost like IP. It's very simple. It does a couple of things. We actually need it in some cases. But in terms of delivering data, it doesn't have any extra algorithms to do flow, error or congestion control. Whereas TCP does. Because IP doesn't do any retransmissions, if we want to send data from one application to another and we don't want any errors, I want to download a file and I want to make sure the file I download is the same as what the server sent me, then we need some error control. Because if there is an error, we need to retransmit and get the correct data. IP will not do that for us. TCP takes that role. It implements error control. Retransmissions. So it uses a go back end style retransmission scheme. It also has flow control and some other algorithms to control how fast the data is transferred across the internet. TCP is much more complex than UDP and IP, but very commonly used. Many of the applications you use actually use TCP to transfer data because it provides reliability. Most of the data we want to transfer, web pages, files, instant messages, we need to receive the data 100% accurate. If we don't receive the correct bits, the application is not working correctly. So TCP is important. There are some others used for very special purposes or quite new but not widely used. Then at the top are all the application protocols that are used for specific applications. HTTP for web browsing. SMTP for email between servers. POP3 and IMAP4 between email, between a client and a storage server. And there are many more in here. There may be hundreds of different protocols for different applications. In the internet, everything relies on IP. So some newer terminology. The devices in the internet will distinguish or classify as two types. Hosts and routers. A host is the end device that creates data or receives data, like your laptop, phone, a server, that either creates the data to send to someone else or it's the final destination of data. Routers are the devices that forward the data between different subnets. So they have the role of joining the subnets together. Some are the practical differences. Think of your mobile phone as a host. How many interfaces does your mobile phone have? How many network interfaces? That is how many different types of subnets can you connect to on your mobile phone? How many pieces of hardware that allow you to connect to a network on your mobile phone? Not have a mobile phone? Okay, so everyone has one. Think about how you can connect to different networks from your phone. What types of networks? Wi-Fi is one. Most will support Wi-Fi. So that's one type of network. You think inside your phone there's a chip. There's a piece of hardware that implements the physical and data link layer for Wi-Fi. Allow you to connect to WSIIT. Wi-Fi, then your mobile phone network, 3G, 4G, whatever the current technology is, but another chip that allows you to connect to the mobile phone network. So there's two network interfaces. Anymore, maybe Bluetooth. You can think that's a third network interface. Some maybe have some near field communications. Some have NFC for short range communications between a phone, between two phones. But three is typical. How many do you use at the same time? Are you using Wi-Fi and 3G at the same time often? Usually you're just using one at a time. So that's the... Not always. You can use two or more, but most times we use just one network interface at a time. So hosts usually use only one interface at a time. They can use more, but that's common. A host never forwards the datagrams. Forwarding means you receive a datagram. It's not destined to you and you send it onto someone else. That's forwarding. A host will not do that. If a host receives a datagram that is not destined to it, it will not send onto someone else. And that's the key difference between a host and a router. A router will forward a host will not. Your mobile phone is most likely set up as a host. Your laptop, home PC, whatever, a host normally. Usually they're either the source or therefore they're either the source or destination. The original source or final destination. Routers forward datagrams. The main role is they receive a datagram from someone else. They look at it. It's destined to someone else. They send it on to another device. They usually have two or more interfaces. Because they need to connect multiple subnets, they have an interface for each subnet. For example, this router in this picture connects to LAN 6, LAN 3 and LAN 2. We can think it would probably have three interfaces. At the same time it can send on either of those three networks or all of those three networks. One, two, three interfaces. Normally routers forward datagrams, but they can be a source or destination. It's just not so common. Their main role is to forward. So we'll distinguish between hosts and routers. And we'll distinguish between routing and forwarding. In the internet, IP routing, IP forwarding. We studied routing in an entire topic. And we know the basic approach with routing. Find the best path through the network, the least cost path, and then create a routing table where the routing table stores to reach some destination who's the next node. So IP routing is the process of discovering the best paths and then putting that information inside a routing table. And it's not done manually by someone sitting there and looking at the paths. Usually it's done automatically using routing protocols. And some are listed here. You can think it's done in the background. On the routers, especially in the internet, when there's no data to be sent, even if there's no data to be sent, they're in the background calculating the best paths through the network and updating the routing tables. Forwarding is the process when we have data to send is to read the routing tables and forward on to another node. So routing creates the routing tables. Forwarding uses the routing table to determine who to send the data to. So let's look at a little bit more detail, looking at the layered stacks in this diagram and just show the general concept of forwarding. Then we'll use the example to illustrate some more details, especially with IP addresses. So here's our example network or internet. We have a source host who wants to send some data to the destination host across our internet. And there are multiple routers or N routers between source and destination. And we can think I've given the subnet some name. So from source host to router one, they are connected on subnet A. Maybe it's a Wi-Fi network. We don't know, we generally say just a subnet. For example, this could be a Wi-Fi network to connect the host to the Wi-Fi router. Then that connects to router two via subnet B. Maybe that's a wired LAN or Ethernet network. And that connects to another router and they go beyond and eventually router N connects via the last subnet to the destination host. So there's our general internet. We're going to send our data from source host via the series of routers. If we look internal of each of those devices, if we look inside them and the protocols they use, we can see the protocol stacks from what's shown underneath. Notice that the source host runs the application so does the destination host. So they both must support the application protocol being used. And I'll write on here an example. If we're using web browsing, for example, if we're using web browsing, what would the application protocol be here? Everyone yell it out at once. The protocol used for web browsing starts with a H. HTTP, I see some people mention it. That is the source host must support HTTP. And same with the destination. They must speak the same language. This may be a web server. It is a web browser. And to deliver web requests and pages back, we need to do that in a reliable manner. So which transport protocol would we use if we want reliable delivery? Two to choose from. TCP. Some people are awake. TCP provides reliable delivery between applications. So both the source and destination would support TCP. So that examples of application and transport protocols. So what the source host does, when it wants to request a web page, HTTP goes to work, creates a request for a web page, gives it to TCP, which will do what's necessary to set up a connection and try to send that data. And it sends the TCP messages using IP, the network layer. To get this... an IP uses a... creates a datagram or a packet to be sent across the internet. And from our source host to router one, we'll send across the first subnet using some technology. And for example, we'll say this uses Wi-Fi. That is the data link layer and the physical layer implement the standards used for Wi-Fi. Just as an example. So what happens is the source host will create an IP datagram and send that by the Wi-Fi link to the next device. How does it know to send to that next device the routing table would tell it? To reach destination host, the next device is router one. Sends to router one, which receives on the Wi-Fi link, then router one has the process of forwarding that across to the next device. And that IP datagram is sent using the second subnet, subnet B maybe using ethernet. A wide land. Sends it to router two. So we can think our data flows through the layers across the subnet through router one. So the path of that data, that is its process, it's received by router one on this interface. IP processes it, looks at the routing table, sends it across the second interface to router two. And that just continues along that way via the routers. We'll send to the next router and so on. Then we receive, router N will receive the datagram. It will look in its routing table. Destination is this host. I've got the datagram. It will use its routing table to know to send it to that host using subnet Z, whatever it is, and sends it on to the destination host. Then it's received, the datagram is received. And when it gets to IP, the IP software inside the destination host, it looks at the datagram. The destination address matches this computer. So it says this data is to me and gives the data to the TCP software. And we'll see how it knows the TCP software in a moment. And then TCP gives the data to the HTTP software in the web server. And then it's processed and maybe a response is sent back. But we can say in that direction the data is delivered to the destination. There are no acknowledgments because there's no reliability necessary. We just send the IP datagram via the routers to the destination. So it's a very simple protocol from that perspective. There's no acts, nothing comes back. No retransmissions. We don't have to slow down. There's no windows or anything. We just send the data. There are a couple of things I skipped over there. One is how does each router know to send it to that next router? Well, in fact, routing tables are used there. We'll see in our example some details of routing tables. When the destination host receives the datagram, when IP has the datagram, it sends it to TCP. How did it know to send to TCP? We'll see inside the IP datagram header. It keeps track of the transport protocol that needs to receive the data. So we'll see a field in a moment. And, of course, the other thing, how do we know who to send to? Well, the IP datagram contains the source and destination address, the IP addresses of the source and destination host. So that's the general approach for forwarding. We forward a datagram via routers. Let's look at the IP datagram and then we'll go through our example to see a more detailed case of forwarding and look more at IP addresses. Did we talk about the datagram on last lecture? Everyone remember the structure? I think we may have introduced it, but let's quickly go through. The datagram contains 20 bytes of header and some data. There is an optional header fields. We can add more than 20 bytes, but we will not consider what they may be in this course. We often won't see them, often not used. Then we contain data. The first field of the header indicates the version of IP we're using, version 4 or version 6. The second field indicates the length of the header because if we have options, it's not 20 bytes, it may be 24 bytes or 28 bytes or 32 bytes. It must be a multiple of 4. That's the rule here. The header length field counts in multiples of 4. That is the default size of the header is 20 bytes. The default value of the header length field is 5. So the implementation is that the header length field contains the value 5, meaning there's 5 times 4 bytes in the header. If the value is 6, it means there's 6 times 4 bytes. There's 24 bytes in the header. So it must be a multiple of 4. The total length field, of course, keeps track of the total length of the datagram, the header plus the data, where the data may be a variable size such that the total length goes up to about 65,000. Normally, in practice, we'll see it's much smaller than that. There are some fields that we'll not talk about or we'll not cover in this course. We'll not get into those details. Diff serve and ECN are two of them. They are used to give priority to some datagrams. This datagram gets higher priority for sending compared to another. Those fields can be used. We'll not look at them. Identification is like a sequence number. We send one datagram, then another. We can increment that ID. But note that it's not used for retransmissions. We have no retransmissions. So it's not used as a sequence number for retransmissions. Flags and fragment offset are used primarily if we need to split this into multiple fragments. Then we need to keep track of how many fragments or whether we have fragments and where this fits. So if we have one big datagram and we split it into two smaller ones, we say there are two fragments. And those fields would be used to indicate those two fragments. We will not look at fragmentation, so we'll skip over those fields. Header checksum is for error detection in the header. If the receiver receives a datagram and the checksum fails, it means there's some error in the header and it would discard the datagram. Source and destination IP address. The IP address of the original sender the IP address of the final destination. 32 bits each. And we finished last lecture giving an example of a 32-bit IP address. Time to live is like a hop count or a hop limit. Let's see an example of time to live in use. How can we measure the delay between two computers? We can use PIN from your assignment. If I PIN your computer, we've seen in our assignment that it reports the delay. But there's some other things here. PIN uses IP. It uses IP. Sometimes we don't call it a transport protocol, but what protocol do you think is used for PIN? It uses IP but some other protocol. The answer is on the screen. What's the acronym for the protocol used by PIN? Can anyone see it up there? And most protocols end with P. Protocol. What protocol do you think PIN uses? Just look at all those characters up there and see if you can see one that ends with P. ICMP. It's actually the ICMP sequence number we see here. ICMP is a protocol for diagnostics and error reporting. And that's really what PIN is used for to check whether the link works or the network works for some diagnostics. So PIN does not use TCP. It does not use UDP. It uses ICMP, which in turn uses IP. There are some addresses in here and we'll look shortly at the meaning of the addresses like the destination address, 10.10.6.1. We'll see that in detail. But the thing we want to show here is that in addition to the delay of each request and response, the response sends back a value called TTL, Time to Live. And the way that TTL works is like a hop counter. The source computer, when it creates the packet, sets the TTL field to some initial value, like 64. When they send that datagram to the first router, the router decrements it to 63. Then they send it to the second router, that router decrements it to 62. And in this case, when they send it onto the destination computer, that destination sees at 62 and sends back to my computer saying, the TTL, when it got to me, was 62. Now, like a hop counter, if it gets down to zero, it goes through all those routers and gets down to zero, then that router will not send it anymore. The packet dies. So it's time to live. The time for that packet to live in the network, which is the number of hops that packet may be forwarded. Before a router will say, I give up sending. Let's remove the packet. Very useful if there are errors in the network and if we didn't have a TTL, the packet could be sent forever. So with a TTL, we can force it to be removed from the network if there are errors. What does it tell me in practice here? It tells me between my computer and the destination computer there are two routers. I know it started at 64. If I see it was received at 62, it must have went from 64 to 63 to 62. It must have been decremented by two routers between me and the destination. So I can learn that from the ping as well. That's the time to live field. It's decremented by each router that forwards the datagram. Last field, the protocol field, when IP receives the IP datagram, IP must send the data up to one of the transport protocols, TCP, UDP or even ICMP. The protocol field is a number telling it which one to send to. There are some special numbers for each of those transport protocols, and that field contains that number set by the source. The numbers are defined by standards organizations, and on my computer the numbers are listed in a file. The protocol field gives a number for one of the many different transport protocols. In this file on my computer it shows me those values. ICMP is number one. TCP is number six. UDP is number 17. And there are many others there. So the protocol field keeps track of which protocol the destination must send it to at the transport layer, and it will contain one of the numbers there. So let's use a more detailed example to go through for real addressing and see forwarding through an internet to see how forwarding works and how IP addressing works. All right, some other features. Well, we've mentioned briefly fragmentation and reassembly, TTL we've mentioned. There are other features not part of IP which we will not cover, but do other things like error reporting, security, providing priority or quality of service, which are part of the internet, but not built directly into the internet protocol IP. How long is an IP address? It's a common moldy choice or a first question in the final exam. How long is an IP address? How long is an IP address? Something you must remember and be able to answer within two seconds of something asking you at the end of this course. Very important. 32 bits. And if you can't remember, look in the packet structure, the header structure. The source IP address field and the destination address field are 32 bits or four bytes long. That is IPv4 addresses, and that's all we're considering in this course. And for a 32-bit address, we can convert it into dotted decimal notation. We take our 32 bits, separate it into four groups of eight bits, convert each into decimal numbers, so we get four decimal numbers, separate them by dots, and we get four decimal numbers, just a different way to write an IP address. So the handout I've given you will use an example on there, but first we'll start with a simple case of an IP address. That's not the one we want. So you've got a handout which contains... it starts with this network, this internet that we're going to consider. And the circles and the oval in the middle are subnets. So we have subnets, and I've given them letter names. So we have subnet A, B, C, D, E, F and G. We have subnets. And then we have another series of subnets which up the top I've just said is the internet. So there are many other subnets up the top, but I haven't drawn them. That's like the rest of the internet. That's just on these set of subnets. We connect subnets together via routers. R1, R2, up to R6. So they are the routers that connect subnets together. And on subnets we may have routers attached as well as hosts. And in this picture I've only drawn host 1 and 2. But imagine there are many other squares around each subnet. Subnet D has many hosts. We just don't draw them. But assume there are hosts on every subnet. So what we're going to do is look at how do we give addresses to these devices? What types of addresses or what addresses they can be allocated? And that will lead to how IP addresses are structured. And then how do we forward data between hosts or from one host to another? So we'll start today with the IP addresses. And let me choose an IP address to say for host H1. I'll give you an IP address and then I'll explain later how I got it or the approach I arrived at. So let's first give an IP address for H1. The IP address for H1 and I'll write it in binary to start. 32 bits for H1. Convert to dot a decimal notation. Just remind yourself how to convert to dot a decimal notation. With dot a decimal notation, remember what we do is we split it into four groups of 8 bits. So I'm going to split at this point. Here and here. And then those 8-bit numbers convert to decimal. And I've made them quite easy, at least the first three. What's the first decimal number? One. The second one is also one. Third one is one. And the last one I made different. 1 plus 2 is 3 plus 8 is 11 plus 16, 27. So the IP address in dot a decimal notation, sorry, this is not I, I, I, it's 1 dot 1 dot 1 dot 27. Those marks are just where the split is. So same IP address. One is in the computer form, the binary form. One is in the human-friendly form, dot a decimal notation, which is easier for us to write and read. But your computer, when it creates the packet and the routing tables, they use the binary form. So an IP address, even though it's 32 bits, it's actually split into two parts. Some of the bits identify the subnet that this device is attached to. We're talking about H1. H1 is on subnet A. So this device is on a subnet. So in this address, some of the bits identify the subnet we're on, subnet A, and the remaining bits identify this device inside that subnet. So the rule is, or the rules that we use for IP addresses is that for all of the devices in the same subnet, maybe there's H1, there's R2, H3, H4, all on subnet A, the bits that identify that subnet must be common amongst all of their IP addresses. So of these 32 bits, we'll identify some bits as the network part, or the network portion of the IP address. The portion of the address that identifies the subnet of the network. And all the devices on the same subnet must have the same network portion. And the other rule, all of the devices on the same subnet must have the same host portion where the host portion is the remaining bits. If we split into two parts, the network portion and the host portion, every device in the same subnet has the same network portion but a unique host portion. That's the first rules for IP addresses. We'll see where that split is in a moment. The other rule we'll see is that inside our internet, the different subnets should have a different network portion. There's some exceptions we'll see but the idea is that all subnets in the internet will be identified by the network portion or a special network address. All devices inside one subnet will be identified by the host portion. So we have a hierarchy of addresses. So, I said that our 32-bit IP address is split into two parts, a network portion and a host portion. Where is it split? Well, there are different ways to determine where is it split into two parts. So it could be split at any point along here. Essentially it's the first n bits are the network portion and the remaining bits are the host portion. But where is the split? In the past there were just three places to split. The eighth, sixteenth and twenty-fourth bit. And we referred to classes of addresses. Today we can essentially split anywhere, after the first, the seventh, the twenty-third and so on. And that's called classless addressing and it's all we're going to talk about in this course. The point is to know where we split between the network and the host portion, we have a second address called a mask. A subnet mask, an address mask or simply a mask. So we need really two values. What comes with this is a mask. A mask is also a thirty-two bit address where it's a sequence of ones followed by a sequence of zeros where the ones indicate that the corresponding IP address, the bits are in the network portion. I'll give you an example and explain. And I'll draw, for this example, sixteen ones. Sixteen ones and a mask is thirty-two bits. So if we have sixteen ones, the rest are zeros. This mask, I've allocated to go with this corresponding IP address of host H1. What does it tell us? It tells us that the first sixteen bits of the IP address, if we split at this point, the first sixteen bits are the network portion. They identify the subnet that we're on. The last sixteen bits where we have a zero in the mask identify the host portion. So that's what the mask does. It tells us where the split is between the network and host portion. It doesn't have to be at sixteen. A different mask would put a split at a different location. And we'll see some examples of a different mask shortly. So, given this mask and the address of H1, it says that the subnet we're on starts with sixteen bits of seven zeros one, seven zeros one, those first sixteen bits. And this computer inside that subnet has the host portion followed by the last, of the last sixteen bits. Now let's consider another device on the same subnet. Look at your picture. Which other device is on the same subnet? On subnet A, we're dealing with H1, subnet A. There is another device. It's router two. When we're talking about IP addresses, all of the devices, both routers and hosts, need an IP address on that subnet. So now let's consider on subnet A, there is router two and more specifically, router two has two interfaces in this example. So I've labeled the interfaces by numbers. Router two interface zero is on subnet A. Router two interface one is on subnet B. You can think router two has two cables plugged in. One is interface zero, one is interface one. We're dealing with interface zero on subnet A. We'll come to interface one later. So, because router two and host one are on the same subnet, they must have the same network portion in their IP address. So let's see some potential values for IP address of router two. Router two interface zero. No, the router two has two interfaces, so distinguish there. Because it's on the same subnet, the first 16 bits must be the same as H1. That's the rules of our IP addressing, because that is the network portion of the address. The devices in the same subnet have the same mask. So they both use this one mask. And the other rule is that the host portion of those devices must be different. If H1 is this host value, R2 must have a different host portion. What value could it have? There are many possible values, as long as it's different from those 16 bits listed for H1, with a couple of exceptions. How many possible values could the host portion take for R2? 16. 16 possible values. No, not quite. Much more. How many possible values could it take? There are 16 bits. That is, R2 must start with these 16 bits. They're on the same subnet. We have 16 bits to choose from here. So there are two to the power of 16 possible values. About 65,000 possible values. Except we can't use what H1 is used. We must have unique addresses. Every device in the same subnet must have a different host portion. So we cannot use the one that H1 has, and there are two special cases we're not allowed to use as well. We cannot use an address which is all zeros in the host portion, and we cannot use an address which is all ones in the host portion. We'll see shortly what they use for. So two to the power of 16 possible values minus the two special cases, minus that one in use, choose one of them. I'll choose one that's easy to write down. That's the value I'll choose. You could have chosen another value. We'll talk about later what values you should choose, but here one of any possible values which doesn't match H1, and it's not the two special cases. So in dot a decimal notation, we know that H1 is, we'll write it up here, 1.1.1.27, and we now know router two interface zero, easy one. And those two addresses meet our rules that the network portion is the same and the host portion is different because they're on the same subnet. What's the dot a decimal notation of the mask? The mask also can be written in dot a decimal notation. The mask set eight ones followed by two sets of eight zeros. So the mask, which is not used to identify a device but is also a 32 bit IP address we can write in dot a decimal notation. And really what we think about for devices they have two addresses. The IP address and the mask. They go together. And the mask we can write in even a shorter version because there are 16 ones, another version to write it is a slash followed by 16, a slash notation. That is, the mask can be written as the binary form, the dot a decimal notation or the slash notation, slash 16, simply meaning 16 ones and the remaining zeros. So we'll see some other examples of the network but just recap on those rules. All devices in the same subnet will have the same mask and the same network portion and they'll have a different host portion. If we added another host it would start with the same 16 bits and have a different last 16 bits. You can write those two values in the table on that handout. There's a table, you've got a table you can start filling some in and there's an error on your handout. This should be a one here. R11, there's only interface one. We just did router 2 interface 0. What IP address did we get? We chose 1.1.1 slash 16. So that's how we write both the IP address and the mask because the mask should go together. We could write the full notation for the mask but it's easier just to write slash 16. And down the bottom you can fill in for host 1.1.1 and I chose 27 also slash 16. You'll fill in the rest later as well. Why did I choose these particular values? Just for this example so the first network portion is 1.1 was assigned to the subnet and the host portion I just chose let's say some random values for these two devices. The main rule is that they cannot conflict. Any questions so far before we look at some other subnets and other addresses? The slash 16 I gave you at the start I said that for this subnet there's a mask assigned for the subnet which started with 16 ones and followed by 16 zeros. So the 16 ones we write in short hand notation of slash 16. Instead of writing 16 ones and then 16 zeros I can just write slash 16. But it was assigned to the subnet. I chose it. I'll tell you how shortly or how you would get that. Any other questions on this example so far? What do you know? What is the network address? Good question. Let's move on to that then. Okay. Alright. So back to our example. We'll keep filling that in later. So focusing just on subnet A. We've currently got two devices attached and we know how to give them addresses. Sometimes I don't... Well in my IP routing and routing tables I don't want to have to call it subnet A. I want to give it a name based upon an IP address. So instead of saying subnet A I want to say subnet with this IP address. So normally IP addresses are for devices. But there's a special case address that we can use to refer to the entire subnet. Instead of saying subnet A we'll refer to it by an IP address. And it's quite simple. The IP address of subnet A starts with the same network portion and the host portion is all zeros. So subnet A has a special IP address. It's not a device, it's an entire subnet but we can also use an IP address. Same network portion. It's the same mask. The mask is the same for all the devices on the subnet. And the special case is that we set the host portion to all zeros. All binary zeros. And therefore we get a subnet A which has the address 1.1.0.0 and we can write slash 16 to be complete. We should do that for all of them. So this is a special case address. It's an address that doesn't identify one device that identifies an entire subnet. So I don't have to refer to it as A and H1 and R2 now. We can refer to it as 1.1.0.0 1.1.1.27 and 1.1.1.1. So now we have IP addresses for devices and subnets. Note that this all zeros host portion we cannot use this special case address for a device. I cannot give my computer this address because it's reserved for the entire subnet. That's why I said that there are two to the power of 16 possible values but we can't use this one. And another special case we can't use is all ones here. That has another special purpose. And you have a table that you can fill in the subnet address. In this table on your handout the subnet address or simply the network address is the subnet A1.1.0.0 So that's the network address there. The other special case when we have all ones in the host portion will be the directed broadcast address. I will not explain that yet I'll explain it tomorrow but that's the case where we have all ones in the host portion, another special case. So let's look at the other subnets. First, maybe let's talk about in practice where do these values come from? We don't just choose them randomly. Firstly, the network portion those first 16 bits which are the same for everyone in subnet A and the mask of slash 16 where does that come from? In practice, let's say you set up your own company and you want to have your company network connect directly to the internet. So to do that you need to get a subnet mask and a network portion and it should be unique in terms of the rest of the world the rest of the internet. And what you do is you go to an organisation that allocates these network addresses and in Thailand for example there's a Thai network information centre it has an office at Science Park and you go to them and they keep track of all the currently allocated addresses and they give you a new one. Maybe you go to them and you say I'm building a network and we're going to have about a thousand computers attached. Then they may say well here's a subnet mask of maybe slash 18 and here's the first 18 bits here's the network portion you can use this value and it will be unique for your network. So you get this first network portion from an organisation that keeps track of the addresses say in Thailand and that works with organisations in other countries to keep track of the addresses used in the world. Once you get the network portion and the subnet mask the host portion you can allocate as you like to the devices inside your network. You attach your laptop you can give that its own host portion. You attach a phone gets another host portion and it's up to you the manager of that network to ensure your devices have unique host portion addresses. Normally there are protocols that would do it automatically for us like THCP. So in practice it's allocated to an organisation that connects to the network where all subnets should have a different network address. So in this example I'm going to allocate some subnet addresses to the other subnets so we can move on and look at the example. You can fill them in in the table on the handout. I'll write them on the picture so it's a little bit easier to see. We'll start with the network addresses. So for subnet A we've got, I can squeeze it in here what do we say 1.1.0.0 slash 16. That was subnet A and we've I'm not right but we know H1 and we know R20 for subnet B I'm going to allocate a different network address 2.2.0 These may not be realistic but easy for us to do in the example. And here we'll allocate 3.3.0.0 slash 16. We don't have to use slash 16 in all subnets. What why does it make a difference? Let's allocate some different ones and explain why. This one will do 4.4.1.0 slash 24 and 4.4 and they don't have to be 16, 24 or 8 that could be 25, 23, any number really where we can split. We'll see that 16 and 24 are easy for our examples. The difference why would we be allocated slash 16 or slash 24 is to do with a number of possible values with a slash 16 for example a mass of slash 16 there are 16 bits in the network portion and 16 bits in the host portion with this mask we have 24 there are 24 bits in the network portion and the remaining 8 bits in the host portion given those values let's look at if we had an internet and every subnet use a mask of slash 16 we have 16 bits for the network portion our rule is every subnet if we have 16 bits how many possible subnets are there in our internet well if there are 16 bits there are 2 to the power of 16 possible values for the subnets which is approximately 65,000 how many possible hosts in each subnet well one subnet we have 16 bits for the host so we have 2 to the power of 16 minus some special cases but it's still approximately 65,000 that is let's say we build an internet and we just use slash 16 as the mask then that means we can have about 65,000 subnets in our internet in each of those subnets we can have about 65,000 devices attached and that determines the entire size of the internet what become 65,000 65,000 which is what 65,000 times 65,000 is about 3.5 billion that is there are about 3.5 billion possible 4 billion possible addresses how many people in the internet how many IP addresses do you think we have in the internet how many devices do you think attached to the internet today about 7 billion more more than a billion more than 10 billion how many people in the world about 7 billion people but many people don't use the internet but many people access the internet by multiple devices and in fact nowadays there are many devices that we don't even touch that are connected to the internet sensors, routers that have multiple IP addresses billions of possible devices that want IP addresses and one of the problems with IP version 4 is that there are not enough IP addresses for all the possible uses and that's the reason IP version 6 has been designed or has been deployed because IPv6 has 128 bits in the address now we're gone off track we were talking about the total number what I'm trying to focus on the difference between slash 16 and slash 24 with slash 24 how many possible subnets to the power of 24 which is what 16 million approximately 16 million subnets and in each subnet how many hosts 2 to the power of 8 256 minus the special cases what's the point here with a smaller subnet mass slash 16 smaller than slash 24 we can support larger subnets that is each subnet can have more devices but fewer subnets in the internet with a larger subnet mass slash 24 we can support more subnets but in each subnet smaller that is if your company gets a slash 24 address you cannot attach more than 256 devices to your network if you have a thousand devices they will not all get a unique IP address and you'll have problems we have to have other solutions so that's one of the trade-offs about the different masks and in the internet today different organisations have been allocated based upon their requirements larger ISPs are allocated with the smaller masks and in fact then they divide it up and suballocate to other organisations and customers it gets more complex than what we'll go through but the masks are different in different subnets so let's just complete the subnet addresses so we can set up the example for tomorrow this one I'll give 3.3.28.0 slash 22 something different and this one 3.3316.0 and I've just chosen a value so we can demonstrate a few different things in this example your homework for tonight and you need to do it before tomorrow morning because we'll continue from where you left off and it's very easy given this I'll go back what I'm writing on the picture is these network addresses so you can fill them in what I want you to do is choose some IP addresses for all of these devices fill in this table the second table given the subnet addresses the routers especially and maybe host 2 and the rules are all devices on that subnet must have the same network portion as the network address and the host portion you can choose any value you like as long as unique now maybe what you want to do is choose it in pencil because the ones I will choose tomorrow will be different from yours so if you want to follow my example the host portion you won't have to complete that but make sure you know the network portion in your address so your homework fill in the 2 tables on the next page and then we'll continue from there and just as a bonus if you want you can fill in this column as well and we'll explain it tomorrow but the value is the same as the network address but the host portion is all binary ones in the network address the host portion was all zeros in the director broadcast address the host portion is all ones then we'll explain that