Ip 21
Ip 21
By Douglas E. Comer
Lecture PowerPoints
By Lami Kaya, LKaya@ieee.org
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 1
Chapter 21
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 2
Topics Covered
• 21.1 Introduction
• 21.2 Addresses for the Virtual Internet
• 21.3 The IP Addressing Scheme
• 21.4 The IP Address Hierarchy
• 21.5 Original Classes of IP Addresses
• 21.6 Dotted Decimal Notation
• 21.7 Division of the Address Space
• 21.8 Authority for Addresses
• 21.9 Subnet and Classless Addressing
• 21.10 Address Masks
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 3
Topics Covered
• 21.11 CIDR Notation
• 21.12 A CIDR Example
• 21.13 CIDR Host Addresses
• 21.14 Special IP Addresses
• 21.15 Summary of Special IP Addresses
• 21.16 The Berkeley Broadcast Address Form
• 21.17 Routers and the IP Addressing Principle
• 21.18 Multi-Homed Hosts
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 4
21.1 Introduction
• This chapter
– begins a description of protocol software that makes the Internet
appear to be a single, seamless communication system
– introduces the addressing scheme used by IP version 4 (IPv4)
• Unless otherwise noted, Internet Protocol and IP refer to version 4 of IP throughout the
text
– discusses the use of address masks for classless and subnet
addressing
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 5
21.2 Addresses for the Virtual Internet
• To achieve a seamless communication system
– protocol software must hide the details of physical networks
– it should offer the illusion of a single, large network
• From the point of view of an application
– the virtual Internet operates like any network
• allowing computers to send and receive packets
• The main difference between the Internet and a physical
network is
– that the Internet is an abstraction imagined by its designers and
created entirely by protocol software
• Thus, the designers chose
– addresses, packet formats, and delivery techniques independent of
the details of the underlying hardware
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 6
21.2 Addresses for the Virtual Internet
• Addressing is a critical component of the Internet
• All host computers must use a uniform addressing scheme
• Each address must be unique
• MAC addresses do not suffice because
– the Internet can include multiple network technologies
– and each technology defines its own MAC addresses
• The advantage of IP addressing lies in uniformity:
– an arbitrary pair of application programs can communicate without
knowing the type of network hardware or MAC addresses being
used
• IP addresses are supplied by protocol software
– They are not part of the underlying network
• Many layers of protocol software use IP addresses
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 7
21.3 The IP Addressing Scheme
• Each host is assigned a unique 32-bit number
– known as the host's IP address or Internet address
• When sending a packet across the Internet, sender’s
protocol software must specify
– its own 32-bit IP address (the source address)
– and the address of the intended recipient (the destination address)
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 8
21.4 The IP Address Hierarchy
• IP address is divided into two parts:
• A prefix
– identifies the physical network to which the host is attached
– Each network in the Internet is assigned a unique network number
• A suffix
– identifies a specific computer (host/node) on the network
– Each computer on a given network is assigned a unique suffix
• IP address scheme guarantees two properties:
– Each computer is assigned a unique address
(i.e., a single address is never assigned to more than one computer)
– Network number (prefix) assignments must be coordinated globally
– Suffixes are assigned locally without global coordination
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 9
21.5 Original Classes of IP Addresses
• How many bits to place in each part of an IP address?
– The prefix needs sufficient bits to allow a unique network number to
be assigned to each physical network in the Internet
– The suffix needs sufficient bits to permit each computer attached to
a network to be assigned a unique suffix
• No simple choice was possible to allocate bits!
– Choosing a large prefix accommodates many networks
• but limits the size of each network
– Choosing a large suffix means each physical network can contain
many computers
• but limits the total number of networks
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 10
21.5 Original Classes of IP Addresses
• Internet contains a few large physical networks and many
small networks
– the designers chose an addressing scheme to accommodate a
combination of large and small networks
• The original classful IP addressing divided the IP address
space into three (3) primary classes
– each class has a different size prefix and suffix
• The first four bits of an IP address determined the class to
which the address belonged
– It specifies how the remainder of the address was divided into prefix
and suffix
• Figure 21.1 illustrates the five address classes
– the leading bits used to identify each class
– and the division into prefix and suffix
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 11
21.5 Original Classes of IP Addresses
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 12
21.6 Dotted Decimal Notation
• A notation more convenient for humans to understand is used
• Notation that has been accepted is
– express each 8-bit section of a 32-bit number as a decimal value
– use periods to separate the sections
– The scheme is known as dotted decimal notation
• Figure 21.2 illustrates examples of binary numbers and the equivalent
dotted decimal notation
• Dotted decimal treats each octet (byte) as an unsigned binary integer
– the smallest value, 0
• occurs when all bits of an octet are zero (0)
– the largest value, 255
• occurs when all bits of an octet are one (1)
– dotted decimal addresses range
0.0.0.0 through 255.255.255.255
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 13
21.6 Dotted Decimal Notation
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 14
21.7 Division of the Address Space
• The classful scheme divided the address space into unequal
sizes
• The designers chose an unequal division to accommodate a
variety of scenarios
– For example, although it is limited to 128 networks, class A contains
half of all addresses
• The motivation was to allow major ISPs to each deploy a large network that
connected millions of computers
– Similarly, the motivation for class C was to allow an organization to
have a few computers connected on a LAN
• Figure 21.3 summarizes the maximum number of networks
available in each class and the maximum number of hosts
per network
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 15
21.7 Division of the Address Space
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 16
21.8 Authority for Addresses
• Internet Corporation for Assigned Names and Numbers
(ICANN) authority has been established
– to handle address assignment and adjudicate disputes
• ICANN does not assign individual prefixes
– Instead, ICANN authorizes a set of registrars to do so
• Registrars make blocks of addresses available to ISPs
– ISPs provide addresses to subscribers
• To obtain a prefix
– a corporation usually contacts an ISP
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 17
21.9 Subnet and Classless Addressing
• As the Internet grew
– the original classful addressing scheme became a limitation
• Everyone demanded a class A or class B address
– So they would have enough addresses for future growth
• but many addresses in class A and B were unused
– Many class C addresses remained, but few wanted to use them
• Two mechanisms were invented to overcome the limitation:
– Subnet addressing
– Classless addressing
• The two mechanisms are closely related
– they can be considered to be part of a single abstraction:
• instead of having three distinct address classes, allow the division between
prefix/suffix on an arbitrary bit boundary
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 18
21.9 Subnet and Classless Addressing
• Subnet addressing was initially used within large organizations
• Classless addressing extended the approach to all Internet
• The motivation for using an arbitrary boundary?
• Consider an ISP that hands out prefixes. And suppose a
customer of the ISP requests a prefix for a network that
contains 55 hosts
– classful addressing requires a complete class C prefix
– only 4 bits of suffix are needed to represent all possible host values
• means 219 of the 254 possible suffixes would never be assigned
– most of the class C address space is wasted
• For the above example
– classless addressing allows the ISP to assign
• a prefix that is 26 bits long
• a suffix that is 6 bits long
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 19
21.9 Subnet and Classless Addressing
• Assume an ISP owns a class C prefix
– Classful addressing assigns the entire prefix to one organization
• With classless addressing
– the ISP can divide the prefix into several longer prefixes
– and assign each to a subscriber
• Figure 21.4 illustrates how classless addressing allows an
ISP to divide a class C prefix into four (4) longer prefixes
– each one can accommodate a network of up to 62 hosts
– the host portion of each prefix is shown in gray
• The original class C address has 8 bits of suffix
– and each of the classless addresses has 6 bits of suffix
• Assuming that the original class C prefix was unique
– each of the classless prefixes will also be unique
• Thus, instead of wasting addresses
– ISP can assign each of the four (4) classless prefixes to a subscriber
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 20
21.9 Subnet and Classless Addressing
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 21
21.10 Address Masks
• How can an IP address be divided at an arbitrary boundary?
• The classless and subnet addressing schemes require
hosts and routers to store an additional piece of information:
– a value that specifies the exact boundary between the network prefix
and the host suffix
• To mark the boundary, IP uses a 32-bit value
– known as an address mask, also called a subnet mask
• Why store the boundary size as a bit mask?
– A mask makes processing efficient
• Hosts and routers need to compare the network prefix
portion of the address to a value in their forwarding tables
– The bit-mask representation makes the comparison efficient
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 22
21.10 Address Masks
• Suppose a router is given
– a destination address, D
– a network prefix represented as a 32-bit value, N
– a 32-bit address mask, M
• Assume the top bits of N contain a network prefix, and the
remaining bits have been set to zero
• To test whether the destination lies on the specified
network, the router tests the condition:
N == (D & M)
• The router
– uses the mask with a “logical and (&)” operation to set the host bits
of address D to zero (0)
– and then compares the result with the network prefix N
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 23
21.10 Address Masks
As an example:
• Consider the following 32-bit network prefix:
10000000 00001010 00000000 00000000 = 128.10.0.0
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 24
21.11 CIDR Notation
• Classless Inter-Domain Routing (CIDR)
– The name is unfortunate because CIDR only specifies addressing
and forwarding
– Designers wanted to make it easy for a human to specify a mask
• Consider the mask needed for the example in Figure 21.4b
– It has 26 bits of 1s followed by 6 bits of 0s
– In dotted decimal, the mask is: 255.255.255.192
• The general form of CIDR notation is: ddd.ddd.ddd.ddd/m
– ddd is the decimal value for an octet of the address
– m is the number of one bits in the mask
• Thus, one might write the following: 192.5.48.69/26
– which specifies a mask of 26 bits
• Figure 21.5 lists address masks in CIDR notation
– along with the dotted decimal equivalent of each
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 25
Figure 21.5
A list of
address masks
in CIDR
notation and in
dotted decimal
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 26
21.12 A CIDR Example
• Assume an ISP has the following block 128.211.0.0/16
• Suppose the ISP has 2 customers
– one customer needs 12 IP addresses and the other needs 9
• The ISP can assign
– customer1 CIDR: 128.211.0.16/28
– customer2 CIDR: 128.211.0.32/28
– both customers have the same mask size (28 bits), the prefixes
differ
• The binary value assigned to customer1 is:
10000000 11010011 00000000 0001 0000
• The binary value assigned to customer2 is:
10000000 11010011 00000000 0010 0000
• There is no ambiguity
– Each customer has a unique prefix
– More important, the ISP retains most of the original address block
© 2009
• itPearson Education
can then Inc.,toUpper
allocate otherSaddle River, NJ. All rights reserved.
customers 27
21.13 CIDR Host Addresses
• Once an ISP assigns a customer a CIDR prefix
– the customer can assign host addresses for its network users
– suppose an organization is assigned 128.211.0.16/28
• Figure 21.6 illustrates that the organization will have 4-bits
to use as a host address field
– It shows the highest/lowest addresses in binary and dotted decimal
– The example avoids assigning the all 1s and all 0s host addresses
• Figure 21.6 illustrates a disadvantage of classless
addressing
• Because the host suffix can start on an arbitrary boundary
– values are not easy to read in dotted decimal
– For example
• when combined with the network prefix, the 14 possible host suffixes result
in dotted decimal values from 128.211.0.17 through 128.211.0.30
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 28
21.13 CIDR Host Addresses
29
21.14 Special IP Addresses
• IP defines a set of special address forms that are reserved
– That is, special addresses are never assigned to hosts
• This section describes both the syntax and semantics of
each special address form
– 21.14.1 Network Address
– 21.14.2 Directed Broadcast Address
– 21.14.3 Limited Broadcast Address
– 21.14.4 This Computer Address
– 21.14.5 Loopback Address
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 30
21.14 Special IP Addresses
21.14.1 Network Address
• One of the motivations for defining special address forms
can be seen in Figure 21.6
• It is convenient to have an address that can be used to
denote the prefix assigned to a given network
• IP reserves host address zero
– and uses it to denote a network
• Thus, the address 128.211.0.16/28 denotes a network
– because the bits beyond the 28 are zero
• A network address should never appear as the destination
address in a packet
• Note: Section 21.16 discusses the Berkeley broadcast
address form, which is a nonstandard exception
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 31
21.14 Special IP Addresses
21.14.2 Directed Broadcast Address
• To simplify broadcasting (send to all)
– IP defines a directed broadcast address for each physical network
• When a packet is sent to a network's directed broadcast
– a single copy of the packet travels across the Internet
• until it reaches the specified network
– the packet is then delivered to all hosts on the network
• The directed broadcast address for a network is formed by
adding a suffix that consists of all 1 bits to the network prefix
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 32
21.14 Special IP Addresses
21.14.2 Directed Broadcast Address
• How does broadcast work?
• If network hardware supports broadcast
– a directed broadcast will be delivered using the hardware broadcast
capability
• If a particular network does not have hardware support for
broadcast
– software must send a separate copy of the packet to each host on
the network
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 33
21.14 Special IP Addresses
21.14.3 Limited Broadcast Address
• Limited broadcast refers to a broadcast on a directly-
connected network:
– informally, we say that the broadcast is limited to a “single wire”
• Limited broadcast is used during system startup
– by a computer that does not yet know the network number
• IP reserves the address consisting of 32-bits of 1s
– refer to limited broadcast
• Thus, IP will broadcast any packet sent to the all-1s address
across the local network
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 34
21.14 Special IP Addresses
21.14.4 This Computer Address
• A computer needs to know its IP address
– before it can send or receive Internet packets
• TCP/IP contains protocols a computer can use to obtain its
IP address automatically when the computer boots
– The startup protocols also use an IP to communicate
• When using such startup protocols
– a computer cannot supply a correct IP source address
– To handle such cases
• IP reserves the address that consists of all 0s to mean this computer
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 35
21.14 Special IP Addresses
21.14.5 Loopback Address
• Loopback address used to test network applications
• It is used for preliminary debugging after a network
application has been created
• A programmer must have two application programs that are
intended to communicate across a network
– Each application includes the code needed to interact with TCP/IP
• Instead of executing each program on a separate computer
– the programmer runs both programs on a single computer
– and instructs them to use a loopback address when communicating
• When one application sends data to another
– data travels down the protocol stack to the IP software
– then forwards it back up through the protocol stack to the second
program
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 36
21.14 Special IP Addresses
21.14.5 Loopback Address
• A programmer can test the program logic quickly
– without needing two computers and without sending packets across
a network
• IP reserves the network prefix 127/8 for use with loopback
• The host address used with 127 is irrelevant
– all host addresses are treated the same
– programmers often use host number 1
– so it makes 127.0.0.1 the most popular loopback address
• During loopback testing no packets ever leave a computer
– the IP software forwards packets from one application to another
• The loopback address never appears in a packet traveling
across a network
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 37
21.15 Summary of Special IP Addresses
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 38
21.16 The Berkeley Broadcast Address Form
• The University of California at Berkeley developed and
distributed an early implementation of TCP/IP protocols
• known as Berkeley Software Distribution (BSD)
• The BSD implementation contained a nonstandard feature
– the Berkeley implementation uses a host suffix that contains all 0s
(i.e., identical to the network address)
– this address form is known as Berkeley broadcast
• Initially many computer manufacturers derived their early
TCP/IP software from the Berkeley implementation
– and a few sites still use Berkeley broadcast
• TCP/IP implementations often include a configuration
parameter
– that can select between the TCP/IP standard and the Berkeley form
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 39
21.17 Routers and the IP Addressing
Principle
• Each router is assigned two or more IP addresses
– one address for each network to which the router attaches
• To understand why, recall two facts:
– A router has connections to multiple physical networks
– Each IP address contains a prefix that specifies a physical network
• A single IP address does not suffice for a router
– because each router connects to multiple networks
– and each network has a unique prefix
• The IP scheme can be explained by a principle:
– An IP address does not identify a specific computer
– each address identifies a connection between a computer and a network
– A computer with multiple network connections (e.g., a router) must be
assigned one IP address for each connection
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 40
21.17 Routers and the IP Addressing
Principle
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 41
21.18 Multi-Homed Hosts
• Can a host connect to multiple networks? Yes
• A host computer with multiple network connections is said to
be multi-homed
• Multi-homing is sometimes used to increase reliability
– if one network fails, the host can still reach the Internet through the
second connection
• Alternatively, multi-homing is used to increase performance
– connections to multiple networks can make it possible to send traffic
directly and avoid routers, which are sometimes congested
• Like a router, a multi-homed host has multiple protocol
addresses
– one for each network connection
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 42