0% found this document useful (0 votes)
13 views

5 Network-Layer Part 1 Logical Addressing (1)

Uploaded by

aminasama1990
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

5 Network-Layer Part 1 Logical Addressing (1)

Uploaded by

aminasama1990
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 70

The Network Layer

 Concerned with getting packets from the


source all the way to the destination.
 Getting to the destination may require making
many hops at intermediate routers along the
way.

The main function (goal) of the network


layer is routing packets from the source
machine to the destination machine.
The Network Layer
• To achieve its goals, the network layer should
be able to:
– Know the topology of the network.
– Choose appropriate paths through it, even for
large networks.
– Choose routes to avoid overloading some of the
communication lines and routers while leaving
others idle.
• If source and destination are in different
networks
– new challenges emerge.
– It is up to the network layer to deal with them.
The Network Layer
– Major topics to be covered:
– Part 1: Logical Addressing
– Part 2: Network Layer Protocols.
– Part 3: Routing Algorithms

3
Part 1:
Logical Addressing
Reference Chapter 19 from ref1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 19.4
19-1 IPv4 ADDRESSES

An IPv4 address is a 32-bit address that uniquely and


universally defines the connection of a device (for
example, a computer or a router) to the Internet.

Topics discussed in this section:


• Address Space Notations
• Classful Addressing
• Classless Addressing
• Network Address Translation (NAT)

19.5
Notes:

An IPv4 address is 32 bits long.

The IPv4 addresses are unique


and universal.

The address space of IPv4 is


232 or 4,294,967,296.

19.6
Figure 19.1 Dotted-decimal notation and binary notation for an IPv4 address

19.7
Example 19.1

Change the following IPv4 addresses from binary


notation to dotted-decimal notation.

Solution
We replace each group of 8 bits with its equivalent decimal number (see
Appendix B) and add dots for separation:

19.8
Example 19.2

Change the following IPv4 addresses from dotted-


decimal notation to binary notation.

Solution
We replace each decimal number with its binary equivalent
(see Appendix B).

19.9
Example 19.3

Find the error, if any, in the following IPv4 addresses.

19.10
Example 19.3

Find the error, if any, in the following IPv4 addresses.

Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.

19.11
In classful addressing, the address
space is divided into five classes:
A, B, C, D, and E.

19.12
Figure 19.2 Classes in binary and dotted-decimal notation

• The concept of address classes is now considered legacy and not commonly used for
modern IP addressing.
• The introduction of Classless Inter-Domain Routing (CIDR) allows for more flexible
allocation of IP address blocks, irrespective of the traditional class boundaries.
13
Finding the classes in binary and dotted-decimal notation

19.14
Example 19.4

Find the class of each address.


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

19.15
Example 19.4

Find the class of each address.


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a
class C address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.

19.16
Table 19.1 Number of blocks and block size in classful IPv4 addressing

19.17
In classful addressing, a large part of
the available addresses were wasted.

19.18
Table 19.2 Default masks for classful addressing

19.19
Classful addressing, which is almost
obsolete, is replaced with classless
addressing.

19.20
Example 19.5
Figure 19.3 shows a block of addresses, in both binary
and dotted-decimal notation, granted to a small business
that needs 16 addresses.

Figure 19.3 A block of 16 addresses granted to a small organization

19.21
Example 19.5

• In figure 19.3
o The addresses are contiguous.
o The number of addresses is a power of 2 (16 = 24)

19.22
In IPv4 addressing, a block of
addresses can be defined as
x.y.z.t /n
in which x.y.z.t defines one of the
addresses and the /n defines the mask.

19.23
The first address in the block can be
found by setting the rightmost
32 − n bits to 0s.

19.24
Example 19.6

A block of addresses is granted to a small


organization. We know that one of the addresses is
205.16.37.39/28. What is the first address in the
block?

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 00100000
or
205.16.37.32
This is actually the block shown in Figure 19.3.

19.25
The last address in the block can be
found by setting the rightmost
32 − n bits to 1s.

19.26
Example 19.7

Find the last address for the block in Example 19.6.

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47

This is the last address in the block shown in Figure 19.3.

19.27
The number of addresses in the block
can be found by using the formula
232−n

19.28
Example 19.8

Find the number of addresses in Example 19.6.


Solution
The value of n is 28, which means that number
of addresses is:

2 32−28 or 16

19.29
Another method to extract information
from a prefix

• to find the first address, the last address, and the


number of addresses: represent the mask as a 32-
bit binary (or 8-digit hexadecimal) number.
• Then do bitwise operations (see the next example)
• This is particularly useful when we are writing a
program to find these pieces of information.

19.30
Example 19.9

• In Example 19.5 the /28 prefix can be


represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).

• Find
a. The first address
b. The last address
c. The number of addresses.

19.31
Example 19.9 (continued)

