Unit - 4 - Network Layer and Addressing
Unit - 4 - Network Layer and Addressing
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
Network Layer Characteristics
IP Encapsulation
• IP encapsulates the transport
layer segment.
• IP can use either an IPv4 or
IPv6 packet and not impact the
layer 4 segment.
• IP packet will be examined by
all layer 3 devices as it traverses
the network.
• The IP addressing does not
change from source to
destination.
Note: NAT will change addressing,
but will be discussed in a later
module.
Network Layer Characteristics
Characteristics of IP
IP is meant to have low overhead and may be described as:
– Connectionless
– Best Effort
– Media Independent
Network Layer Characteristics
IP is Connectionless
Connectionless
• IP does not establish a connection with the destination before sending
the packet.
• There is no control information needed (synchronizations,
acknowledgments, etc.).
• The destination will receive the packet when it arrives, but no pre-
notifications are sent by IP.
• If there is a need for connection-oriented traffic, then another protocol will
handle this (typically TCP at the transport layer).
Network Layer Characteristics
IP is Best Effort
Best Effort
• IP will not guarantee
delivery of the packet.
• IP has reduced overhead
since there is no mechanism
to resend data that is not
received.
• IP does not expect
acknowledgments.
• IP does not know if the other
device is operational or if it
received the packet.
Network Layer Characteristics
Media Independent
IP is unreliable:
– It cannot manage or fix
undelivered or corrupt packets.
– IP cannot retransmit after an
error.
– IP cannot realign out of sequence
packets.
– IP must rely on other protocols for
these functions.
IP is media Independent:
– IP does not concern itself with
the type of frame required at
the data link layer or the media
type at the physical layer.
– IP can be sent over any media
type: copper, fiber, or wireless.
5-1 INTRODUCTION
Note
Note
Solution
We replace each group of 8 bits with its equivalent decimal number
(see Appendix B) and add dots for separation:
a. 129.11.11.239
b. 193.131.27.255
c. 231.219.139.111
d. 249.155.251.15
Solution
We replace each decimal number with its binary equivalent:
a. 01101111 00111000 00101101 01001110
b. 11011101 00100010 00000111 01010010
c. 11110001 00001000 00111000 00001100
d. 01001011 00101101 00100010 01001110
Solution
a. There should be no leading zeroes (045).
b. We may not have more than 4 bytes in an IPv4 address.
c. Each byte should be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal notation.
Solution
We replace each group of 4 bits with its hexadecimal equivalent. Note
that 0X (or 0x) is added at the beginning or the subscript 16 at the
end.
a. 0X810B0BEF or 810B0BEF16
b. 0XC1831BFF or C1831BFF16
TCP/IP Protocol Suite 16
Example 5.5
Find the number of addresses in a range if the first address is
146.102.29.0 and the last address is 146.102.32.255.
Solution
We can subtract the first address from the last address in base 256 (see
Appendix B). The result is 0.0.3.255 in this base. To find the number
of addresses in the range (in decimal), we convert this number to base
10 and add 1 to the result..
1 1 1 1
Start
0 0 0 0
Solution
See the procedure in Figure 5.7.
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 bit is 1; the second bit is 0. This is a class B address.
d. The first 4 bits are 1s. This is a class E address.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 38
IPv4 Unicast, Broadcast, and Multicast
Unicast
• For example, the PC at 172.16.4.1 sends a unicast packet to the printer at 172.16.4.253.
IPv4 Unicast, Broadcast, and Multicast
Broadcast
• For example, the PC at 172.16.4.1 sends a broadcast packet to all IPv4 hosts.
IPv4 Unicast, Broadcast, and Multicast
Multicast
• For example, the PC at 172.16.4.1 sends a multicast packet to the multicast group address
224.10.10.5.
11.3 Types of IPv4 Addresses
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 42
Types of IPv4 Addresses
Public and Private IPv4 Addresses
• As defined in in RFC 1918, public IPv4 addresses are globally routed between internet service
provider (ISP) routers.
• Network Address Translation (NAT) translates private IPv4 addresses to public IPv4 addresses.
Loopback addresses
• 127.0.0.0 /8 (127.0.0.1 to 127.255.255.254)
• Commonly identified as only 127.0.0.1
• Used on a host to test if TCP/IP is operational.
Link-Local addresses
• 169.254.0.0 /16 (169.254.0.1 to 169.254.255.254)
• Commonly known as the Automatic Private IP Addressing (APIPA) addresses or self-assigned
addresses.
• Used by Windows DHCP clients to self-configure when no DHCP servers are available.
Types of IPv4 Addresses
Legacy Classful Addressing
RFC 790 (1981) allocated IPv4 addresses in
classes
• Class A (0.0.0.0/8 to 127.0.0.0/8)
• Class B (128.0.0.0 /16 – 191.255.0.0 /16)
• Class C (192.0.0.0 /24 – 223.255.255.0 /24)
• Class D (224.0.0.0 to 239.0.0.0)
• Class E (240.0.0.0 – 255.0.0.0)
• The Internet Assigned Numbers Authority (IANA) manages and allocates blocks of IPv4 and
IPv6 addresses to five Regional Internet Registries (RIRs).
Chapter 5
Subnetting/Supernetting
and
Classless Addressing
hierarchy
Three-level 2
hierarchy
telephone number
Equivalent to a Equivalent to a
Net ID Host ID
Equivalent to a
Subnet ID
e1
IP address: 130.45.34.56
Mask: 255.255.240.0 What is the subnet
address?
subnet mask
IP address: nnnnnnnn.nnnnnnnn.sshhhhhh.hhhhhhhh
Mask (binary): 11111111.11111111.11000000.00000000
Mask (dec): 255.255.192.0
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
Finding the subnetwork address
5-8
Straight Method
Convert IP address into binary form,
AND with the mask,
convert to dot-decimal form
Short-Cut Method:
If the byte in the mask is 255, copy the byte in the
address.
If the byte in the mask is 0, replace the byte in the
address with 0.
If the byte in the mask is neither 255 nor 0, write the
mask and the address in binary and apply the AND
operation (as above).
e2
IP = 19.30.80.5
M = 255.255.192.0 What is the subnet address?
8, 16 or 24 bits (class A, B or C)
Number of subnets =
23 = 8
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
5-11
Example 3
A company is granted the site address 201.70.64.0
The company needs six subnets. Design the subnets.
Solution:
Company can have 8 subnets (not six)
The given IP is class C, therefore we consider only
the last byte. Subnets:
.00000000 € 201.70.64.0
.00100000 € 2
3
.
4
6
0
7
1
.01000000 € 4
6
.
0
7
1
2
.01100000 € 201.70.64.96
. . . . . . . . . . . . . . .
.11000000 € 2
9
1
.
4
6
0
7
.11100000 € 4
2
.
6
0
7
1
Example 3 (cont.)
Solution:
Company can have 1024 = 210 subnets (not 1000)
The given IP is class B, therefore we consider only the
last two bytes. The company will have the subnets:
.00000000.00000000 € 181.56.0.0
.00000000.01000000 € 181.56.0.64
.00000000.10000000 € 181.56.0.128
. . . . . . . . . . . . . . . . . .
.11111111.11000000 € 2
9
1
.
5
6
8
Subnet mask = 255.255.255.192
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
5-14
Supernetting
Classes A and B are almost depleted.
Class C addresses are still available.
supernetwo
rk
Class C address:
Net ID
Host ID
m zero bits
Supernet address:
xxxxxxxx.xxxxxxxx.xxx00000.00000000
This byte is
divisible by 2m
Default mask: 255.255.255.0
Supernet mask: 255.255.(28-m-1)*2m.0 = 255.255.252.0
5-17
Supernetting (cont.)
Rules:
The number of blocks must be a power of 2
The blocks must be contiguous in the address
space (no gaps between the blocks).
The third byte of the first address in the
superblock must be evenly divisible by the
number of blocks.
In other words, the 3rd byte must have m zeroes to the left
(2m is number of blocks)
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
Exampl 5-18
e5
A company needs 1000 addresses. Which of the
following set of class C blocks can be used to form a
supernet for this company?
5 Need 4 blocks
198.47.32.0 198.47.33.0 198.47.34.0
Must be
consecutive
OK
198.47.32.0 198.47.33.0
©The McGraw-Hill Companies,
198.47.34.0 198.47.35.0
McGraw-Hill
Inc., 2000
5-20
NNo
ottee
In order to define the range of IP addresses we need the
following:
In subnetting:
The first address of the subnet + subnet mask
In supernetting:
The first address of the supernet + supernet mask
Range of IP addresses:
IP1,…,IP2 = SA+1,…,SA+h -1
Number of blocks:
b = 2m, m = ones(DM XOR SM) DM – Default mask
m = |ones(DM)-ones(SM)|
5-22
We 6
need to make a supernetwork out of 16 class C
blocks. What is the supernet mask?
Solution
We need 16 blocks. For 16 blocks we need to
change four 1s to 0s in the default mask. So the
mask is
11111111 11111111 11110000
00000000
or
7
A supernet has a first address of 205.16.32.0 and a supernet
mask of 255.255.248.0. A router receives three packets with
the following destination addresses:
205.16.37.44
205.16.42.56
205.17.33.76
Solution
The supernet has 21 1s. The default mask has 24 1s. Since
the difference is 3, there are 23 or 8 blocks in this supernet.
The blocks are 205.16.32.0 to 205.16.39.0. The first address
is 205.16.32.0. The last address is 205.16.39.255.
Classless Addressing
In classfull addressing only blocks of sizes nx256 (class C), 256x256
(Class B) or 256x256x256 (class A) can be given to an organization or
service provider. What if some organizations/households need
networks of size 2, 4, 16, 32, 64 or 128?
The beginning
The size of a address must
block must be be divisible
power of 2 by the block
©The McGraw-Hill Companies,
Inc., 2000
McGraw-Hill size
5-28
9
Which of the following can be the beginning address
of a block that contains 16 addresses?
205.16.37.32
190.16.42.44
17.17.33.80
123.45.24.52
Solution
The address 205.16.37.32 is eligible because 32 is
divisible by 16. The address 17.17.33.80 is eligible
because 80 is divisible by 16.
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
Example 5-30
10
Which of the following can be the beginning address
of a block that contains 1024 addresses?
205.16.37.32
190.16.42.0
17.17.32.0
123.45.24.52
Solution
To be divisible by 1024, the rightmost byte of an
address should be 0 and the second rightmost byte
must be divisible by 4. Only the address
17.17.32.0 meets this condition.
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
5-31
Slash notation
11
A small organization is given a block with the beginning
address and the prefix length 205.16.37.24/29 (in
slash notation). What is the range of the block?
Solution
The beginning address is 205.16.37.24. To find the last
address we keep the first 29 bits and change the last 3 bits to
1s.
Beginning:11001111 00010000 00100101 00011000
Ending : 11001111 00010000 00100101 00011111
There are only 8 addresses in this block.
12
We can find the range of addresses in Example 11 by
another method. We can argue that the length of the suffix is
32 - 29 or 3. So there are 23 = 8 addresses in this block. If
the first address is 205.16.37.24, the last address is
205.16.37.31 (24 + 7 = 31).
13
What is the network address if one of the addresses
is 167.199.170.82/27?
Solution
The prefix length is 27, which means that we must
keep the first 27 bits as is and change the remaining
bits (5) to 0s. The 5 bits affect only the last byte.
The last byte is 01010010. Changing the last 5 bits
to 0s, we get 01000000 or 64. The network address
is 167.199.170.64/27.
14
An organization is granted the block
130.34.12.64/26. The organization needs to have
four subnets. What are the subnet addresses
and the range of addresses for each subnet?
Solution
The suffix length is 6. This means the total number of
addresses in the block is 64 (26). If we create four
subnets, each subnet will have 16 addresses.
(Continued)
Let us first find the subnet prefix (subnet mask). We need four
subnets, which means we need to add two more 1s to the
site prefix. The subnet prefix is then /28.
14
15
An ISP is granted a block of addresses starting with
190.100.0.0/16. The ISP needs to distribute these addresses
to three groups of customers as follows:
Design the subblocks and give the slash notation for each
subblock. Find out how many addresses are still
available
©The after these allocations.
McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
Solutio 5-39
n
Group 1
For this group, each customer needs 256 addresses.
This means the suffix length is 8 (28 = 256). The
prefix length is then 32 - 8 = 24.
01: 190.100.0.0/24 € 190.100.0.255/24
02: 190.100.1.0/24 € 190.100.1.255/24
…………………………………..
64: 190.100.63.0/24 € 190.100.63.255/24
Total = 64 x 256 = 16,384
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
Solution 5-40
(Continued)
Group 2
For this group, each customer needs 128 addresses. This
means the suffix length is 7 (27 = 128). The prefix length is
then 32 - 7 = 25. The addresses are:
(Continued)
Group 3
For this group, each customer needs 64 addresses. This
means the suffix length is 6 (26 = 64). The prefix length is then
32 - 6 = 26.
001:190.100.128.0/26 €190.100.128.63/26
002:190.100.128.64/26 € 2
1
62
7
1
0
8
/9
.
…………………………
128:190.100.159.192/26 € 26
1
50
9
/.
Total = 128 x 64 =
8,192
©The McGraw-Hill Companies,
McGraw-Hill
Inc., 2000
5-42
Solution (Continued)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 91
IPv4 Issues
Need for IPv6
Both IPv4 and IPv6 will coexist in the near future and the transition will take several years.
The IETF has created various protocols and tools to help network administrators migrate their
networks to IPv6. These migration techniques can be divided into three categories:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 94
IPv6 Address Representation
IPv6 Addressing Formats
Note: This rule only applies to leading 0s, NOT to trailing 0s, otherwise the
address would be ambiguous.
Type Format
Preferred 2001 : 0db8 : 0000 : 1111 : 0000 : 0000 : 0000 : 0200
No leading zeros 2001 : db8 : 0 : 1111 : 0 : 0 : 0 : 200
IPv6 Address Representation
Rule 2 – Double Colon
A double colon (::) can replace any single, contiguous string of one or
more 16-bit hextets consisting of all zeros.
Example:
• 2001:db8:cafe:1:0:0:0:1 (leading 0s omitted) could be represented as
2001:db8:cafe:1::1
Note: The double colon (::) can only be used once within an address,
otherwise there would be more than one possible resulting address.
Type Format
Compressed 2001:db8:0:1111::200
12.3 IPv6 Address Types
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 102
IPv6 Address Types
Unicast, Multicast, Anycast
Note: Unlike IPv4, IPv6 does not have a broadcast address. However, there is
an IPv6 all-nodes multicast address that essentially gives the same result.
IPv6 Address Types
IPv6 Prefix Length
Prefix length is represented in slash notation and is used to indicate the network
portion of an IPv6 address.
The IPv6 prefix length can range from 0 to 128. The recommended IPv6 prefix length
for LANs and most other types of networks is /64.
Note: It is strongly recommended to use a 64-bit Interface ID for most networks. This is because stateless
address autoconfiguration (SLAAC) uses 64 bits for the Interface ID. It also makes subnetting easier to create
and manage.
IPv6 Address Types
Types of IPv6 Unicast Addresses
The IPv6 unique local addresses (range fc00::/7 to fdff::/7) have some similarity to
RFC 1918 private addresses for IPv4, but there are significant differences:
• Unique local addresses are used for local addressing within a site or between a limited
number of sites.
• Unique local addresses can be used for devices that will never need to access another
network.
• Unique local addresses are not globally routed or translated to a global IPv6 address.
Note: Many sites use the private nature of RFC 1918 addresses to attempt to secure or hide
their network from potential security risks. This was never the intended use of ULAs.
IPv6 Address Types
IPv6 GUA
IPv6 global unicast addresses (GUAs) are globally unique and routable on the IPv6 internet.
• Currently, only GUAs with the first three bits of 001 or 2000::/3 are being assigned.
• Currently available GUAs begins with a decimal 2 or a 3 (This is only 1/8th of the total available IPv6
address space).
IPv6 Address Types
IPv6 GUA Structure
Global Routing Prefix:
– The global routing prefix is the prefix, or network, portion of the address that is
assigned by the provider, such as an ISP, to a customer or site. The global routing
prefix will vary depending on ISP policies.
Subnet ID:
– The Subnet ID field is the area between the Global Routing Prefix and the Interface
ID. The Subnet ID is used by an organization to identify subnets within its site.
Interface ID:
– The IPv6 interface ID is equivalent to the host portion of an IPv4 address.
Note: IPv6 allows the all-0s and all-1s host addresses can be assigned to a device. The all-0s address is reserved as a
Subnet-Router anycast address, and should be assigned only to routers.
IPv6 Address Types
IPv6 LLA
An IPv6 link-local address (LLA) enables a device to communicate with other IPv6-enabled
devices on the same link and only on that link (subnet).
• Packets with a source or destination LLA cannot be routed.
• If an LLA is not configured manually on an interface, the device will automatically create one.
• The /10 indicates that the first 10 bits are 1111 1110 10xx xxxx