 So in the internet, we distinguish between hosts and routers. Hosts create the datagrams and consume them, that is, they're the sources and destinations. Routers typically forward datagrams. And we've looked at the structure of an IP datagram, including the header includes the source address and destination address, where the source is, for example, if we want to send from one source by a set of routers to the destination, we create an IP datagram, set the source address to the address of this computer, and of course set the destination address to the address of the final destination. And we send via a set of routers. We'll see in a bit more detail of those steps of forwarding. And we'll see, we know so far that an IP address is a 32-bit value. And we saw a quick example yesterday of how to represent that 32-bit value in a human friendly dot a decimal notation. We'll see some more examples of that today. But before we look at how to forward data via the routers, let's go back and look, well, how do we find a path? How do we know which routers to go via? We have a network, source wants to reach the destination. How do we find the path? Well, we already know the concepts of routing that we use are the shortest, least cost routing with different ways to find the best path through the network. What does IP do with respect to routing? In fact, the internet protocol doesn't specify how to perform routing. That's left to other protocols. IP is about forwarding. Once we have a path, IP gets the data from source to destination. How to get a path there are other protocols available. These are some RIP, OSPF and others. But from IP's perspective, it assumes that these other protocols create routing tables. Again, we've seen routing tables. The simplest form we saw was that a node has a routing table that says in two columns, the first column says to reach this destination, the next node in the path is this node. So we have destination and next node. When we talked about routing, we said that there's no need to store the entire path. We do not store destination path to destination. We store destination, the next node in the path to the destination. And we use that routing table to send to that next node. When the next node receives that datagram, it will look up its routing table. What is the destination? What is the next node in the path to reach the destination? Send to the next node and so on. From IP's perspective, some other protocols create the routing tables, put the data inside the routing tables. IP just uses those routing tables. And to make the routing tables manageable when we have a very large network like the internet, billions of devices, hundreds of thousands of different subnets, to make the routing tables manageable that is small and able to update quickly, we have some not shortcuts, but some ways to store the data in a better form. And one of them that we've already mentioned is this, we store the next hop in the route. We don't store the entire route. So that's one way to simplify the routing table. Don't store the entire path, just store one node in the path. But there are two other ways that we want to look at which is network specific routing and default routes. And I'm going to use this example network to show that it comes from, in your handouts you have at this picture, it's after this internet working slides there's two examples, or two other handouts. If you keep going you'll see there's a topic on IP addressing summary, there's a handout on IP addressing summary, and then some internet work in practice. And in that internet work in practice you'll see this picture. I'll show it when we look at that practice, but let's go and use it for this example. What does it show? It shows a simple internet with some hosts and routers. And to make our life easier, I've given them some names or some labels. In reality they should have IP addresses, but to keep this example simple, I haven't yet given them IP addresses. I'll refer to them by their name, for example, host4, H4 that would be an IP address to identify that host. The way to interpret this diagram for this example is we can think of subnets. That this for example is one subnet and another subnet is this one. And a third subnet is here. And a fourth subnet. And I will not draw anymore. So remember our internet is made up of subnets connected together by routers. So the four I've just highlighted, the four subnets all connect to this one router here, router A. So we have a subnet, so think this router connects to four different subnets at the same time. One has currently a single host attached to that subnet. So one say PC attached. The second subnet here has two hosts attached, H2 and H3 via some switch. So think of this maybe as a wired land. This is one local area network. This is another local area network using maybe a different technology. And maybe between router A and router C is a wide area network. Maybe it's a satellite link. We don't care of the technology here but it's a subnet connecting them together. And a fourth subnet. And let's say another subnet there. So between the routers let's say they're all subnets. I will not circle them all but of course we have one here. How many subnets in total? We currently have six subnets. Then think look between the routers. Here's another seven, eight, nine, ten, and eleven. So just in this example internet we have eleven subnets. Let's give some of them a name. So I can refer to them easy. Let's call this one net one, subnet one, network one. Unfortunately we often mix between talking about subnets and networks. A subnet work is, or an internet is made up of multiple subnets. But sometimes we call those subnets just networks. So it gets confusing. But that's reality. Let's call this one net two, net three, and net four because later we may want to refer to those, especially those subnets with hosts. So of course I could call this one net five, net six, net seven, net eleven. But I won't need them in this example. Let's create the routing table for some of the nodes. First let's concentrate on router C as an example. So all hosts and routers have a routing table. And we would use some routing protocol to automatically create the data in those routing tables. Or we could manually configure those routing tables. In a small network we could program the routing tables. But in a larger network we want some protocol to automatically create the routing tables. Let's say we focus on router C for a moment and look at the routing table for router C. And to keep it simple, we'll assume that the possible destinations are these six hosts. So from router C's perspective the routing table should say to reach those six hosts, those six destinations, what are the next nodes in the path. And let's use shortest list hop routing. Sorry. We want to find the path from C to H1. What's the best path in terms of hops? C, I think you'll see C to A to H1. So here hops means how many subnets we go through to get the destination. So from C to H1 the best path it says C, A, H1. So the routing table for router C would say to reach destination H1 send to router A. But let's be more specific because router A actually is connected to four subnets. Think of router A as some computer with four cables plugged into it. Four different interfaces to each of these four subnets. So I've actually labeled the interfaces. So we can talk about interface A1, A2, A3 and A4. So I don't know if we'll see today but in the practice questions you'll see that interface actually will get an IP address. Well that's not important yet. So for router C to get to H1 the next node let's say specifically is A3. The next node is router A specifically interface A3. So in fact we normally don't just refer to the node, we refer to that interface on that node. From router C's perspective to reach H1 send to A3. Now do it from router C as the source to each of the other five hosts to create the routing table. Try and discover the least hot paths. And I'll start writing. So find the routing table for router C. Grow it down here. The routing table for C we have some destination in the simple terms and the next node. And the destination to reach H1 we said the next node was router A but let's be specific and say A3 interface A3. And then we can do it for the other hosts. H2, H3 through to H6. Where do we send to from router C to get to H2? What's the next node? A3 it's also A3. To get to H2 this is one subnet here. It's just an ethernet switch drawn here. To get from C to H2 I would also go via router A specifically to A3. And I think you'll see to get to H3 I would send to A3 we'll come back to H4 to get to H5 where are we going to send? From C as the source to get to H5 send to what's the best path to C to where? C wants to reach H5 what's the path to take? D3. So send via router D so specifically C would send to D3. And H6 D3 would be the next node. What about H4? For C to reach H4 send to as the next node or direct to H4 we don't need to send to another router we send direct to that destination. So we could say send direct to H4. So in fact if this is the source if the destination is on the same subnet as the source which H4 is then almost that's a special case we don't need to send to another router. There is no next router we send direct to the destination so let's write that in the routing table. So H2 was also A3, H3, A3 H5 was D3 H6 D3 and H4 I could say direct to H4 I'm just going to write so we're clear direct. So we know that this is a little bit different we don't send to another router we use the subnet technology to deliver direct to that destination another way you can interpret this direct means H4 is on your subnet so use whatever technology you have whether it's Wi-Fi, Ethernet or something else to send to it. So there's a routing table for router C now we can simplify that routing table and it's common in networks that we don't store routes to individual hosts we use what's called network specific routing so in this case I created an entry for each of the hosts. Imagine we need to do this for some router in the internet. How many hosts in the internet? A billion hosts. My routing table would have a billion rows in it. There's no way I can storing that is a problem that's the first thing using up memory but more importantly those hosts come and go in the internet they're not always present, they're not always on and new hosts arrive. So there's no way I can manage a routing table having routes to every possible host in the network. So one way to simplify that is to instead of having routes to individual hosts have routes to subnets and deliver the data to the subnet and then use a router on that subnet to deliver to a specific host. So let's draw the routing table again but simplified. We'll have a destination and next but instead of having destinations as hosts we'll say that the destinations may be these subnets net one, net two, net three, net four. So for router C to reach anyone on net one send to A3 to reach anyone on this subnet send to A3 for router C to reach anyone on this subnet also send to A3 anyone on the local subnet send direct, net four, sorry, net three and anyone on net four send to D3. Let's write down that routing table and then see how it's used. We've simplified this routing table now and instead of routes to individual hosts routes to subnets in this case to net one through to net four the networks which are potential destinations and now imagine a larger network which has thousands, hundreds of thousands of hosts where some of the subnets maybe have, think of SIT as one subnet, there may be hundreds if not a thousand hosts on this one subnet. So for routers to reach any host inside SIT instead of having routes to those individual hosts they just have a route to one subnet. So greatly reduces the size and the need to update that routing table. So what happens, how do we use that routing table? All nodes would have routing tables D, F and so on would have routing tables. Let's say we router C has data now to send to H5 so it has an IP datagram the destination address identifies H5 that's where we want to get the data to. Maybe it came from H4 sent to router C and now C is going to send it towards H5. Firstly for this to work we need some way to know that H5 is on network net four because in the datagram, the IP datagram in the destination address identifies H5. But how does C know that H5 is on network four? So we need some way to know that. And when we return to IP address we'll see that an IP address, those 32 bits it encodes two pieces of information. It encodes the network address like net four and the host address like H5 so an IP address actually is broken into two parts a part that identifies the subnet and a part that identifies that host in that subnet so we'll see that when we come back to IP address so if we can do that then what happens C has a datagram destination H5 looks and recognizes okay H5 is on net four. It will look in its routing table and say okay to get this datagram to net four I will send it to D3 so it sends the datagram to D3. D3 would have a routing table. Datagram destined to H5 I will not draw the routing table for D so router D has a routing table but I think you can see that the routing table would say to reach H5 or to reach net four send to F specifically F3. F will receive the datagram. Destination is H5 from F's perspective H5 or network four is directly attached. This would be a case where we don't need to send it to another router because the destination is on our subnet. This would be an entry that says to reach anyone on net four F sends direct to the destination. So F realizes oh H5 is on my network is on my wired LAN. Now just use the wired LAN technology the protocol inside the LAN to send to H5 and H5 will receive the datagram. So in the internet this is what's used that we route packets to networks and then that final network will deliver the packet to the specific destination. So from C's perspective it sends it to network four by delivering to D. D sends the network four by delivering to F. F is attached to network four so now sends directly to H5. So the routing tables don't have to host they store routes to networks or subnets. Any questions on that simplification of routing tables? How to reduce the size and the effort to manage the routing table? Then draw the routing table for host H1 quickly for H1 which also has a routing table come up with its come up with a routing table for H1. Destinations now again don't come up with routes to individual hosts come up with routes to net one, net two, net three, net four. What are the routes to those four networks from H1's perspective? Where does H1 send to to reach network one direct? The picture doesn't capture it so well but H1 is on network one. So anyone else on network one that H1 wants to send to it doesn't need to use the router to send it by. It sends it via the technology used inside that subnet. This picture shows a link here but imagine that network one was using Wi-Fi. H1 was my laptop and there was some other host H7 who was someone's mobile phone and I want to send to them. Well I don't need to send out to another router I just use the Wi-Fi network to send direct to them. In fact with Wi-Fi I'd actually send to the access point. It's not a router it's an access point which would send to the mobile phone. So anyone on the same network as you you don't need to send to a router you can send direct to them. So I'll just note that direct to network one. What about network two? Where does H1 send to? A1. To reach network three where does H1 send to? A1. To reach network four. A1. Okay there's our routing table. Well we can simplify that even further. From H1's perspective we see one router that it's connected to. So the only options it has are the direct or send to A1. Doesn't matter who the destination is out on this network on this internet maybe there's network five, network six, network seven over here. From H1's perspective it must send to A1. We call that a default route and we can write a routing table in a simpler form. Again to reach network one send direct to reach anyone else send to A1. Where I would know anyone else as we match some wild card that is star. How often we use star to mean any value. Some wild card matching. So instead of having a route for all the other networks we have just one route and we use some form of pattern matching to say okay and sorry I skipped something. Let's process the route that entries in the routing table in order. So H1 has a packet an IP datagram. It looks at the destination address. If the destination address is on network one it will send direct. If it is not on network one it will look at the next row in the table and the next row says if the destination is any value star any value which it is then send to A1. So it will send to A1. Doesn't matter if it was to net two, net three, net four it must go to A1 and then router A would use its routing table to send to the correct next node. So now we've simplified the routing table for the host to have just two entries. Even if there are 100,000 networks in our internet we don't need 100,000 entries here we just need two. One for the local directly attached subnet, one for everything else. So this is default routing. We have some default route to take if none of the others match take this default route. We can also do it on the routers, use default routing. So what we do now is we think we check the rows in the routing table one by one from top to bottom. If the row matches then send to the destination. If it doesn't match try the next row. Try the next row. And usually we think as the bottom row would be the default that is if none of the others matched send to this destination. So in an internet that has a billion hosts by using network specific routing and by using default routes we can greatly simplify the routing tables from millions to billions of entries down to several entries for hosts and for routers in complex network we may be talking about hundreds maybe thousands of entries but still very small compared to the potential if we don't use these techniques. So that was the concepts of network specific routing, route to networks not hosts and default routes. Use some form of wild card or pattern matching to use a route to cover all other cases a default case. Any questions on routing those simplifications of routing tables now let's assume that we have all the routing tables created. So somehow either a routing protocol or someone manually entered the data into those routing tables configured every router every host to have a routing table. Then we want to send data from some source host to some destination host. What does IP do to deliver that data from source to destination that's what we want to focus on. And we've said that the source host must implement IP so does the destination host and as do the routers they must implement this they must implement the internet protocol. So we want to go through the source host is going to create some data so the user maybe opens their web browser and tries to visit the Facebook web server and we're going to magically assume that the user knows the destination IP address. So we know the destination or the IP address of the destination host. It's magic because we need some other ways to do that. When you visit Facebook you don't type in the IP address of the Facebook web server you type in a domain name. There are ways to map the domain name to the IP address but for now assume the source knows the IP address of the destination. He wants to send the datagram there. Some application protocol goes to work for example HTTP creates a HTTP message sends it to the transport layer and a transport layer protocol like TCP goes to work and creates some data and then sends that to IP. Now what does IP do? That's what we want to focus on. So how does IP forward the data through to the destination? But first before we go through and see what does it do, where is IP implemented? My source host is my laptop, where is IP on my laptop? Anyone want to guess? First is it software or hardware? Is it some logic in the motherboard or hardware or is it some application or piece of software running on my computer? It's software, in most cases it's software. So it's usually implemented in software. It's a piece of software running on my computer. Where? Or where did I get it? Did I install it? No. Do you think I installed some piece of software called IP? Did you? Do you remember installing something called IP? I don't think so. So where did you get this software from? It came with your operating system. It's implemented in the OS. So if you've got Windows then one part of Windows is some software that implements IP. You could probably find the DLL or some file there that contains the binary for IP. In Linux there's some code that implements IP inside the kernel. And you can actually find the source code. It's some C source code that shows exactly what IP does. So it's typically part of your OS, the operating system. And as an aside, the transport protocols also are typically part of the OS. So in terms of implementation, often we think that the bottom two layers are in hardware like your LAN card. IP and the transport protocols are implemented by the OS. Application protocols by applications like Firefox implements HTTP. So let's look what IP does and what it does is capture it in this flow chart. So let's go through this flow chart and first we're executing, so this flow chart is really what the IP software does, but a very simplified version. So let's say we're executing this on the source host. And what this flow chart shows is that this is IP in between these dash lines. Above is the transport protocol. Below is the data link layer. So at the source host, how to get started, we receive some data from the transport protocol. Source application creates some data to send to the destination that flows through the layers and the transport protocol sends the data to IP. And that's shown, try to capture it in this flow chart here. Here's the data coming from the higher layer sent to IP. So IP receives data from the transport protocol. In fact, it doesn't just receive the data we want to send, the transport protocol also says at least who we want to send it to. The transport protocol says what is the destination IP address? For example the IP address of the Facebook web server. So IP now has this data. First thing, create a datagram. Take the data attach a header, fill in the fields of that header including setting the destination IP address in the header to be this value. Then we go to the next step and my source host checks is the destination IP address the one we want to send it to is it the same as my IP address? Do you think it's true in this case? Yes or no? Is this datagram destined to my computer? And just to give you the hint, we're focusing just on the source host. So we're looking at what happens inside this block and that's what the flowchart represents. So when IP checks, I've got a datagram destination is that of the Facebook web server over there. Of course it's not the same as my IP address. My IP address is not that of the Facebook web server. So the answer here is no. This datagram is not destined to me okay, so no. So now what we do is we check the routing table. We look for that destination in the routing table and find the next node to send it to. So whatever the routing table says we would see okay, the destination Facebook web server, the next node is router one. That's what the routing table should say. There should be some value in the routing table if not there's some error. Let's ignore the error case. So we find the value from the routing table or we look up the routing table, search for the destination. If we have an entry then the next node or the next hop we send it to that next node. And that's shown in the flowchart that we get the next hop address, the address of the router and use the data link layer to send this data or the datagram to that next node. And this is where IP finishes because we send it to the data link layer that takes over now and transmits it across the link. So what's happening between those dash lines is what's happening inside here. We create a datagram it's not destined to us so we look in the routing table and realize that we need to send it to router one. So we use the data link layer to transmit that datagram to router one. Router one receives the datagram or IP at router one receives the datagram from the datalink layer. What does IP do now? Well we look at this portion of the flowchart. When we receive from the datalink layer some IP datagram is this datagram destined to me? Well from router one's perspective no. Router one looks in its routing table and looks up the destination is Facebook. The next node to reach there is router two. So we get the address of router two and send using the datalink layer to router two and flipping back to this slide we transmit across subnet B to router two. And router two will do the same. Receive okay it's not destined to me then look in my routing table realize I need to send to router three and keep going. It would get to router N receive the datagram's not destined to me therefore look in the routing table and see I need to send direct to destination host because router N would realize that the destination is on my subnet we've reached the last router here. We would send to the destination host IP receives the datagram from the lower layer at the destination host. We receive is the destination of this datagram equal to my IP address yes it will be in this case because this is the destination host. So yes what do we do? Remove the header we don't need it anymore and send the data up to the transport layer and eventually up to the application and we've delivered the data that is sorry wrong way. Destination host receives it is destined to me therefore remove the header and send the data up and that would process and eventually we've received the data. So that's the basics of IP just create the datagram of the source and use the routing table to determine who to send it to next. Send it to the next router that will send it to the next router next router until it gets to the destination which removes the header and processes the data. It's very simple one of the simpler protocols you'll see from the high level perspective there are no acts okay there are no retransmissions there's no flow control no setting up a connection just forward the datagrams through the network. So this flow chart tries to capture what does IP do in each node. So you can think this is implemented in software in your laptop in your mobile phone in all the routers. It may turn out in some routers parts of it could be implemented in hardware just to make it faster. Any questions on IP forwarding I don't ask you to remember this flow chart the details of it but I think you should be able to recall that well what's the general procedure. Use the routing table to send to the next node until it gets to the destination remove the header and process the data. It's very simple of course this assumes the routing tables are set up correctly and exist. There are a few other features of IP I will not go into how this works. Fragmentation and reassembly is the idea as we have an IP datagram our subnet only supports sending frames of a particular size the datagrams too big to send. So IP includes the capability to break that datagram into smaller datagrams. It performs fragmentation and creates many smaller fragments and sends the fragments one at a time and then at the destination it reassembles those fragments to get the original datagram. Have a look through those slides to see how that works. This one we've mentioned we've said inside the IP header there's a time to live field like a hop limit the source sets it to some value like 64 sends it to the first router it will decrease to 63 the next router 62 and once that hop limit or time to live gets 0 the routers will no longer send it they'll discard it. So it limits the number of routers we traverse. It's useful if there are errors in the network so that the datagram doesn't get sent forever we've mentioned that before the main features of IP we now need to return and finish on IP addressing especially because we said now that we have routes to networks or to subnets. My routing table stores routes to individual subnets not just to hosts. So for that to work if I have a datagram destined to some host we need to know what subnet that host is on now the way we do that is we use the IP address and the IP address encodes both the host and network information so let's see how that works. IP addresses we know are 32 bits IP version 4 addresses so that's what we focus on 32 bits and of those 32 bits we split it into two parts or two portions one part of the address identifies the subnet and the other part identifies the device inside that subnet and we call them the two parts the network portion and the host portion and that allows us to do network specific routing to say the IP address of this laptop identifies the laptop inside the SIT subnet but it also identifies the SIT subnet inside the wider internet that's the idea. Therefore when someone wants to send to my laptop they know my IP address from my IP address they know what subnet I'm on the SIT subnet so all they need to do is get that datagram to the SIT subnet and then the router in the SIT subnet will deliver to my laptop so we have two parts of the address now all of our devices in the internet or all of our hosts have IP addresses and we'll see also our routers have IP addresses so remember our internet is made up of multiple subnets connected together by routers the IP addresses must be distributed amongst those subnets such that all subnets have a unique network portion in the IP address the way to think of that is that all subnets have an identifier that uniquely identifies them in the entire internet for example I can talk about the SIT subnet the Toshiba subnet or the next door maybe different parts of Thomas Art University the faculty of engineering subnet and so on so all subnets in the internet will have a unique identifier we cannot have two SIT subnets in the world that's the idea and what is this identifier it's part of the IP address we'll see the part then within one subnet for example within SIT subnet all the devices my laptop this desktop PC your mobile phone when you connect to the SIT wifi all of them have an IP address and that IP address again is split into two parts one part the network portion for all devices inside SIT they must have the same network portion of the address but they must have a unique host portion because they are different devices let's alright we'll get to the what we mean by the network and host portion in a moment or an example let's go direct to an example then we'll come back and you don't have this but we'll I'll make it available later but just focus on the coloured part moment this is an IP address 32 bits binary IP address when we talk about the network and host portion we say some bits identify the subnet in the internet and the remaining bits identify that device inside that subnet and in this example the red ones identify a subnet and the blue ones identify the device in that subnet so what you can think is if you think of all the subnets in the internet they have unique red values network portion of the IP address and all devices within one subnet have the same red values network portion but different blue values the host portion so if this is the IP address of my laptop which is inside the SIT subnet then we can think the red bits identify the SIT subnet inside the internet the blue bits identify my laptop inside SIT so if we looked at someone's mobile phone inside SIT's subnet they'd have the same red bits but a different types of blue bits so unique subnets and within subnets unique hosts so we split the IP address into two parts the next thing is where do we split it why did I split it such that the first 18 bits were the network part and the last 14 bits were the blue part well we have some other way to determine where to split that IP address so back to election notes and over time as the internet has been developed they've developed new ways to determine this split between the network and host portion originally we had what was called classful addressing there were five classes of addresses class A, B, C, D and E and the class of the address indicated which bits identify the network and which identified the host so class A for example the first 8 bits were the network portion the last 24 bits the host portion class B it was 16, 16 class C it was 24, 8 so split at different parts but there were some limitations of that approach that is not very flexible you can only split at 3 in practice at a few locations there was an improvement called subnet addressing and eventually class less addressing class less addressing is what's mainly used today in that the split between network and host portion is determined using another address another special identifier and we can split anywhere we like in theory so we're going to focus on class less addressing go straight to the one that's used today class full addressing is still mentioned and you'll still see the concepts come up there are a few slides at the end on class full you can look through that in your own time so that we can route to networks not just to hosts that's very important to make sure that when our network is big that our routing scales well we know how to write binary IP addresses in dot a decimal notation we had an example yesterday class less IP addressing we have an IP address 32 bit value and we have an additional special address called a mask or an address mask a subnet mask or just a mask this mask identifies for the IP address where the split is between network and host portions the mask is also 32 bits in length and the way that we use it is that a bit one in the mask tells us that the corresponding bit in the IP address is part of the network portion a bit zero in the mask tells us the corresponding bit is part of the host portion so this example here here's the IP address say of a computer the top 32 bits the mask goes along with it that is now we have two identifiers the actual IP and the mask and this mask tells us the first when I counted them this morning how many zeros 10 the first 22 bits of the IP address so up until here identify the subnet and the last 10 bits identify the device inside that subnet that's how we use the mask it just tells us where that split is go back to a different example actually yesterday we looked at the IP address of my wireless LAN interface on my laptop it's a different one today the IP address is 192.168.1.210 in dot a decimal notation you can convert that to a 32 bit value in binary but also with the IP address is a mask and in this case the mask for my IP address is 255.255.255.0 again in dot a decimal notation convert it to binary what do you get the mask and a mask is usually ones in a row followed by zeros so 255 as an 8 bit binary value is 8 ones 255 is 8 ones dot 255 is another 8 ones so we have 16 ones dot 255 so another 8 ones so we have 24 ones and zero in decimal is zeroes in binary so my mask in this example is actually a 32 bit value of 24 ones followed by 8 zeros what that tells me is my IP address the first 24 bits in my IP address identify the subnet I'm in the last 8 bits in my IP address identify my specific computer inside that subnet if I have another computer in that subnet the last 8 bits will be different from mine that's the rule that different devices need a different IP address the different post portion in the same subnet so now we always have these two addresses for our devices so we don't just have the IP address we also have the mask another example try again so in this case the top address is the example IP address let's say the address of a computer and this is the corresponding mask that comes with it and the mask is 18 ones followed by 14 zeros we can write the mask in binary we can write it in dot a decimal notation so 251 255 8 ones 255 followed by 2 ones and 6 zeros 2 ones followed by 6 zeros in decimal is 192 and then 8 zeros at the end 0 so we can also convert the mask to dot a decimal notation but because the mask is typically a sequence of ones followed by zeros an even shorter way to write the mask is what's called slash notation a slash followed by the number of ones slash 18 because there are 18 ones here so three different ways generally to write the subnet mask two different ways to write the IP address binary or dot a decimal and now with our device we need to know both of those values IP address and mask so for example I can write my device address as 104 dot 209 dot 61 dot 169 slash 18 which tells me these two values and it tells me these 18 bits identify the subnet I'm on and these 14 identify the my device inside that subnet any questions so far the best way to understand a lot of the IP addresses is to practice with some questions and in your handouts I don't have it on the screen but in the handouts there's a handout titled I think internet working practice which has a number of questions mainly on IP addresses so you can try them to to make sure you understand the structure of IP addresses let's consider a new example so let's consider a single subnet some subnet and we're going to have some computers attached so these are our computers and maybe there's a router even so this is just one subnet and this router may be connected to another subnet and so on to get our larger internet but let's focus on one subnet from the perspective of IP addressing all the devices attached to the subnet will have an IP address so the computers the hosts will have IP addresses and so will the router will have an IP address so from the perspective of addressing they are the same I'll just say devices sometimes we'll talk generally about hosts but it includes routers routers also have IP addresses so let's use our example from here let's give one of those hosts the address 104209 61.169 104209 169 slash 18 the subnet mask is 18 in this case then this other computer would need an IP address as well and the IP address because they're on the same subnet because they're on the same subnet the IP address of that other computer must have the same first 18 bits and the last 14 bits must be different they can be almost any value but they must be different they must have unique host portions so another computer we could have the same first 18 bits and then maybe this last bit instead of being a one could be a zero so almost the same except the last bit is different which if we convert to dot a decimal it means we just subtract one from that last decimal number so potentially this other computer could have the address 104209 61.168 slash 18 where if you check 168 is one bit different from 169 and the router would have an IP address as well again same network portion different host portion and then if we and I won't do it but if we looked at this second subnet the IP address is used on that second subnet the network portion must be different from this first subnet because it's a different network it's a different subnet now we there are several types of special addresses so now we think all of our devices attached to a subnet have an IP address our hosts and routers have IP addresses but sometimes we need some special case addresses and one of them is an address to identify this subnet in my example before I spoke about a subnet like net1 net2 net3 net4 well we can use an IP address in the same manner and the way that we do that is that we take this the network portion of the IP address and set the host bits to all zeros and this gives us the address of that specific subnet and in dot a decimal 1042090.018 so all I did to get this special case address and it's a special case that cannot be used by any device in the network it has a special meaning I took the network portion and the host portion was all zeros so I can say this subnet has the address 104.209.0.0 slash 18 and the next subnet along would have a different network address because they must be unique within the internet and all the devices on that one subnet will have the same network portion in their 32 bit address there are some other special case addresses one of them is sometimes we'd like to allow to send to everyone on a network maybe there's a computer there's another computer on this subnet and that wants to send a datagram to everyone on this first subnet and sending to everyone is called broadcast don't send to a specific destination but send to all devices on the subnet so there's a special type of address that allows us to do that we set the destination IP address of that datagram we send one datagram and the idea is it should be delivered to the router and to these two computers to everyone on this subnet and that's called broadcast specifically it's called directed broadcast the address this second type of special address is obtained by taking the network portion for that subnet and setting the host portion to all ones so two special addresses they cannot be used for our actual computers but for an address for that subnet and address to broadcast within that subnet and we get 104.209.63.255.18 so in theory if someone creates an IP datagram and they set the destination address to this 32 bit value that datagram should be delivered to everyone on that one subnet so broadcast to everyone there are other special case addresses and they are listed on I think one of the slides on your lecture notes but I'm just using it they're listed here but I've just got a different set of slides for the example so there's the network address identifies a subnet the directed broadcast address is used to send to everyone on a specific subnet loopback address I'm sure you've seen this one the local host address it's used to identify yourself so any address that starts with the 8 bits 0 followed by 7 ones actually it doesn't matter about the remaining 24 bits if it starts with 0 and 7 ones or in decimal 127 if you send a datagram with that as the destination address you will receive that datagram that is that you send it to yourself so a typical value is 127.0.0.1 but in fact the last three digits may be any value so this is used for testing to access some software on your own computer so I want to test that my computer is running IP then I can try and access send to that address and it doesn't go out of my computer the datagram there's a cable that connects the interface of my computer back to itself it loops back it's just done internally to my computer so that's a third special case address quickly let's go through the last two directed broadcast was a case just going back because the subnet address followed by all ones in the host portion this is used to send to everyone on a specific subnet in the internet let's say someone I want to send I'm at home and I want to send to everyone on the SIT subnet then I'd need to know the SIT subnet portion the red part and then I'd set the last parts to all ones and I'd send my one datagram and in theory that would be sent to everyone on SIT subnet a broadcast directed at one subnet there's another way of broadcast all ones 32 ones this means broadcast on the current network you're attached to so direct a broadcast you can broadcast to everyone on some other subnet including your own local broadcast means send to everyone on the current network you're attached to you can send it to someone else's subnet you can only send it to your own subnet so that's the case where they have 32 ones the all ones address and last special case all zeros 32 zeros this is only used when it's only used as a source if I create an IP datagram I need to set the source address in the IP header it's used when you maybe start your computer and you don't yet have an IP address so in special cases if I don't have an IP address but I still want to send an IP datagram then what do I set the source to I don't have an IP address I want to send a datagram well I set the source to this special unknown source address I don't yet know my IP address I can still send a datagram using this special all zeros address some of you may have heard of DHCP how to automatically discover or find an IP address this is used in that case out of time for today but very quickly we've introduced some of the special case addresses and the main parts you need to know about the structure of IP addressing you need to study a bit on your own that is what you should do now until the next lecture is try the internet working practice in the lecture notes I'll see if I can bring it up try the internet working practice except it's broken into several sections the classful addressing we haven't yet covered in fact we may not cover so you can even skip section 1.1 straight to 1.2 class less addressing that's what we've covered so far class less addressing try and answer some of those questions have a think about what the issues are there the next part is okay given you know about IP addresses allocate IP addresses to the devices in this example network and in some devices you can choose any value but you always need to meet the rules that every subnet has a different network portion and every device in one subnet has the same host portion as long as you meet those rules you can choose different addresses 2.2 you can try you don't need to that's about finding the least cost paths I think you can manually just see the least cost path it's not so hard alright you should do it it won't take long 2.3 is now that you have the least cost paths fill in the routing tables for each device and there are some hints given in there of how to do that so there's some already filled in for you fill in the rest if you can do that practice then you know probably all you need to know about IP addressing I suggest you try the practice first and then do the quiz which is also on IP okay so two things to do this week try the practice questions and then attempt a quiz which will test your knowledge about IP addresses and concepts of IP