Solution
a. The first address can be found by ANDing the given addresses
with the mask. ANDing here is done bit by bit. The result of
ANDing 2 bits is 1 if both bits are 1s and is 0 otherwise.

19.32
Example 19.9 (continued)

b. The last address can be found by ORing the given


addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is 0 if
both bits are 0s; the result is 1 otherwise.

The complement of a number is found by changing each to


0 and each 0 to 1.

19.33
Example 19.9 (continued)

c. The number of addresses can be found by


complementing the mask, interpreting it as a
decimal number, and adding 1 to it.

19.34
Figure 19.4 A network configuration for the block 205.16.37.32/28

19.35
The first address in a block is
normally not assigned to any device;
it is used as the network address that
represents the organization
to the rest of the world.

19.36
Figure 19.5 Two levels of hierarchy in an IPv4 address

Analogy: phone numbers

19.37
Figure 19.6 A frame in a character-oriented protocol

19.38
Each address in the block can be
considered as a two-level
hierarchical structure:
the leftmost n bits (prefix) define
the network
the rightmost 32 − n bits define
the host.

19.39
Figure 19.7 Configuration and addresses in a subnetted network

19.40
Figure 19.8 Three-level hierarchy in an IPv4 address

19.41
Example 19.10

An ISP is granted a block of addresses starting with


190.100.0.0/16 (65,536 addresses). The ISP needs
to distribute these addresses to three groups of
customers as follows:
a. The first group has 64 customers; each needs 256
addresses.
b. The second group has 128 customers; each needs
128 addresses.
c. The third group has 128 customers; each needs 64
addresses.
Design the subblocks and find out how many addresses
are still available after these allocations.

19.42
Example 19.10 (continued)
Group 1: 64 customers
For this group, each customer needs 256
addresses. This means that 8 (log2 256) bits
are needed to define each host. The prefix
length is then 32 − 8 = 24. The addresses
are

Note: Figure 19.9 shows the situation.


19.43
Example 19.10 (continued)

Group 2: 128 customers


For this group, each customer needs 128
addresses. This means that 7 (log2 128) bits are
needed to define each host. The prefix length is
then 32 − 7 = 25. The addresses are

19.44
Example 19.10 (continued)
Group 3: 128 customers
For this group, each customer needs 64
addresses. This means that 6 (log264) bits are
needed to each host. The prefix length is then 32
− 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576

19.45
Figure 19.9 An example of address allocation and distribution by an ISP

19.46
Exercise
• An organization is granted a block of addresses
with the beginning address 14.24.74.0/24. The
organization needs to have 3 subblocks of
addresses to use in its three subnets: one subblock
of 10 addresses, one subblock of 60 addresses, and
one subblock of 120 addresses. Design the
subblocks.

• Hint, start by assigning addresses addresses to the


largest then smaller subnets (you must assign
blocks of power of 2).
*Solution: see Example 18.5 (CHAPTER 18 INTRODUCTION TO NETWORK LAYER page 537
In Forouzan’s textbook) 47
Private IP addresses
• A range of IP addresses reserved for use within a
network (homes, businesses, or organizations.)
• they are not routable on the public internet
• Private IP addresses are often used in conjunction with
Network Address Translation (NAT)
• Devices within the same private network can
communicate with each other using their private IP
addresses
• commonly assigned dynamically using the Dynamic
Host Configuration Protocol (DHCP)

19.48
Private IP addresses
• Range of private addresses:
– IPv4: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and
169.254.0.0/16.
– IPv6: FC00::/7 range.

Table 19.3 Addresses for private networks

19.49
Figure 19.10 A NAT implementation

NAT: allows multiple devices within a private


network to share a single public IP address when
accessing the internet.

19.50
Figure 19.11 Addresses in a NAT

19.51
Figure 19.12 NAT address translation

19.52
Table 19.4 Five-column translation table

19.53
19-2 IPv6 ADDRESSES

Despite all short-term solutions, address


depletion is still a long-term problem for the
Internet. This and other problems in the IP
protocol itself have been the motivation for
IPv6.

Topics discussed in this section:


Structure
Address Space

19.54
An IPv6 address is 128 bits long.

19.55
Figure 19.14 IPv6 address in binary and hexadecimal colon notation

19.56
Figure 19.15 Abbreviated IPv6 addresses

19.57
Example 19.11

Expand the address 0:15::1:12:1213 to its


original.
Solution
We first need to align the left side of the double colon
to the left of the original pattern and the right side of
the double colon to the right of the original pattern to
find how many 0s we need to replace the double colon.

This means that the original address is.

19.58
Ambiguity of multiple “::” in an address

• Note that in an IPv6 address, the double


colon "::" can be used to represent
consecutive blocks of zeros.
– However, it can only be used once to
avoid ambiguity.

• For example, in the address


