540 likes | 687 Views
Chapter 4. Network Layer With special emphasis on Internet Protocol (IP). Contents. Functions of network layer Internet protocol (IP) IP Header IP Addresses CIDR notation Obtaining IP addresses IP version 6. Functions of the Network layer.
E N D
Chapter 4 Network Layer With special emphasis on Internet Protocol (IP)
Contents • Functions of network layer • Internet protocol (IP) • IP Header • IP Addresses • CIDR notation • Obtaining IP addresses • IP version 6
Functions of the Network layer • Transfer variable length data packets from a source network to a destination network via one or more networks • This task is called Routing
Routing and road trips • Consider a long distance road trip • The source and final destination are like network layer addresses • Each interstate exit is like a data link layer address
Internet protocol (IP) overview • Most common protocol at the Network Layer • Specified in RFC 791 (Sep 1981) • First used on a large scale in BSD UNIX • http://www.isoc.org/internet/history/brief.shtml • Now used by default in all operating systems
IP capabilities • Highly adaptable • Most current uses of the Internet (http, IM, bit-torrent, movie downloads) did not exist at the time of creation of IP • Even email was only specified a year later in Aug 1982 in RFC 821 • But IP can serve all these applications • IP does not provide end-to-end reliability, sequencing etc
IP Header fields • Like other layers, IP header fields enable IP functionality • Used primarily by routers to find addresses • Version • Header length • Length of header in multiples of 32 bits • minimum value = 5
IP Header fields • Type of service • Packets with higher value should get higher priority • But generally not currently implemented • Total length • Size of packet, including header and data • ID • Used to re-assemble packet if it is fragmented by intermediate routers
IP Header fields • Flags • Indicates whether packet may be further fragmented, and whether it has in fact, been fragmented • Fragment offset • Location of packet with respect to TCP datagram • Time to live
IP Header fields • Protocol • Indicates protocol of IP user technology • Specified in RFC 790 • E.g. TCP = 6, UDP = 21, ICMP = 1 • Checksum • Options • Can be used to indicate source routing
IP Addresses • An address is a unique label that helps locate an entity on a network • 32-bit values in source and destination address fields • Every computer on the Internet has an IP address • Unlike MAC (Ethernet) addresses, IP addresses are assigned by network administrators
Binary numbers overview • Binary numbers are extremely important in data communications • IP addresses use binary numbers • Maximum computer network sizes depend upon sizes of binary numbers • You should be able to convert from 8-bit binary numbers to decimal and vice-versa
Using binary numbers • The most important use of binary numbers in this class is to assign computer addresses • In this chapter, we focus on assigning computers with a unique label • You should be able to determine the maximum number of addresses possible given the number of binary digits (bits) available for labeling/ addressing
Binary numbers as labels ID: 0 ID: 1 ID: 00 ID: 01 ID: 10 ID: 11
Used to compute subnet sizes, broadcast addresses etc. You should be comfortable with binary numbers with up to 8 digits One technique is to fill-in-the-blanks Start with template below Place 1 in the leftmost-possible position Subtract place-value and repeat until subtraction yields 0 Converting from decimal to binary
e.g.: 133 128 is less than 133 Hence place 1 over 128, remainder is 133 – 128 = 5 Converting from decimal to binary • Largest number less than 5 is 4 • Hence place 1 over 4 • Remainder is 5 - 4 = 1 • Largest number less than or equal to 1 is 1 • Hence place 1 over 1 • You get: 10000101
Converting from decimal to binary • Try converting the following numbers to binary • 134 • 200 • 240 • 250 • Hint: When numbers become large, subtraction from 255 may be easier
Converting from binary to decimal • Use the same template as before • Add the place values corresponding to the locations that have 1 in the number • E.g.: 11100011 • In decimal, this number is: • 1*128 + 1*64 + 1*32 + 1*2 + 1*1 • = 227
You should be comfortable working with binary numbers with up to 8 bits e.g.: 10011011 Converting from binary to decimal • This number is equal to: • 1*128 + 0*64 + 0*32 + 1*16 + 1*8 + 0*4 + 1*2 + 1*1 • = 155 • Largest possible number with 8 digits?
Converting from binary to decimal • Try converting the following numbers to decimal • 10000110 • 11001000 • 11110000 • 11111010
Dotted decimal notation • IP addresses are written in dotted decimal notation • E.g.. 192.168.1.5
IP Addresses (dotted decimal notation) • Examples
IP addresses – structure • IP addresses are not assigned at random like MAC addresses • Or even on first-come-first-serve basis • The first few address bits define the organization to which the address belongs • Remaining bits are unique to the computer (host) within the organization
IP addresses – structure • This is similar to phone numbers • (813) 974 - 6716 • Tampa USF Office • Or credit card numbers • 4 31412 345678 4321 • Visa Bank Account number
IP addresses – structure • Or zip codes • 3 36 47 • State group Region Delivery address (PO) • Visualization at http://benfry.com/zipdecode
IP Addresses - structure • IP addresses are split into network part and host part • Network part identifies the network (autonomous system) to which the address belongs • Most commonly associated with telecom carriers • Also, with large organizations such as state universities • Host part identifies the host within the network • Host part is generally broken further into subnets
IP Address classes • Network parts of IP addresses were initially classified into 3 address classes • An organization could request an address block best suited to its needs • Class A for the largest organizations • Class B for organizations like Universities such as USF • Class C for small businesses
Class A networks • First octet in the range 0 – 127 • 24 bits for host address in each network • 7 bits for network ID • 27 = 128 possible Class A networks • Each network has 224 = 16,777,216 IP addresses
Class B and C networks • Class B networks • First octet in the range 128-191 • 16 bits for host address in each network • Each network has 216 = 65,536 IP addresses • 14 bits for network ID • 214 = 16,384 possible Class B networks • Class C networks • First octet in the range 192-223 • 8 bits for host address in each network • Each network has 28 = 256 IP addresses • 21 bits for network ID • 221 = 2,097,152 possible Class C networks
Address classes and network addresses • The class of an address is uniquely identifiable from the address itself • Examples • 66.3.5.2: Class ? • 131.247.16.8: Class ? • 221.45.67.198: Class ? • We will see in later chapters that network part of address is very important for routing
CIDR • Stands for Classless Inter-Domain Routing • Eliminates address classes • Defined in RFC 1519 • Focus here on addressing component of RFC • Aims to solve two problems with classed addresses
CIDR • Address blocks can be of arbitrary length • Block sizes of any power of 2 are available • Primary beneficiaries of CIDR addressing are medium-sized organizations • Too big for Class C (~250 hosts), too small for Class B (~65,000 hosts)
CIDR notation • Address class is no longer uniquely identifiable from the address • We must find a way of telling routers the size of the network part of the address • Done by including a number along with the network address • E.g. 73.5.0.0/ 17
CIDR notation • In the above example, the first 17 bits of the address are the network part • You can search for more example CIDR address blocks at http://www.arin.net
Obtaining IP addresses • Regional registries • IP addresses distributed around the globe • American Registry for Internet Numbers • RIPE Network Coordination Centre (RIPE NCC) • Europe, the Middle East and Central Asia • Asia-Pacific Network Information Centre (APNIC) • Asia and the Pacific region • Latin American and Caribbean Internet Address Registry (LACNIC) • African Network Information Centre (AfriNIC)
Obtaining IP addresses • Registries prefer allocating large address pools to large carriers • RFC 2050 • Sec 2.1: ISPs who exchange routing information with other ISPs at multiple locations and operate without default routing may request space directly from the regional registry in its geographical area • Most organizations will obtain IP addresses from these carriers (ISPs)
Obtaining IP addresses • Requesting initial allocation from ARIN • http://www.arin.net/registration/guidelines/ipv4_initial_alloc.html • ARIN allocation pre-requisites • http://www.arin.net/policy/nrpm.html#four • Assigned network addresses • RFC 790 (1981) • http://www.iana.org/assignments/ipv4-address-space (current)
IP version 6 • Current version of IP is 4 • IPv4 has one major limitation • Total IPv4 address pool • 232 = 4,294,967,296 (about 4 billion) • Approx 1 IP address per person • But allocation is not very efficient
IP version 6 overview • IPv6 defined in RFC 2460 • Primarily expands source and destination address fields • Also simplifies packet processing at routers • Eliminates header checksum • And adds some telecom carrier-friendly features such as flow labels
IP version 6 address pool • IP version 6 is mainly intended to eliminate shortage of IP addresses • Total address pool = 2128 addresses = • 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses (340 * 1036) • Surface area of earth = 510,007,200,000,000 m2 (510*1012 m2) • 600 billion trillion IP addresses per square meter of the Earth’s surface (including oceans, deserts etc)
IP version 6 header fields • Version • 6 • Traffic class • Similar to IPv4 TOS field • Allows sender to specify service priority for data • Flow label • Allows sender to label a few packets for special handling
IP version 6 header fields • Payload length • Length of data in packet • Similar to total length field in IPv4 • Next header • Transport layer user of IP • Same as protocol field in IPv4 • Specified in RFC 1700 • Hop limit • Same as TTL field of IPv4
Summary • Functions of IP • Why different parts of IP addresses • Why CIDR • Obtaining IP addresses • IP version 6