 We've looked at lands and wide area networks, local area and wide area and other classifications of networks. Now let's look at well how do we join them all together to form a larger network which we'll refer to as the internet. So this is a slide actually from the lands and wands lecture topic that we have lands for internal communications inside a home, inside a company, across a campus. And there are different technologies. Yesterday we looked at Ethernet but there are others, there's of course Wi-Fi, there are the two main ones used today but there are others usually for special purposes or for older systems. So there are different technologies that you could choose and one organisation or one user may choose a different technology from another because they have different requirements. So maybe you go to the factories around the industrial park here and you'll see that they'll have lands in there that use different technologies to suit their requirements. Similar for wide area networks, we haven't had a chance to look at any example technologies in detail but there are many. So there are many different wide area network technologies to connect between campuses, across cities, between countries. And again an organisation that builds a network or builds a link will choose the technology that meets their requirements. Let's draw a picture of a land, a land, say a switched Ethernet land, what's it look like? We can think we have some stations, some computers and those computers connect into a switch. This is our star topology, our switched Ethernet in that this is the switch here. So there's a land, let's say we have inside one company's network and that's used for their internal communications. And maybe there's another land somewhere else where some other computers inside another company or another branch of a company and let's just for the sake of it, let's say they're using a bus topology, something different. That is there's one shared link and they all attach to that shared link. So different lands in different organisations, different locations. Instead of drawing the details of the bus and the switch, we'll just draw it as some generic network, maybe a cloud. So a common shape to capture this is think that we have, this is some cloud to represent a network. So sometimes I'll just draw the cloud rather than drawing the computers and the switch and the links. It's just a simplification. So think of this as one land and here's a second land. So the cloud shape is commonly used to represent a particular network. Of course the two companies that operate these separate lands can communicate inside their company, but what if we want to allow them to communicate say from a computer on land one to a computer on land two? To allow anyone to communicate with anyone else? Well we could connect them together via maybe a wide area network. Maybe we'd take one of these computers and link it via a different technology to one of the lands here. Maybe via point to point link, an optical fibre link depending upon the technology. So one of the computers in the land, one of the devices, has a second link that goes to one of the devices inside land two. And this we can think as really a second or a third network, capture maybe you can draw better than me. This may be a wide area network just as an example. So that may be a situation we have let's say two branches of a company or two campuses each have their own land using their technology that suits their requirements and maybe connected together via a single link or some other technology which is across a large area say a wide area network. The problem is that to allow any computer to communicate with any other now then they need to all speak the same language. So inside the land the devices use ethernet for example and inside this land they may be using Wi-Fi or some token ring or some other technology and across the wide area network may be using optical fibre and some technology called SDH but a different technology and they don't necessarily work together. So the idea of the internet and the more generally internet working is to allow us to connect different lands and wands together. So this is a simple case where we really have three networks. We want to connect them together so that anyone can communicate irrespective of what technology is used internally to the land and when. So what I would like is say my computer on the land here I'm using ethernet to talk internally on my network I'd like to communicate with anyone else in the world. I don't care what technology they are using and what technology the when is using I would like to use still be able to communicate with anyone else and that's what the internet does for us. It takes these component networks lands and wands and connects them together. Note that there are two devices which are part of two networks this one here and the two ones connected to the when in this case. So there are two special devices in this example and they'll have a special role of really connecting one network to another. So this one needs a link that supports the land too and also a second link that supports the wide area network. So we'll have these devices which have the role of connecting two different networks together and we'll call them in the internet routers. So the idea is to allow us to communicate between any combination of land and when irrespective of the technologies used internally but still be able to communicate with anyone else. And maybe a slightly larger example is shown in this picture here. We have a few more lands and wide area networks connected together. I haven't drawn the internals I've just drawn the clouds rather than what's inside. So we have computers on land one computers on land five and these devices are the routers that connect those component networks together and this concept is called internet working connect networks together. So because there are different technologies used inside the networks inside the lands and wide area networks we want to allow any computer to communicate with any other computer. It doesn't matter what technology they're using internally we want to be able to communicate with anyone else and we do that using internet working connecting those different networks together to allow us to achieve the same. And an internet working protocol is something that supports the sending of data across such a network or network of networks. There are different internet working protocols but today the main one in use we refer to as the internet protocol or IP. IP is a specific instance of an internet working protocol and that's what we'll spend some time on how IP works. Those are the devices that connect the lands and wands together. Just think of them as computer devices but they'll play a special role in the internet protocol in IP and how to send the data say if land one is sending to land five or a computer on land one is sending to a computer on land five that computer on land one would need to send to the first router which would send on to another router via say WAN one and via WAN three to another router then via WAN two to a router and then via land five to the eventual destination. So internet working is performed using these routers to deliver the data across an internet work. How many networks in this picture? More than one. Ten. Ten sounds like a nice number. We can think that there are nine of the smaller networks of subunits or subnetworks and we connect them all together to form one large network. So we have ten in total. One large network and nine smaller networks connected together. The large network we may call an internet. This is an internet. We've interconnected many different networks together and the smaller networks we sometimes call subnetworks. These are subnetworks of the larger internet. Subnets is abbreviated or the short term for subnetworks. So we could say this internet is formed from joining nine different subnetworks together. Sometimes we'll mix the terms. Sometimes I'll say this is one large network made up of nine smaller networks. We just refer to them as networks but sometimes we're quite specific and say this is a subnet or a subnetwork. This is one large internet. The routers are packet switches. Go back to virtual circuit packet switching and datagram packet switching. They play the role of packet switches. Send a packet, send to the next packet switch and so on. So we know how they work. In the past people developed different internet working protocols but it turned out that the internet protocol become the most popular. And that's all we talk about in this course, IP. And in fact with the internet protocol there are different versions. So it's been improved over time. The most widely used version is IP version four. But there was a new version that's been around for many years now called IP version six. It's available but it's not widely supported in the internet. It's available in some devices, in subnetworks but not all. We're going to focus just on IP version four, the most widely used version. Maybe next semester you'll see more details about IP version six. So IP, the internet protocol, is an internet working protocol used in the internet. It's implemented usually as software inside hosts and routers. What's a host? Give me an example of a host. What do we mean by host? By hosts I mean usually the end user devices that attach to our network. PCs, laptops, mobile phones as devices that we use are examples of hosts. But other devices like servers, devices, sensors that collect information and send data to the internet. Anything that is creating data or consuming data we can think of as a host in the internet. A router is a device that will forward the data on to someone else. You'll see a more precise definition of them in a moment. But both hosts and routers implement the internet protocol. What does the internet protocol do? Well, it provides datagram packet switching. We've studied that already so you know how it works basically when we have data descend from the source host it creates packets. We call them IP packets or IP datagrams and it sends them one at a time to the next packet switch which sends to the next packet switch until they get to the destination host. So that's all with datagram packet switching. No circuits or virtual circuits. So when we have data descend we just send it. We don't set up a circuit in advance. In our five layer internet stack from the bottom up we have physical data link in the middle is network, transport and then application at the top. The internet protocol fits within the network layer, that middle one. We'll see a picture in a moment. Connection less is similar concept to datagram packet switching is when we have data descend from A to B we do not set up a connection. We do not set up a circuit. So sometimes it's referred to as connection less. Other approaches have connections that are called connection oriented. IP is very simple, just send the data. An important part of IP is the addresses that we give our devices, so IP addresses. We had a quick introduction yesterday of the structure of IP addresses. You'll see some more slides on IP addresses. In some special cases it provides the ability to, if we have a packet which is too large to send across a network to break it up into smaller parts, to fragment it and then at the receiver reassemble it back into the larger one. But we will not cover how that works. We don't see it very, very commonly. IP turns out compared to many other protocols using in the internet, quite simple. It does not do any flow control. You know flow control from your assignment, the sliding windows stop and wait. It doesn't have anything like that. It doesn't do error control. It doesn't retransmit. What IP does is that you send a packet. If it gets to the destination, that's nice. If it doesn't get to the destination, too bad. IP will not try and retransmit that data if something goes wrong. It doesn't set up connections. It's connectionless, so before we send data, we don't have to do anything. We just send it. It does not provide these features, but some of our applications need such features. When you're browsing websites, downloading a file on the internet, you would like the data to be delivered reliably. If you lose data, that's a problem. In the internet, such features are shifted to another protocol called TCP, which is different from IP. The idea was to keep IP simple, just to do the process of forwarding data. These other things which are commonly necessary implement in other protocols, which we'll see some of them in later slides. It does no error reporting. If something goes wrong, sometimes we'd like to know what went wrong. There's another protocol for doing that ICMP. I think everyone's used ICMP before. When you do ping, ping one computer to another, it usually uses the protocol ICMP. That's not part of IP. It doesn't give priority. Sometimes I'd like my data to get priority against your data. We're accessing the internet. In some situations, maybe I pay the ISP more than you do. Therefore, the ISP would like to give my packets priority. They get sent before yours do. IP does not do that in its base form. There are other technologies that do that. IP provides no security. There's no encryption of data. We just send it as is. There are other protocols. If you do want security, that you need to use. IP doesn't do it. It doesn't do much, but that's one of its advantages. It becomes very simple and has become very widespread. Let's look at some details. Terminology, maybe I'll let you read through this. Sometimes if I mention some of these, you'll go back and check. I have already. What have we got? Routers are the devices that connect the networks or the subnetworks together. Subnetworks or subnets are those individual networks. We saw in the picture the LANs and the WANs. Internetworking connects two or more together. And internetwork, or generally an internet. It's just short for internetwork, is the resulting network from internetworking. So we had nine subnets in our picture. We connect them together to form one internet, or one internetwork. The network that we use every day is a specific instance. And we often refer to it as the internet, not an internet. And it's usually an uppercase I. This is an I, not an L. The internet is an internet that uses IP. We know this already. Routing is the process of finding the path through a network. Forwarding is the process of sending the data along that path. We've talked about that when we did switching and routing. Remember with routing tables, we have some way to find the least cost path, create a routing table. And then when I want to send data, I forward that data along the path using the routing table. And we'll talk about them again with respect to IP. We've seen these definitions before. We talk about different types of switches. So in the topic on switching, we mentioned packet switching and circuit switching. So sometimes we distinguish between packet switches and circuit switches. But in our previous topic yesterday, we introduced in terms of Ethernet a switch. They all have a similar role of forwarding data along, but sometimes we want to refer to a specific type. So if we talk about a LAN, and we talk about a switch, the one I bring yesterday, then that's an Ethernet switch. It's not a circuit switch. It's usually specific to Ethernet. Some of these, I think, won't matter so much for the rest of the course. But if you get confused with terminology, maybe check back here to confirm. Let's look at the Internet protocol. Any questions on what is the Internet? So you now know that thing that you use every day, is the basic concept of what it is. And on your lecture slides, you have a picture of the Internet on the front page. And maybe if you remember back to the very first lecture we gave and the handouts you had, there was a picture of the Internet inside Thailand, the connections between all Internet service providers. Let's look at how the Internet protocol works, IP. Where does it fit within our five-layer TCPIP stack? This stack is the stack of five layers which we introduced back in the topic on networking. Physical up to application. Layer one, up to layer five. This picture contains examples of different technologies and protocols at some of the layers. So at the physical and data link layer, a lot of those LAN and WAN technologies, we mentioned Ethernet, wireless LAN, but there are others, PDH, SDH, ATM, X25, there are many others here, I just give a few examples. They allow us to connect and build the LAN or wide area network. IP sits at the network layer and it really forms a core of the Internet and our protocol stack in that it doesn't matter what lower technology we're using and it really doesn't matter what application we're using at the top, it all centers around IP, the Internet protocol. If you're using HTTP, you're sending emails, you're making voice calls over the Internet, then they're all using IP. If you're using the Internet via Wi-Fi, via Ethernet, via some satellite access, then they're all using IP. So that's the common thing in most devices attached to the Internet. What else can we see from this picture? There are some supporting protocols, some things that do achieve the things that IP doesn't. For example, there's ICMP, which I said was used for PIN. I think maybe in the start of the assignment to test the connectivity between two nodes, you PIN one node. That uses ICMP. There are routing protocols which are separate from IP. IP is not a routing protocol. A routing protocol finds the best paths and puts the information in routing tables. IP just uses the routing tables. We'll see some examples of routing protocols later, but IP is not a routing protocol. Think of it as a forwarding protocol. It forwards the data. It doesn't find the best path. It lets someone else find the best path. There are many different protocols for applications. Web browsing, email, different email protocols, network management, but there are maybe hundreds here that do not attempt to list. Many of these application protocols use either TCP or UDP. There are a few others, but they are the main two transport protocols. We will come back to the transport and application at the end of this topic. There's a few slides that will close the course that mention them in a bit more detail. Let's look at IP. So we will distinguish between hosts and routers. Hosts are the end devices. The devices that create some data to send across the network or receive and consume that data, like your laptop, your mobile phone, a web server is a host. It receives data and sends back to another host. Maybe if these air conditioners had some sensor devices or some special computer inside this box to monitor the temperature and be controlled from maybe some central office, that could be considered a host. So hosts are devices that usually create and consume data. Often, but not always, often those hosts have one network interface in use at a time. It's not always true. How many network interfaces does my laptop have? How many network interfaces? Two, what are they? LAN, wired LAN or Ethernet interface, that's one interface to a network and another, my laptop. I don't have a modem in my laptop. Now, a network interface is, what, the device that allows us to connect that computer to a network, a specific network technology. So think about LANs and WANs, my laptop. What does it have? It has Ethernet, there's one network interface. I plug the cable in, what else? Wi-Fi, wireless LAN. So there's a second network interface. I can connect to either the wired LAN or the wireless LAN. Any others? Maybe? We could say Bluetooth is in fact a network interface. So I can connect to other devices and form a network between two laptops, between laptop or mobile phone. So that's a third network interface. LAN, Ethernet, Wi-Fi, Bluetooth. And that's all I have in my laptop. Some may have a 3G card in there. Okay, to have a fourth option or some other technology. Your mobile phone, what does it have? How many network interfaces? Three or more maybe? Usually, there's the network interface to the mobile network, the network interface to Wi-Fi, Bluetooth, maybe you have some other short range wireless communications. You may consider some devices that have NFC, near field communications. You can swipe your phone on some receiver and they communicate. Maybe that's a fourth network interface. Usually, you only use one at a time. When I'm on my laptop, if I plug the LAN cable in, my operating system will switch to using the LAN as opposed to Wi-Fi. Not always, but often you just use one at a time. You could use two, but it's just not so typical. An important distinguisher between a host and we'll see a router is that a host never forwards IP datagrams. IP datagrams is the name, a datagram is the name of the packet, of an IP packet. So an IP packet or an IP datagram means the same thing. We'll see the structure in a moment, but just jump back to an example. If we have a host on LAN one and wants to send data to a host on LAN five, it sends an IP datagram to the router, which sends on to the next router, the next router and so on, and then to the destination host. The routers will forward IP datagrams. They'll receive one and then send it on to someone else. A host never forwards IP datagrams. A host either creates, so they're the originator, or that they consume, they are the final destination. So a host is either the original source or the final destination. They were not forward. Routers are datagram packet switches. So really in the internet, two types of devices, hosts and routers. Datagram packet switches, we know, they receive a datagram and send it out onto some other link. Normally routers have two or more interfaces. For example, I may have a router that connects on one interface to the LAN and on another interface to a wide area network. My red devices in this picture, think of it routers. This router has a connection to LAN two. Think one cable plugged in and a connection to the wide area network, a second interface. So usually routers have two or more. They're not limited to two interfaces. So this router can be receiving data from the WAN and transmitting data onto the LAN at the same time. Think of it as two cables plugged in or two links. Routers forward datagrams, hosts do not. So the main role of a router is to send someone else's data. That's what we mean by forwarding. You forward someone's mail, it means you receive the mail from someone else and forward onto someone else. So you're not the source. You're not the original source or the final destination. You forward. That's the main role of routers. In some special cases, routers can also act as a source and destination. Especially if we want to maybe set up the router. You're the network admin, you need to set up the router. Then you may want to connect to it via a network so it can be a source and destination. But the normal role of a router is to forward. The role of hosts is to create and to receive datagrams. IP routing is the process of finding the best path through a network. Finding which set of routers should we send our data via. And we covered that in the topic on routing. We covered the concepts, okay, we find the least cost path. Then we put that information inside routing tables. That's what IP routing does. There are different protocols for routing in the internet. Some example acronyms of them are listed here. We were not touched upon the details. But they do what we've seen in our examples. They find the best path and then they put the path information in a routing table. The routing table stores the destination and the next router, the next node in the path. IP forwarding is the process of sending the data across that path and it's very simple because we take the destination, well, given the destination of the datagram, given who we want to send it to, we just read the routing table. Any questions on forwarding versus routing? Forwarding and routing, okay, the difference clear? We've covered this actually in the topic on routing. Routing, find the route, create a routing table. Forwarding, read the routing table and send the data. When we talk about the internet protocol, it doesn't define how to do routing. It lets other protocols do that. It just defines how to do forwarding. Here's a picture of an example internet with a source host, a destination host and some routers and tries to capture the protocol stacks in those devices. So in this picture, what it shows at the top is, okay, we have a source host. This is the computer that creates data. It wants to send data to the destination host, say from some laptop to some web server or some mobile phone to some instant messaging server or between any pair of applications. So we want to get data to the destination. And the source host is connected to a subnet. So here I use the term subnet to refer to say a LAN. And we could say that's subnet A. And also on that subnet is a router. So on the same network as the source host is another device, router one. Router one connects also to subnet B. So a router is typically attached to two or more subnets at the same time. A host is usually attached to one subnet at a time. Usually, like I said, my laptop has three network interfaces, but I usually only use one at a time. In special cases, I could set it up to use to be downloading via the LAN and downloading by wifi at the same time. But it's not very common. Router two connects to subnet B and let's say another subnet. And you think that continues. There are routers between there. And the last router, router N connects to subnet Z which then connects to the destination host. From the perspective of internet working and IP, we don't care what technology is used inside subnet A, B and up to Z. I don't care whether it's LAN, wifi, an optical link, satellite internet. It's just a subnet from the internet's perspective. We assume that if the source host sends some data, the subnet technology will deliver it to the router. It can do that, but how it does that, we don't care at this stage. Maybe it's ethernet. What we see at the bottom of the picture is for each of those devices in that path, the protocol stacks or a simplified version of the protocol stacks, the five layers. Let's go through it. In the source host, the five layers at the bottom, physical, data link layer, network layer, transport, application layer. So the physical and data link layer are usually associated with the technology used on the subnet. So in this picture, I say that both router one, we only have three lectures left this semester. So you only need to survive for about three or four more hours. Any questions on IP so far? This is the core of the internet. We only get one or two hours on the internet protocol, but in fact, it's much more important that we allocate time for. Next semester, you may see it in other topics in more detail. So we'll just get a taster of the internet protocol. Think of the physical layer and the data link layer. They use a technology associated with the subnet. So both the source host and router one must implement the same data link layer and physical layer as each other. That is, I denote it here on subnet A, some technology data link layer A on both devices and physical layer A on both devices. For example, physical PHYA could be ethernet or it could be Wi-Fi and same with the data link layer. So this is the technology at the LAN or maybe as we'll see later on subnet B, maybe this is a wide area network and the two devices on that subnet must use the same technology, but the technology on subnet B doesn't have to be the same as that on subnet A. So I denote here's data link layer B, this is data link layer A, whatever it is. No, devices on the same subnet use the same physical and data link layer. That's the simplest way to view it. So source host and or maybe I need to be more specific, devices, the interface of devices on the same subnet use the same physical and data link layer. Remember, we really should talk about interfaces, not devices. My laptop is using say the LAN interface at the moment. This router has two interfaces, one to subnet A and one to subnet B. So if you want, think of interface, an example is two ports to plug a cable into. So interfaces on the same subnet, like the interface on source host and this left interface on router one use the same data link layer and physical layer technology. So the right interface on router one and the left interface on router two use the same technology, B in this case. They can be the same across subnets, but they don't have to be. This could be ethernet, this could be PDH, subnet Z could be Bluetooth, for example. To allow our host, our source host to communicate with the destination host, because the subnets use different technologies, we use one common technology amongst the hosts and routers and that's IP. So that's at the network cloud. IP is implemented at the hosts, both source and destination, as well as at the routers. The top two layers are dealing really with supporting applications. So the transport protocols and the application protocols, whatever they are, we haven't talked about them in detail yet, they are implemented usually only on hosts. So the source and destination hosts would use a transport protocol and some application protocol. For example, if the application was web browsing, what would the application protocol be? Web browsing uses what application protocol? HTTP. So if this was using web browsing, the application protocol here would be HTTP and here, HTTP. Does anyone know what transport protocol HTTP uses? TCP. We haven't mentioned that much, but HTTP uses TCP. Many application protocols actually use TCP as a transport protocol because TCP will provide reliability for us. But that's later. The routers don't need to implement those transport protocols or application protocols. The router doesn't care whether it's a web page request, an email, part of a voice call, they just care that it's an IP datagram or an IP packet. So the flow of data, you can think that the source host, the user here, our user does something on the computer and that triggers the application to create some data and that data is processed by the application protocol, for example, HTTP. So this is all internal to this original computer, the source host. The application protocol creates some data, let's say our data, and think internally in the computer that sent from the application, this is usually inside the OS. You can draw a bit near to the mind, but these two layers are usually implemented in the operating system. Application protocol in an application. So the application sends the data to the operating system, the transport protocol does what it needs to do, sends it to IP. IP is just some software running on your computer and what IP does is it creates an IP datagram. We'll see the structure in a moment, but it creates the datagram with header plus data and the header will include the destination IP address, the address of the destination host. It will create the datagram and then send it to the data link layer, let's say ethernet, which will then deliver across the subnet to the router. How does the source host know to send to router one? Anyone wanna guess? How does it know? We've covered it before, how does the source host know to send the data to router one? Don't you try and draw it. I'll draw, let's say on subnet A, because it's not so important, there are other devices attached. There are many computers on subnet A, including a router and our source host. When the source host sends some data, why does it send to router one and why not send to one of these other devices? What's the thing that tells it to send to router one? The next path in the routing table. Remember, routing tables tell us what path to take. The routing table inside the source host would say, if you want to send to this destination host, the next node in the path is router one. Therefore, you should send to router one. So the routing table is used here to determine who to send this to across the next hop. So as a result, it's sent across the subnet received by router one on this interface and that data is passed up to IP, the software on router one. Router one then reads, no, the router one receives the datagram. The destination is the destination host. So the destination address will match that of the destination host. Router one will recognize, this datagram is not destined to me. It's destined to someone else. Therefore, it will look in the routing table. They all have their own routing table. It will look in the routing table and say, see, okay, to get to this destination host, who do I send to? And the routing table will tell it, send to router two. So that's just forwarding. You can think conception, well, you can think that the IP datagram goes through IP and the routing table tells router one, send this datagram to router two using the technology for subnet B. Sends it to router two and that does the same thing. I'm not the destination. The destination is somewhere over here. Check the routing table. The routing table will tell router two to send across to the next router and so on. So there may be more routers in between here. Eventually router N receives the datagram. They receive and the IP software inside router N sees this datagram is destined to this destination host and it will do something a little bit different from the others. This router will realize that the destination host is on its own local subnet. Router N and the host are on the same subnet. And we'll see if the IP addresses allow the router to realize that two devices are on the same subnet. So when router N receives the data, it realizes, okay, I'm not the destination, but the destination is on the same subnet as me, subnet Z, and then send via that subnet Z to the destination. Again, using the routing table. What does IP do at the destination host? Well, it realizes, okay, I am the destination. The data has got to the destination. So since the data was destined to me, take the data inside that datagram and send it up to the higher layer protocols, up to the transport protocol, and whatever it is up to the application protocol and eventually to the application here, and maybe the user gets the data. So this is trying to highlight the role of IP in data delivery across the internet. Although it's not always true. A good classification of where these layers are implemented, the bottom two are the network interface. Like in your LAN card or a Wi-Fi chip on the motherboard. So think of that as the physical and data link layer, usually related to hardware or some drivers for that hardware. Transport an IP inside your OS normally. So when you install Windows or OS X, then you, inside there is some kind of network interface. Inside there is some code for the internet protocol. Application protocols typically in applications or libraries used by applications. For example, you install Firefox. It includes an implementation of HTTP. So that's the separation of where they are in a device. Applications, operating system, network interface card or hardware. Hosts have all five layers. Routers, only the bottom three. So they'll have interfaces for each subnet they're attached to and a common network layer that implements IP. Questions on IP so far. It's actually quite simple. We just, in terms of data delivery, we'll see the addresses soon, but we use our routing tables to send it to the next node and the next node until it gets to the destination. No retransmissions. Let's say we send our datagram and router too has an error. It receives the datagram, the router fails. So it doesn't send on to the next router. Nothing, nothing is done about that with respect to IP. The source will not retransmit that IP datagram. It won't know if it got to the destination. So there's no error control there. There's no flow control of slowing down so that we don't overflow. If it doesn't get there, then too bad. In practice, if it doesn't get there, then the transport protocol will have to deal with that. So we offload that functionality to a different protocol to keep IP simple. So I said that the packet that we deliver is called a datagram. So I may use either name, an IP packet, or an IP datagram, the two common names. This picture draws the structure of the IP datagram, a typical IP datagram. And the IP datagram has a header plus data. The other ways of drawn packets, a packet is really a sequence of bits, we can think. And some of those bits are the header, some are the data, some may be the trailer. Sometimes I've drawn that as a set of rectangles. One for the header, then the data. And if there's trailer, stuff at the end, which is not the data, we draw that at the end. So that's one way to visualize a packet. But really it's just a sequence of bits where the split between header and data is usually defined. So we know that this is the last bit of the header and this is the first bit of the data. Now the picture we see with the IP datagram draws the header a little bit different. The way to read it, I'll be going back. So I think the first bit is at the left-most position in the header, then the second bit and the third bit and so on, and the last bit of data at the right-most position in this picture. But in that one on the slide it's different. Just to be able to fit the picture in a reasonable size, it's common to draw the header like in this case. The first bit, or actually bit zero, if we start counting it zero, is here. And we read it row by row. So this is the first bit. I'll explain what it means in a moment. The first bit, the second, the fourth bit in the packet. The 31st bit, or if we start at the zero bit, the 31st bit is here. So there's 32 bits in this row. The 32nd bit here and we go on and we read and at this point is the last bit of the header in a normal IP datagram. Some IP datagrams may have some extra fields, some optional fields. For this course let's ignore them, the options. We will not see them very often, but it's possible to add some other fields. Then we move on to the data. So just be aware that the way to read this diagram is row by row. It defines the size of the header. It's 20 bytes normally. Plus we have data and optionally we may have some other fields in the header. 20 bytes, you see there are five rows in this picture. Each row is 32 bits in length, four bytes. So the header typically is 20 bytes for an IP datagram. The data can range up to about 65,000 bytes. So the total size of header plus data is limited by the 65,656. But in practice it's usually much smaller. It's usually the order of hundreds of bytes, maybe thousands of bytes in practice. It's often limited by the subnet technologies. The header, what does it contain? We divide the header into fields. The fields carry information for IP to work. And this picture shows those fields. The next slide describes them in words, let's go through the main ones at least, not all. Maybe going backwards, okay, from the last field. The options will ignore, let's ignore options. Let's say that's not there in the header. So the last field is the destination IP address. This is the address of the destination host. So each host has an IP address in the internet. And when the source host creates the IP datagram it puts the address of the destination in this field and it puts its own address in the source IP address field. So the original source, the final destination. And especially the destination is used in determining the routes to take. So when we read the routing table we look up the destination address. How long is an IP address from yesterday? How long is an IP address? 32 bits. You see, the field is 32 bits long. So we fit the binary IP address in there. We don't store the value 10.10.3.197. We store the binary form, the actual 32 bits. When you see this 10.10.3.197 it's just for you and I to be able to view the address in a simpler manner than the binary form. The computer, when it creates a packet, uses the binary form. So the two fields, source and destination IP address. What else? Maybe going to the start now. What version of IP are we talking about? IP version 4. So inside the first four bits of the header is a value to indicate the version of IP being used. So it's always version 4 in the examples we're using. If using IPv6 it will have a value of 6. H length, H means header. This is a four bit value that indicates the size of the header. Because the header may have optional fields if we add options we need to tell the receiver how many bytes are options and where's the data start. So this field needs to be set to a value to indicate the length of the header. Normally it's 20 bytes but the way that it works the header length field measures in four bytes, four byte words. That means what's the value of header length if there's no options? What is the value of that field header length if there are no options? Or a simpler question. How long is the IP header? No options. The IP header is 20 bytes. But the header length counts in terms of four bytes at a time. So the value would be five, five times four. If we add options and other four bytes of options the value would be six, six times four. The way that it counts the size of the header. Usually all the examples will see the header length is 20 bytes. Diff serve and ECN also have other names used in very special cases if we need to give priority to datagrams. Before I said IP doesn't give priority to datagrams and that's true but inside the header it includes some ability to give priority but IP doesn't specify how to do that. We'll ignore them. We'll never describe or see them in use in this course and probably in the labs next semester. Total length is a 16-bit value indicating the total length of the datagram. Because the data is variable in size we need to say how long is the datagram. Header plus data. If the data is 100 bytes then it's 120 bytes in the normal case. ID is like a sequence number, identification. So when we send a datagram we can change the ID. Sequence number. But note that doesn't mean the datagrams are delivered in sequence. And there's no use of that for retransmissions or anything but it can be used as a sequence number. The flags and fragment offset are used if we want to split this datagram into smaller datagrams. It's called fragmentation. We fragment it into smaller chunks. We would normally not see that happen. Normally once it's created it's not fragmented any further. So again in this course we will not talk about how fragmentation works and we'll not talk about these fields because we'll assume there's no fragmentation. But in special cases you may need to split this data into smaller fragments and you would use these fields to help that. What's time to live? What's that used for? Remember we've got eight minutes is our time to live this week at least in routing and especially in flooding we talked about we had a hop limit. We send a datagram, we send a packet and the router decrements the hop limit, sends it on. Once it gets to zero we stop sending. That's what this is used for. The time to live is just a hop limit. The source sets a value let's say 10. When we send to the router the router decreases it to nine. Sends on to the next router, keeps going. If it gets to zero the router will not send any further so the datagram dies because it disappears from the network. So that's a measure in not in terms of seconds but in measuring the number of hops that this datagram will traverse. It's mainly used for error in the case of errors. If there was no such time to live in an incorrectly set up network it could be that a datagram goes back and forth or in a loop forever and that would be bad or inefficient so this limits how many times this packet is sent by a router. Come back to protocol. Protocol just indicates what is really the transport protocol used. So this data carries information from the above transport protocol. Remember the transport protocol sends data down to IP. IP creates our datagram. Which transport protocol gave the data to IP? Well there's a number stored in the protocol field that indicates which one. So transport protocols have numbers. TCP is I think number six. UDP is number 17 and there are others. We will not see them yet but the protocol field indicates where did this data come from with respect to which protocol did it come from. Header checksum is used for error detection across the header only. So if we transmit this datagram and that there's an error in the link such that the router receives a header that fails the error detection fails the checksum then that router may discard the datagram. So it's used for error detection just of the header not of the data and the two IP addresses, source and destination. Maybe the important fields we will see in use are of course the addresses, source and destination. Protocol will see in use. It tells us what's inside here. What is the data? Maybe time to live. Maybe the lengths of the other things we may see in use. Let's see it in use right now. Let's bring up the packet capture that we had yesterday. Yesterday I showed this capture of some packets for web browsing and we identified that the fourth packet was my computer sending a request for a web page to a server and the sixth packet was that web page coming back. Let's just zoom in on those two packets and see the IP datagram. Note the source and destination addresses are IP addresses. So this 10.10.99.251 is the IP address of the source host. Say my laptop when I did this example and 203.131.209.72 is the IP address of the destination host, the web server. You can convert those IP addresses to binary, can't you? Yes, yesterday we converted to binary. Remember each decimal number, there are four decimal numbers, convert to an 8-bit value and you get 32 bits. Zoom in on that packet. The structure of that packet is that it contains 367 bytes. It's an ethernet frame. Inside the ethernet frame is an IP datagram. This is the way we read this software. This is an ethernet frame. Inside that is an IP datagram. Inside that is a TCP segment. Inside that is a HTTP message. We'll return to those details later, but let's just look at the IP datagram and we see here the header fields and the values of those fields. Version 4. Header length 20 bytes. Total length 353 bytes. So this software, Wireshark, conveniently shows us the information of that packet, the header fields. Time to live, 64. Protocol, TCP. 64 seconds, okay. Source address, destination address. So it's just an example of an IP datagram. Of course, where can I grab it? Remember, a packet is just a sequence of bits. So although this software conveniently decodes that information and shows in a nice form, all it is is a sequence of bits. So this, the highlighted orange part here, is actually the IP header but shown in hexadecimal. For in hexadecimal, you convert to binary. Zero, one, zero, zero. That's the first four bits of that IP datagram. And five, convert to binary. That's the next four bits of the IP datagram. So although we usually look at it in terms of the fields and the values, it's actually just a sequence of bits. And this software shows us both the human-friendly form but also the form not quite in binary but in hexadecimal. You can convert that to binary. Next week, we'll look at what? We'll look at a little bit more about routing tables and then we'll spend some time on IP addresses and that will lead us to the last part on internet applications and TCP.