"0:15::1::1213" there are two instances
of the double colon "::" which is not
allowed. 59
Prefix Length Notation
• IPv6 address prefixes can be represented
much the same way that IPv4 address prefixes
are written in Classless Inter-Domain Routing
CIDR notation.

• An IPv6 address prefix (the network portion of


the address) is represented using the following
format:

ipv6-address/prefix-length
The prefix-length is a decimal value indicating the
number of leftmost contiguous bits of the address.

60
Types of IP Address Version 6

425,352,958,651,173,079,329,218,259,289,
710,264 (or 4.25×1037)unique IP addresses

"Four decillion, two hundred fifty quintillion, three hundred twenty-nine


quadrillion, five hundred eighty-six trillion, five hundred eleven billion,
seven hundred thirty-nine million, three hundred twenty-two thousand,
eight hundred twenty-five." 61
Anycast Addresses
IPv6 anycast address is an address that can be
assigned to more than one interface (typically different
devices). Multiple devices can have the same anycast
address. A packet sent to an anycast address is routed
to the “nearest” interface having that address,
according to the router’s routing table.
Anycast addresses are available for both IPv4 and
IPv6, initially defined in RFC 1546, Host Anycasting
Service. Anycast was meant to be used for services
such as DNS and HTTP but was never really
implemented as designed.
There is no special prefix for an IPv6 anycast
address.
62
Multicast Addresses
• An IPv6 multicast address defines a group of
devices known as a multicast group.
• IPv6 multicast addresses use the prefix
ff00::/8, shown in Table 4-10, which is
equivalent to the IPv4 multicast address
224.0.0.0/4.
• A packet sent to a multicast group always has
a unicast source address.
• A multicast address can never be the source
address.

63
Unicast Address
• Following are different types of unicast addresses in IPv6:
 Global unicast: A routable address in the IPv6 Internet, similar to
a public IPv4 address.
 Link-local: Used only to communicate with devices on the same
local link.
 Loopback: An address not assigned to any physical interface
that can be used for a host to send an IPv6 packet to itself.
 Unspecified address: Used only as a source address and
indicates the absence of an IPv6 address.
 Unique local: Similar to a private address in IPv4 (RFC 1918)
and not intended to be routable in the IPv6 Internet.
 IPv4 embedded: An IPv6 address that carries an IPv4 address
in the low-order 32 bits of the address.

64
Global Unicast
• Global unicast addresses (GUAs), are globally routable and reachable in the IPv6
Internet. They are equivalent to public IPv4 addresses. The generic structure of a
GUA, which has three fields:
 Global Routing Prefix: The Global Routing Prefix is the prefix or network portion of
the address assigned by the provider, such as an ISP, to the customer site.
 Subnet ID: The Subnet ID is a separate field for allocating subnets within the
customer site. Unlike with IPv4, it is not necessary to borrow bits from the Interface
ID (host portion) to create subnets. The number of bits in the Subnet ID falls between
where the Global Routing Prefix ends and where the Interface ID begins.
 Interface ID: The Interface ID identifies the interface on the subnet, equivalent to the
host portion of an IPv4 address. The Interface ID in most cases is 64 bits.

65
Unique Local Address
❑ Organizations can manually set addresses using the prefix FD::/64.

❑ Unique local addresses work like the IPv4 private addresses.


You can use these addresses on your own network if you don’t
intend to connect to the Internet or if you plan to use IPv6 NAT.

❑ The advantage of unique local addresses is that you don’t need to


register at an authority to get some address space.

❑ Allow an enterprise to number internal resources within their


administrative domain with addresses that are unique, but not
tied to routing policy, easing the pain if a change of ISP means that
renumbering is required.

66
Link Local Address
❑ The link-local addresses start with the prefix fe80::/10.

❑ Even if there is no routing, each IPv6 interface has to have a


link-local address configured. This is essential.

❑ IPv6 Link-Local Address is the local address assigned only in a


single subnet. They are automatically assigned to the
interfaces. IPv6 Link-Local Addresses are only used on
the same link.

❑ These addresses are not routable on Internet. They are only


used for neighbor discovery and next hop configuration.

67
IPv6 loopback
 The loopback address represents the same interface as a computer. The
TCP/IP protocol stack loops the packets back on the same interface both in
IPv4 and IPv6.
 In IPv4, 127.0.0.0/8 network is reserved for loopback addresses.
 In IPv6, the loopback address is
0000:0000:0000:0000:0000:0000:0000:0001/128. It can be simplified to::1/128.

68
Figure 19.18 Reserved addresses in IPv6

19.69
Figure 19.18 Reserved addresses in IPv6

 Unspecified = used to indicate the absence of an address.


 Loopback = enable a host to send back packets to itself = 127.0.0.1
 IPv4 compatible Address = used by IPv6/IPv4v nodes that are
communicating with IPv6 address over an IPv4 infrastructure
 IPv4 Mapped Address: used to represent an IPv4 address in 128 bit IPv6

19.70

You might also like