4.3 The Internet Protocol, part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] in this section we're going to take a deep dive into the Internet's network layer and because there's a lot to cover here we're going to do this in two parts in the first part we're going to cover the ipv4 protocol and addressing now obviously IP is incredibly important but so too is addressing and actually address things part of ipv4 you know I used to think that addressing was sort of cut and dry and maybe even a little bit boring but I've learned that addressing has a lot to do with relationships between ISPs having to do with administrative boundaries technical issues as small and local as what happens inside a routing table lookup and hardware - as global a set of concerns as how global addressing and forwarding is done so it turns out addressing is really important and also pretty interesting in the second part we're going to cover what's known as network address translation NAT and a new version of IP known as ipv6 so I think you'll find this interesting stay tuned so let's start with a big picture view of the Internet's network layer remember we learned earlier about the network layers control and data plane in the forwarding table that's the router local table that determines the output port to which a router will forward an incoming data gram and we also learned in the introduction to the network layer that the forwarding tables contents determined either by distributed routing protocols or by a router external Sdn controller will cover routing algorithms and Sdn controllers when we study the network layers control plane a key part of the internets network layer is of course the IP protocol the celebrated IP protocol but what exactly is the IP protocol well by looking at this diagram you can see that the IP protocol is not about routing algorithms or Sdn controllers those are control plane functions instead the IP protocols about the data gram format it's about how IP addresses are structured and interpreted and it's about packet handling conventions like how to fragment large packets into smaller packets so IP is really just a piece albeit a really important piece of the Internet's network layer the ICMP protocol which we'll cover as part of the network layer control plane is also part of the network layer since the IP protocol is about data Graham formats addressing and packet handling conventions let's then start our study of IP by looking at the IP Datagram format using this figure we'll walk through the fields of the IP Datagram now I know this might seem a little bit dry but really anyone who takes a networking course really needs to know this sort of like eating your vegetables you know it's good for you and so you really do have to do it and hopefully you'll even love it or find it interesting anyway well first there's the version number field these 4 bits specify the IP protocol version of the data Graham here of course we're looking at the ipv4 header because an ipv4 Datagram can contain a variable number of options which we see here in the data gram header the header length field indicates how many bytes are in the header this lets the host or router know where the payload actually begins in the IP Datagram most IP datagrams don't contain options so the typical IP Datagram header goes from here to here a 20-byte header the data gram length field indicates the total number of bytes in the IP Datagram header plus payload this is needed because the payload can also be a variable size since this fields 16 bits long the theoretical maximum size of an IP Datagram is 64 K bytes but data grams are usually no larger than 1,500 bytes which allows a data gram to fit nicely inside the payload field of a maximally sized Ethernet link layer frame the type of service bits were included in the ipv4 header to allow different types of data grams to be distinguished from each other the definition and use of these bits is really evolved over time for our purposes the most important type of service bits are the two bits used for explicit congestion notification ecn and remember that's a topic we study in detail in the transport layer a router sets these two bits to indicate congestion the remaining six types of service bits are used to differentiate among different classes of traffic which can then be given different service based on their traffic class using the buffering and scheduling algorithms we just studied in the previous section the TTL field is a counter that decremented by 1 each time a Datagram passes through a router if the TTL count ever reaches 0 the data gram must be dropped at the router and so the TTL field is used to ensure that packets don't loop forever or even for a long time if there are forwarding loops the upper-layer protocol field indicates the transport layer protocol to which the payload in this IP Datagram is going to be passed for example a value of 6 indicates that this data gram contains a TCP segment that will be passed up to TCP a value of 17 indicates that the payload is a UDP segment the IP ID field flags and fragment offset field are used when a single large IP datagrams fragmented into multiple smaller data grams this doesn't happen often and actually these fields don't even show up in IP version 6 and so we won't see anything more about them here you can read about them more by following the pointers in our textbook the header checksum is an internet checksum computed over the contents of the IP header remember we studied the internet checksum earlier and note that since some of the IP header fields change each time a data gram passes through a router the TTL field is decremented for example the checksum needs to be recomputed at each router that the data gram passes through that can be time-consuming and may be as a result of this the header checksum field was also removed in ipv6 we've already talked about the 32-bit source and destination IP address fields remember that we just saw in destination based forwarding that an IP router uses the data grams destination IP address here to look up the appropriate router output port to which the data gram should be forward it and then finally there are a number of optional fields in the data gram header we'll skip those here and then of course the data grams payload itself the payloads the data transport layer segment that IP will deliver up to the transport layer protocol whoa well that was a lot of fields to think about and to go through and as we mentioned ipv6 is a lot more streamlined than ipv4 and so we'll find fewer header fields there let's start our discussion of IP addressing with a few basic concepts the first important thing to know is that an IP address does not identify a host or router per se but rather an interface a link layer interface on a host or router routers pretty much always have more than one interface that is to say multiple incoming and outgoing links and hosts often do as well for example my laptop has a wired Ethernet interface and a wireless 802 11 interface each with a different IP address as we've seen 32 bit IP addresses are written in so called dotted decimal notation with each decimal number corresponding to an 8-bit byte in the address field here the 32-bit binary address is to 23.1 1.1 in dotted decimal notation well you know looking at this diagram it might be a little bit unsatisfying to you it looks like the link layer interfaces these black lines just sort of vaguely end up in a blue cloud what's up with that how are these interfaces actually connected together so that one interface can communicate directly with another interface that's attached to the same blue cloud well remember that we're at the network layer right now and the connection of these interfaces is done via link layer technologies which are the layer below what we're studying right now so one answer to your question would be well be patient we'll get to that but if you're just dying to see what the complete picture looks like here's what it is the host and the router interfaces might be connected through wired Ethernet switches or they might be connected through a NATO 2.11 wireless network but there will be a link layer local area network or point-to-point link protocol typically Ethernet or Wi-Fi in practice that will be used to connect the interfaces and we really will learn about this just a bit later so stay tuned and for now back to the network layer if you take a close look at this figure in particular the IP addresses in this figure you'll notice that the interfaces that are connected to each other have similar but not identical IP addresses that's because they all belong to the same subnet so what is a subnet well each subnet is a piece of the network that contains all devices that can reach each other without passing through an intervening layer three that is to say network layer router that is they're directly connected to each other via some link layer technology and here's how that ties into addressing an IP address has two parts a subnet part and a host part and if two interfaces are on the same subnet their IP addresses must have a common subnet part and of course they'll have different host parts so let's be very specific in defining subnets to find a subnet attached each interface from its host or router as we've done here and this will leave islands of isolated networks and so in this example here we have three subnets now let's look at the addressing remember that interfaces on the same subnet will have the same subnet part of their IP addresses the so-called subnet mask says how many high order bits they have in common let's assume that's 24 bits in this case this lower subnet here has a 24-bit address of 220 3.1.3 we say 220 3.1 3/24 and these three interfaces have addresses that all start with 223 dot three the next subnet is two 23.1 1/24 note that these four interfaces have addresses that start with two twenty three dot one dot one and this third subnet address is two twenty three dot one dot 2/24 let's take a look at this network with three routers and seven hosts can you find the subnets think about it well let's disconnect the interfaces from their host or router to see the subnets and here are the slash twenty four subnet addresses this slash notation that we've been using has a name it's called classless inter-domain routing CIDR and actually pronounced cider due to its historical origins the subnet portion of the address can be any number of bits x and a cider i's address is one of the form ABCD / X where X is the number of bits in the subnet address and sometimes the D is emitted when it's zero here's an example of a 32 bit IP address and its side Erised dotted decimal notation well let's wrap up our discussion of ipv4 and addressing by posing a question that maybe you've been wondering about how does one actually get an IP address in the first place and really that's two questions how does a host get an address within the subnet range associated with the subnet that it's going to be joining and then sort of the bigger picture question how does a network how does a sub network get a range of addresses that are going to be used by devices by interfaces within that sub network let's look at both of these questions well let's start with the first question how does a host get an IP address for its interface well back in the day a sysadmin used to actually manually edit the IP address into a file on that host but we've progressed a lot since then using a plug and play or what sometimes known as a zero Kampf zero configuration approach that's to say an approach that uses a protocol between a host and a server rather than manual configuration to get an IP address the need for a zeroconf approach is hopefully obvious with billions of hosts worldwide more than half being mobile and these are hosts that are constantly attaching to a network and then later detaching and then attaching over and over again the protocol used by a host to get an IP address on a network is known as DHCP the dynamic host configuration protocol in order to allocate a plug-and-play IP address using DHCP a network will need to have a DHCP server to perform that function and an arriving client that is a host wanting an IP address will request and receive an IP address from the DHCP server using the DHCP protocol when a host leaves the network it'll give up its IP address which can then later be reused by another host or reclaimed or may be renewed by this host at a later point in time we're going to take a look at for DHCP messages that we'll want to study there are more but these are really the key ones discover offer request in acknowledgment let's see how DHCP works here's the scenario we'll look at using the simple network that we've seen before and in this network we see the DHCP server here well typically a DHCP server would be co-located in a router and serving all of the subnets to which that router is attached but we've shown it here as a separate server which also happens with an IP address of 223 12.5 and here's the arriving client that will want an IP address in the 223 one 2/24 subnet now let's take a look at what the DHCP clients server message exchange actually looks like in the first step the arriving client broadcasts a DHCP message that will be received on the interfaces of all of the hosts and routers in the subnet to which it's attaching the discover message basically says hey is there a DHCP server out there this is a form of service discovery the host knows the service it needs DHCP so it sends out a broadcast to discover the server that can provide DHCP service DHCP runs over UDP the client uses port 68 and the server will use port 67 in particular the server will be listening on a socket associated with UDP port 67 for incoming DHCP messages and here are the details of the fields in the DHCP discover message the clients source IP address containing the UDP segment that contains the DHCP discover message is zero because the client doesn't have an IP address yet and the destination IP address is the IP broadcast address that is all ones 255 255 255 255 and the UDP destination port number is 67 as we just noted before hopefully there'll be a DHCP server sitting out there somewhere on the subnet listening for this service discovery message note also that there's a transaction ID field it's got a value 654 here and this will be used by the client to match any reply to this request here's the second step any DHCP server that receives this broadcast Discoverer message and there might be several such servers can reply with a DHCP offer message this message basically says hey I'm a DHCP server and here's an IP address that you can use if we look at the details of this offer message we see that it comes from the DHCP server with an IP address of 223 12.5 as in our figure earlier and from port number 67 this offer message is being broadcast to all interfaces on the subnet the DHCP message contains the IP address that the requesting host can use that's the yia ddr your internet address field and a lifetime in this case of 3600 seconds that the address can be used for note that the transaction ID here matches the transaction ID of the initial offer message that's to say this is a reply to that message a client can receive offers from multiple DHCP servers and this might occur for example if there are multiple routers on that subnet now the first two steps that we've seen here are actually optional the way to think of the third step which could also be the first step if the two optional steps aren't taken is that the arriving client comes in and says hey here's an IP address that I want to use maybe that's the IP address that it was told it could use and step two if that step was executed or maybe it's an address that it already has in which case the client is really renewing its use of that address or perhaps it's an address that the clients used before you can see here that this message is also broadcast and then it contains the IP address that the host is proposing to use and that there's a new transaction ID and a lifetime as well the final message is the ACK message from the DHCP server saying basically okay you can use that IP address with this given lifetime now it turns out that a host needs more configuration parameters than just an IP address in order to be able to function in particular it also needs to know the IP address of the first hop router since any outgoing packet from the client will need to be sent to that first hop router it might also need the address of a DNS server to use and also need the netmask the number of bits and its IP address belonging to the subnet well this could all be configured manually but it can also be optionally specified in a DHCP message and this is usually the case so the other really big question that we still need to ask is how does a network get a range of addresses to assign to the devices actually to the device interfaces in its network well in many cases it will be allocated a range of addresses in the IP address range that belongs to the ISP to which it is a customer network in this example here the higher-level ISP has a slash 20 address range this is because then for example divide its address space up into 8 say slash 23 address ranges as shown here and allocate each of these out to one of its eight client networks and now we can start to see a really critical time between addressing and routing something that we'll come back to again when we get to the network layer control plane in this example the parent ISP which we'll call fly-by-night ISP in this example has eight client ISPs as shown in the figure here fly-by-night need only advertise one address prefix 223 16/20 to the rest of the global Internet this single advertised address prefix will be sufficient for the rest of the internet to be able to route to the two to the twelfth addresses in this is P is address range this is an example of what's called address aggregation sometimes also called route aggregation or route summarization note that in this figure the second is P let's call it is peas our US says hey send me anything in the address range 190 9.30 1/16 we'll come back to this in just a second well this all looks very neat and orderly but in life well think just generally aren't so neat or ever so perfectly hierarchical in particular let's ask ourselves what would happen hypothetically if one of the eight client ISPs say organization one wants to change ISPs from fly-by-night to ISPs our us while keeping its range of network addresses 223 18/20 three well fly-by-night continues to say send me anything with address prefix 223 16/20 as before and as we can see here but here's the critical thing now is peas are us says well send me anything with address range 190 9.30 1/16 as before but now it also says also send me anything with address range 200 dot 23.18.38 and note that 223 18 / 23 is contained in fly-by-nights advertised 223 dot 16/20 address range so what are we to do here well what's absolutely critical here is that ISPs our US has advertised a longer 23 bit prefix 223 18 / 23 a more specific prefix then the 20 bit prefix 223 slash 16/20 advertised by fly-by-night and i hope oh yeah light bulb has just gone off in your head remember when we were studying forward tables when we were looking at what's inside a router when looking up a 32 bit IP address the matching forwarding table entry is that with the longest prefix match that's precisely why packets with addresses and organization ones address range will be forwarded to ISPs our US which has advertised the longer prefix them well we've now seen how address allocation forwarding table lookup using longest prefix matching in the BGP routing protocol that disseminates prefixes are all really intimately tied together and if you've got all of this you've really mastered and tied together a lot of key concepts if it's still not 100% clear we'll come back to this again when we study the control plane but maybe think a little bit more about it now if you don't have it quite down so we've now seen how a host gets an IP address from a DHCP server and we've seen how customer ISPs can get an address range from their provider ISP but we still haven't answered the basic question at the highest level how does an ISP get a block of addresses and the answer to this final question is that the ipv4 address space is owned administered and allocated by an entity known as the Internet Corporation for Assigned Names and numbers I can I can in turn allocates addresses out to five regional registries which then allocate out their portions of the address space to ISPs I can also performs a number of other critical internet functions like managing the route DNS servers managing domain names and allocating protocol numbers remember when we study the ipv4 data gram format and said that the upper layer protocol number of six corresponds to TCP and that the number 17 corresponds to UDP those numbers are also controlled by ICANN well let's wrap up here by considering ipv4 32-bit address space in 2011 ICANN central allocated out the last of its available chunks of 32-bit address space to the regional registries ICANN has no more address space to allocate out although there's some unused address space still sitting in the regional registries in the next section we'll look at network address translation a technique that allows a single IP address to be used by multiple IP devices and will also look at IP version 6 which has a much larger 128-bit address space ipv6 was begun in the 1990s specifically because the IETF foresaw the exhaustion of the ipv4 address space well you see this quote here from Vint Cerf who along with Bob Kahn we can really credit as being one of the two founding fathers of the Internet if we had to choose just two they've both been asked a lot about the early days of the experimental ARPANET that later grew into today's Internet and about the 32-bit ipv4 address space in particular and I love this quote from Vic who the hell knew how much address space we needed remember when today's internet architecture was being defined in the 1970s it was a relatively small Department of Defense project so let's leave the last words here to be from Vint Cerf I heard him give a really great sort of fireside chat type of talk at Georgetown University in 2017 when I was working in DC and he talked about a lot of really interesting topics but one of them had to do with IPS 32-bit address space so let's hear it from Vint how did we actually end up with a 32-bit address space what calculations did they go through take a look so now we have four different kinds of networks the Ethernet the packet main unit the packet satellite net in the urban did the original ARPANET so we sat down and tried to figure out how are we going to do that and after about six months we had designed the basic protocols that you use today it was just TCP later and we split off the internet protocol for real-time communication so the question then was you know how big did we expect this to be well honestly we sat down and said this is going to be used by the Defense Department it has to work everywhere in the world because you never know where the Defense Department is going to have to operate so we said okay how big is this going to be it's got to be global how many networks will there be per country and we said well we had finished the ARPANET which is Anand national scale network so we thought well maybe they'll be 2 per country so let me sum competition so we said ok - how many countries are there and there wasn't any Google to ask back then so we guessed it 128 cuz that's a power of 2 and that's a programmers thinking so 2 times 128 is 256 networks and that's 8 bits of identifier and then we said how many computers will there be per network and we said remember this is 1973 these are giant air conditioned computers you know that serve a thousand people in time shared modes so we're saying how about 16 million you know what the heck so 16 million is 24 bits so we ended up with a 32-bit address space and if you do the math it's 4.3 billion possible terminations for the network in 1973 so the answer that was more than there were people in the world and they think so we thought well that ought to be enough to do this experiment right so that's what we used so people say if you had it to do over again you know what would you do and one answer is well I guess I would have chosen 128 bit address space and we don't have to go through this painful transition on the other hand can you imagine making it an argument of the form I need 3.4 times 10 to the 38th addresses in order to do this experiment how many networks do you have now three how many computers do you have on the networks 500 he said something doesn't quite add up does it so I didn't do it because that was it wouldn't pass the red face test but I wish I could have
Info
Channel: JimKurose
Views: 76,843
Rating: undefined out of 5
Keywords:
Id: sdIpLuIR1ZY
Channel Id: undefined
Length: 30min 13sec (1813 seconds)
Published: Sat Jan 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.