CIDR (Classless Inter-Domain Routing) on the Internet is a way to create additional address, these addresses are provided to the service provider (ISP), and then assigned by the ISP to the customer. CIDR routing together, so that the backbone of an IP address on behalf of thousands of service providers, IP address, thereby reducing the burden on Internet routers.
Internet Protocol version 4 Claudio Cicconetti <firstname.lastname@example.org> International Master on Communication Networks Engineering 2006/2007 Table of Contents IP Addressing Class-based IP addresses IP subnets IP routing Methods of delivery IP address exhaustion problem Private IP addresses Classless Inter-Domain Routing IP datagram IP fragmentation Internet Protocol (IP) IP is a standard protocol with STD number 5 (see http://www.ietf.org/). IP is the protocol that hides the underlying physical network by creating a virtual network view. It is an unreliable, best-effort, and connectionless packet delivery protocol. Internet Protocol (IP) Best-effort means that datagrams may: – be lost; – arrive out of order; – even be duplicated. IP assumes that higher layer protocols (e.g., TCP) will address these anomalies. This makes IP a very robust network protocol. In fact, the US DoD intended to deploy a network that would still be operational if parts of the country were destroyed. IP Addressing In any network protocol, such as IP, addressing is needed to allow any two hosts to communicate between each other. IP addresses are represented by a 32-bit unsigned binary value, which is usually expressed in a dotted decimal format (e.g., 22.214.171.124) because the numeric form (e.g., 3251458049) is hard to read. IP Addressing The binary format of the 32-bit IP address 126.96.36.199 is: 193 205 80 1 11000001 11001101 01010000 00000001 An easier way to remember IP addresses is by assigning to them a name (e.g., www.google.com), which is resolver through the Domain Name System (DNS). IP Addressing Strictly speaking, an IP address identifies an interface that is capable of sending and receiving IP datagrams. One system can have multiple such interfaces. Usually, hosts have only one interface (thus, one IP address), whereas routers have many interfaces (thus, many IP addresses). IP Addressing IP datagrams (the basic data packets exchanged between hosts) are transmitted by a physical network attached to the host. Each IP datagram contains a source IP address and a destination IP address. Class-based IP addresses There are five classes of IP addresses. The prefix is referred to as the network part, the suffix as the host part. Class-based IP addresses The division of an IP address into two parts also separates the responsibility for selecting the complete IP address. The network number portion of the address is assigned by the Regional Internet Registries (RIRs). The host number portion is assigned by the authority controlling the network. Class-based IP addresses Not all suffixes are available: all 0’s: this address refers to the network itself, e.g., 10.0.0.0 means “the whole network 10.*”. all 1’s: this is the directed broadcast for this network, e.g., 10.255.255.255 means “all the hosts on network 10.*”. Class-based IP addresses The Class A network 127.0.0.0 is defined as the loopback network. Usually, the host part is set to 1, which results in 127.0.0.1 being the loopback IP address of the host. Addresses from that network are assigned to interfaces that process data within the local system. Thus, these loopback interfaces never access a physical network. Class-based IP addresses Class A addresses These addresses use 7 bits for the 〈network〉 and 24 bits for the 〈host〉 portion of the IP address. This allows for 27-2 (126) networks (both ‘0’ and ‘127’ are reserved values) each with 224 - 2 (16,777,214) hosts, for a total of 2,113,928,964 available addresses. Class-based IP addresses Class B addresses These addresses use 14 bits for the 〈network〉 and 16 bits for the 〈host〉 portion of the IP address. This allows for 214 (16384) networks each with 216 - 2 (65,534) hosts, for a total of 1,073,709,056 available addresses. Class-based IP addresses Class C addresses These addresses use 21 bits for the 〈network〉 and 8 bits for the 〈host〉 portion of the IP address. This allows for 221 (2097152) networks each with 28 - 2 (254) hosts, for a total of 532,676,608 available addresses. Class-based IP addresses Class D addresses are reserved for multicasting (a sort of broadcasting, but not in a limited area, and only to hosts using the same class D addresses). Class E addresses are reserved for future use (likely, they will never be used at all). Class-based IP addresses A Class A address is suitable for networks with an extremely large number of hosts. Class C addresses are suitable for networks with a small number of hosts. This means that medium-sized networks (those with more than 254 hosts or where there is an expectation of more than 254 hosts) must use Class B addresses. Class-based IP addresses However, the number of small- to medium- sized networks has been growing very rapidly. It was feared that if this growth had been allowed to continue unabated, all of the available Class B network addresses would have been used by the mid-1990s. This is known as the IP address exhaustion problem. IP subnets An additional problem of the original IP addressing scheme was that it required a centralized authority, i.e., the RIR, to assign network numbers. This problem was then solved through IP subnetting, which allows the network administrator to locally partition her network into several IP subnets. IP subnets The host number part of the IP address is subdivided into a second network number (i.e., subnet) and a host number. The entire network still appears as one IP network to the outside world. Thus, a host within a network that has subnets is aware of the subnetting structure. A host in a different network is not. This remote host still regards the local part (subnet + host) of the IP address as a host number. IP subnets Any bits in the local portion can be used to form the subnet. The division is done using a 32-bit subnet mask, which is usually written in dotted decimal form. 131 114 9 44 10000011.01110010.00001001.00101100 -----network----- -subnet- --host-- 11111111.11111111.11111111.00000000 -----------network mask------------ IP subnets The special treatment of all bits zero and all bits one applies to each of the three parts of a subnetted IP address just as it does to both parts of an IP address that has not been subnetted. There are two types of subnetting: – static subnetting, i.e., all subnets have the same prefix; – variable subnetting, i.e., subnets may have different prefixes. IP subnets For example, assume that you have been assigned an address pool (192.168.1.0/24) to be subnetted so as to serve a set of 6 LANs with the following requirements: LAN 1: 2 hosts LAN 2: 2 hosts LAN 3: 2 hosts LAN 4: 2 hosts LAN 5: 2 hosts LAN 6: 30 hosts IP subnets An example of variable length subnetting is : 192.168.1.00100000/27 -> 30 hosts (30 needed) .01000100/30 -> 2 hosts (2 needed) .01001000/30 -> 2 hosts (2 needed) .01001100/30 -> 2 hosts (2 needed) .01010000/30 -> 2 hosts (2 needed) .01010100/30 -> 2 hosts (2 needed) With static subnetting you can have: 192.168.1.00100000/27 -> 30 hosts (30 needed) .01000100/27 -> 30 hosts (2 needed) .01001000/27 -> 30 hosts (2 needed) .01001100/27 -> 30 hosts (2 needed) .01010000/27 -> 30 hosts (2 needed) .01010100/27 -> 30 hosts (2 needed) IP subnets For example, assume that you have been assigned the Class C network 188.8.131.52, and you need to partition the networks so that the following requirements are satisfied: LAN 1: 50 hosts LAN 2: 50 hosts LAN 3: 50 hosts LAN 4: 30 hosts LAN 5: 30 hosts IP subnets This cannot be achieved with static subnetting, because you would require five subnets, each allowing up to 64 hosts (i.e., 255.255.255.192 masks). However, you can accomplish your task with variable length subnetting, by partitioning the network into three 255.255.255.192 subnetworks, and two 255.255.255.224 subnetworks. IP routing Whenever a host has a physical connection to multiple networks or subnets, it is described as being multi-homed. Typically, a multi- homed host has different IP addresses associated with all its network adapters, each connected to a different subnet or network. Such a multi-homed host is usually employed as router. IP routing A router forwards incoming IP datagrams towards a destination through a physical interface. Its decisions are based on the datagrams’ destination IP addresses, according to its routing table. IP routing Four kinds of destinations: – hosts or networks that are directly attached to one of the physical networks to which the router is attached (e.g., 192.168.1.0/255.255.255.0); – hosts or networks for which the router has been given explicit definitions (e.g., 192.168.3.0/255.255.255.0); – hosts or networks for which the router has received an ICMP redirect message; – a default for all other destinations (e.g., last entry of the routing table above). IP routing There are many Interior Gateway Protocols (IGPs), such as: – Open Shortest Path First (OSPF); – Routing Information Protocol (RIP); – Interior Gateway Routing Protocol (IGRP); – Enhanced IGRP (EIGRP). On the other hand, the most common Exterior Gateway Protocol (EGP) is the Border Gateway Protocol version 4 (BGP4). IP routing If the destination host is attached to the same physical network as the source host, IP datagrams can be directly exchanged. This is done by encapsulating the IP datagram in the physical network frame. This is called direct routing. Indirect routing occurs when the destination host is not connected to a network directly attached to the source host. The only way to reach the destination is via one or more IP routers. IP routing lan0 192.168.1.64/26 Host A 192.168.1.66 Router R Host B lan0: 192.168.1.65 lan1 192.168.1.130 lan1: 192.168.1.129 192.168.1.128/26 Host C 192.168.1.131 IP routing Host B communicates directly with Host B. Host A communicates with Host B and Host C indirectly via Route R. Router R routing table: Destination Netmask Interface Next-hop 192.168.1.64 255.255.255.192 lan0 192.168.1.128 255.255.255.192 lan1 Host A routing table: Destination Netmask Interface Next-hop 192.168.1.64 255.255.255.192 lan0 192.168.1.128 255.255.255.192 lan0 192.168.1.65 IP routing IP routing Even though Host A and Host B are connected to the same physical network, they cannot communicate directly, because they belong to different logical subnetwork. Router R routing table: Destination Netmask Interface Next-hop 192.168.1.64 255.255.255.192 lan0 192.168.1.128 255.255.255.192 lan0 Host A routing table: Destination Netmask Interface Next-hop 192.168.1.64 255.255.255.192 lan0 192.168.1.128 255.255.255.192 lan0 192.168.1.65 IP routing Without subnetting, IP uses the following algorithm to route datagrams: – Is the destination IP network address equal to my IP network address? – If so, send the IP datagram on local network. – Otherwise send the IP datagram to the router corresponding to the destination IP network address. IP routing With subnetting, IP uses the following algorithm to route datagrams: - Is (destination IP address & subnet mask) equal to (my IP address & subnet mask)? - If so, send the IP datagram on local network. - Otherwise send IP datagram to router corresponding to the destination IP (sub)network address. Methods of delivery The majority of IP addresses refer to a single recipient, this is called a unicast address. Unicast connections specify a one-to-one relationship between a single source and a single destination. Additionally, there are three special types of IP addresses used for addressing multiple recipients: broadcast addresses, multicast addresses and anycast addresses. Methods of delivery Broadcast addresses are never valid as a source address. They must specify the destination address. Different types of broadcast addresses: – limited broadcast address; – network-directed broadcast address; – subnet-directed broadcast address; – all-subnets-directed broadcast address. Methods of delivery Limited broadcast address Address 255.255.255.255 (all bits 1 in all parts of the IP address), meaning all hosts on the local subnet. Routers do not forward this packet. Methods of delivery Network-directed broadcast address This is used in an unsubnetted environment, with the host part being all 1’s, e.g., 184.108.40.206, meaning all hosts on a network. Routers should forward these broadcast messages. Methods of delivery With multicasting, any host in the Internet can associate to a multicast group, which is identified by a Class D multicast address. Packets sent to a multicast address are forwarded only to the members of the corresponding host group, which allows for one-to-many connections. E.g., used for audio/video brodcasting. Methods of delivery With anycasting (not available in IPv4), hosts can be grouped into anycast pools, which are considered by the network to be interchangeable. When a remote host sends an IP datagram to an anycast address, that datagram is delivered to any of the hosts in the pool. E.g., used for web proxies. The IP address exhaustion problem The number of networks on the Internet has been approximately doubling annually for a number of years. Nearly all of the new networks assigned in the late 1980s were Class B, and in 1990 it became apparent that if this trend continued, the last Class B network number would be assigned during 1994. On the other hand, Class C networks were hardly being used. The IP address exhaustion problem To mitigate the exhaustion problem, Class B networks have been only assigned to organizations that: – have a subnetting plan that documents more than 32 subnets within its organizational network; – have more than 4096 hosts. Otherwise, a consecutively numbered block of Class C network numbers are assigned instead. Any requirements for a Class A network would be handled on an individual case basis. Private IP addresses Another approach to conserve the IP address space is to use private IP addresses. Private IP addresses do not need to be unique within the Internet. However, hosts with private IP addresses cannot communicate with hosts outside their local networks. Private IP addresses Three ranges of addresses have been reserved for this purpose: – 10.0.0.0, as a single Class A network; – 172.16.0.0 through 172.31.0.0, as 16 contiguous Class B networks; – 192.168.0.0 through 192.168.255.0, as 256 contiguous Class C networks. These addresses can be used without requesting authorization from the RIR. Classless Inter-Domain Routing While subnetting and careful assignment of IP addresses mitigated the IP address exhaustion problem, a new issue arised: the routing table explosion problem. Assume an organization has 4000 hosts. Then, it cannot be assigned a Class B network, and is allocate 16 Class C networks instead. This requires 16 entries in the routing table of every router in the world for the same organization. Classless Inter-Domain Routing The solution to this problem is called Classless Inter-Domain Routing (CIDR). CIDR does not route according to the class of the network number (hence the term classless). On the other hand, it is based solely on the high order bits of the IP address. Classless Inter-Domain Routing Each CIDR routing table entry contains a 32-bit IP address and a 32-bit network mask, which together give the length and value of the IP prefix: <IP_address> <network_mask> For example, to address a block of eight Class C addresses with one single routing table entry, the following representation suffices: <220.127.116.11> <255.255.248.0> Classless Inter-Domain Routing This process of combining multiple networks into a single entry is referred to as supernetting. Routing is based on network masks that are shorter than the natural network mask of an IP address. This contrasts subnetting where the subnet masks are longer than the natural network mask. Classless Inter-Domain Routing Supernetting example. 11000000 00100000 10001000 00000000 = 18.104.22.168 (class C address) 11111111 11111111 11111--- -------- 255.255.248.0 (network mask) ======== ======== ======== ======== logical_AND 11000000 00100000 10001--- -------- = 192.32.136 (IP prefix) 11000000 00100000 10001111 00000000 = 22.214.171.124 (class C address) 11111111 11111111 11111--- -------- 255.255.248.0 (network mask) ======== ======== ======== ======== logical_AND 11000000 00100000 10001--- -------- = 192.32.136 (same IP prefix) IP datagram The unit of transfer in an IP network is called an IP datagram. It consists of an IP header and data relevant to higher level protocols. IP datagram IP datagram VER is the field that contains the IP protocol version. The current version is 4. 5 is an experimental version. 6 is the version for IPv6. HLEN is the length of the IP header in multiples of 32 bits, without the data field. The minimum value for a correct header is 5 (i.e., 20 bytes), the maximum value is 15 (i.e., 60 bytes). IP datagram Service Type The service type is an indication of the quality of service requested for this IP datagram. It contains the following information. Precedence specifies the nature/priority: 000: Routine 001: Priority 010: Immediate 011: Flash 100: Flash override 101: Critical 110: Internetwork control 111: Network control IP datagram TOS specifies the type of service value: 1000: Minimize delay 0100: Maximize throughput 0010: Maximize reliability 0001: Minimize monetary cost 0000: Normal service The last bit is reserved for future use. IP datagram Total Length specifies the total length of the datagram, header and data, in octets. Identification is a unique number assigned by the sender used with fragmentation. Flags contains control flags: – the first bit is reserved and must be zero; – the 2nd bit is DF (Do not Fragment), 0 means allow fragmentation; – the third is MF (More Fragments), 0 means that this is the last fragment. IP datagram Fragment Offset is used to reassemble the full datagram. The value in this field contains the number of 64-bit segments (header bytes are not counted) contained in earlier fragments. If this is the first (or only) fragment, this field contains a value of zero. TTL (Time to Live) specifies the time (in seconds) the datagram is allowed to travel. In practice, this is used as a hop counter to detect routing loops. IP datagram Protocol Number indicates the higher level protocol to which IP should deliver the data in this datagram. E.g., ICMP = 1; TCP = 6; UDP = 17. Header Checksum is a checksum for the information contained in the header. If the header checksum does not match the contents, the datagram is discarded. Source/Destination IP Addresses are the 32-bit source/destination IP addresses. IP datagram IP Options is a variable-length field (there may be zero or more options) used for control or debugging and measurement. For instance: – the loose source routing option provides a means for the source of an IP datagram to supply explicit routing information; – the timestamp option tells the routers along the route to put timestamps in the option data. Padding is used to ensure that the IP header ends on a 32 bit boundary. The padding is zero. IP fragmentation IP provides fragmentation/reassembly of datagrams. The maximum length of an IP datagram is 65,535 octets. When an IP datagram travels from one host to another, it may pass through different physical networks. Each physical network has a maximum frame size, called maximum transmission unit (MTU), which limits the datagram length. IP fragmentation A fragment is treated as a normal IP datagram while being transported to their destination. Thus, fragments of a datagram each have a header. If one of the fragments gets lost, the complete datagram is considered lost. It is possible that fragments of the same IP datagram reach the destination host via multiple routes. Finally, Since they may pass through networks with a smaller MTU than the sender’s one, they are subject to further fragmentation. IP fragmentation H IP datagram 1 nt # 2 gme # 1 ent t# Fra en m gm H Fra Frag Fr H H ag m en H t# 1 H Fr t #2 ag en m m en ag t #1 t #2 Fr t #2 men H men Frag Frag H H H IP datagram H Fragment #1 H Fragment #2 IP fragmentation IP fragmentation Fragmentation process: – The DF flag bit is checked to see if fragmentation is allowed. If the bit is set, the datagram will be discarded and an ICMP error returned to the originator. – Based on the MTU value, the data field is split into two or more parts. All newly created data portions must have a length that is a multiple of 8 octets, with the exception of the last data portion. – Each data portion is placed in an IP datagram. IP fragmentation LEN = 1500 OFFSET = 0 DF = 0, MF = 1 DATA (1500 bytes) LEN = 3499 OFFSET = 0 DF = 0, MF = 0 LEN = 1500 OFFSET = 1500 DF = 0, MF = 1 MTU = 1500 DATA DATA (3500 bytes) (1500 bytes) LEN = 499 OFFSET = 3000 DF = 0, MF = 0 DATA (499 bytes) IP fragmentation Modification to the headers of fragments: – the MF flag is set in all fragments except the last; – the fragment offset field is updated; – if options were included in the original datagram, they may be copied to all fragment datagrams or only the first datagram (depends on the option); – the header length field is set; – the total length field is set; – the header checksum is re-calculated. IP fragmentation At the destination host, data are reassembled into the original datagram. The identification field set by the sending host is used together with the source and destination IP addresses in the datagram. Fragmentation does not alter this field. In order to reassemble the fragments, the receiving host allocates a storage buffer when the first fragment arrives. IP fragmentation The host also starts a timer. If the timer is exceeded and fragments remain outstanding, the datagram is discarded (in linux this value, in seconds, is stored into /proc/sys/net/ipv4/ipfrag_time). When subsequent fragments of the datagram arrive, data are copied into the buffer storage at the location indicated by the fragment offset field. When all fragments have arrived, the original unfragmented datagram is restored and passed to upper layers, if needed.
Pages to are hidden for
"Internet Protocol version 4"Please download to view full document