0% found this document useful (0 votes)
30 views60 pages

Ipv4 Addressing

Uploaded by

hell1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views60 pages

Ipv4 Addressing

Uploaded by

hell1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 60

The Network Layer

Chapter 5
Network Layer Design Issues

• Store-and-forward packet switching


• Services provided to transport layer
• Implementation of connectionless service
• Implementation of connection-oriented service
• Comparison of virtual-circuit and datagram networks
IP Addresses:
Classful Addressing
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)
What is an IP Address?

• An IP address is a unique global address for a


network interface

• An IP address:
- is a 32 bit long identifier
- encodes a network number
(network prefix)
and a host number
Network prefix and Host number
• The network prefix identifies a network and the host
number identifies a specific host (actually, interface
on the network).
network prefix host number
• How do we know how long the network prefix is?
– The network prefix used to be implicitly defined (class-
based addressing, A,B,C,D…)
– The network prefix now is flexible and is indicated by a
prefix/netmask (classless).
Note

The address space of IPv4 is


232 or 4,294,967,296.
Figure 19.1 Dotted-decimal notation and binary notation for an IPv4 address
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.
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).
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.
Note

In classful addressing, the address


space is divided into five classes:
A, B, C, D, and E.
The old way: Classful IP Adresses
 When Internet addresses were standardized (early
1980s), the Internet address space was divided up
into classes:
 Class A: Network prefix is 8 bits long
 Class B: Network prefix is 16 bits long
 Class C: Network prefix is 24 bits long
 Each IP address contained a key which identifies
the class:
 Class A: IP address starts with “0”
 Class B: IP address starts with “10”
 Class C: IP address starts with “110”
19.13
The old way: Internet Address
Classes

19.14
The old way: Internet Address
Classes

 We will learn about multicast addresses later in this course.

19.15
Problems with Classful IP Addresses
 The original classful address scheme had a number of
problems

Problem 1. Too few network addresses for large networks


 Class A and Class B addresses are gone

Problem 2. Two-layer hierarchy is not appropriate for large


networks with Class A and Class B addresses.
 Fix #1: Subnetting

19.16
Problems with Classful IP
Addresses
Problem 3. Inflexible. Assume a company requires 2,000 addresses
 Class A and B addresses are overkill

 Class C address is insufficient (requires 8 Class C

addresses)

 Fix #2: Classless Interdomain Routing (CIDR)

19.17
Problems with Classful IP
Addresses

Problem 4. The Internet is going to outgrow the 32-bit


addresses

 Fix #3: IP Version 6

19.18
Finding the classes in binary and dotted-decimal notation
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.
Note

In classful addressing, a large part of


the available addresses were wasted.
Blocks in class A
Blocks in class B
Blocks in class C
Network Addresses

The network address is the first address.

The network address defines the network to the


rest of the Internet.
Given the network address, we can find the
class of the address, the block, and the range of
the addresses in the block
Example 9

Given the network address 17.0.0.0, find the


class, the block, and the range of the
addresses.

Solution
The class is A because the first byte is between
0 and 127. The block has a netid of 17.
The addresses range from 17.0.0.0 to
17.255.255.255.
Example 10

Given the network address 132.21.0.0, find


the class, the block, and the range of the
addresses.

Solution
The class is B because the first byte is between
128 and 191. The block has a netid of
132.21. The addresses range from
132.21.0.0 to 132.21.255.255.
Example 11

Given the network address 220.34.76.0, find


the class, the block, and the range of the
addresses.

Solution

The class is C because the first byte is between 192 and


223. The block has a netid of 220.34.76.The addresses
range from 220.34.76.0 to 220.34.76.255.
Mask
•A mask is a 32-bit number in which the n
leftmost bits are 1s and the 32 - n rightmost bits
are 0s.
•However, in classless addressing the mask for
a block can take any value from 0 to 32. It is
very convenient to give just the value of n
preceded by a slash (CIDR notation).
Masking concept
AND operation
•The network address is the
beginning address of each block.

•It can be found by applying


the default mask to
any of the addresses in the block.

• It retains the netid of the block


and sets the hostid to zero.
Number of blocks and block size in classful IPv4 addressing
Example 12

Given the address 23.56.7.91, find the


beginning address (network address).

Solution
The default mask is 255.0.0.0, which means
that only the first byte is preserved and the
other 3 bytes are set to 0s. The network
address is 23.0.0.0.
Example 13

Given the address 132.6.17.85 and, find the


beginning address (network address).

Solution
The default mask is 255.255.0.0, which
Means that the first 2 bytes are preserved
and the other 2 bytes are set to 0s. The
network address is 132.6.0.0.
Example 14

Given the address 201.180.56.5, find the


beginning address (network address).

Solution
The default mask is 255.255.255.0,
which means that the first 3 bytes are
preserved and the last byte is set to 0.
The network address is 201.180.56.0.
We must not
apply the default mask
of one class to
an address belonging
to another class.
Loop back address
• IP address with first byte as 127[127.X.Y.Z]
• Used to test the s/w on a machine [ Here the
packet simply returns to the protocol s/w on
the same machine]
• Eg. Ping appln to test if the process is able to
receive and process a packet.
• Eg. Client process sending msg to server
process on the same machine.
Special Addresses
Special Address Netid Hostid Source or
Destination
Network address Specific All 0s None
Direct broadcast address Specific All 1s Destination

Limited broadcast All 1s All 1s Destination


address
The host on this network All 0s All 0s Source

Specific host on this All 0s Specific Destination


network
Loopback address 127 Any Destination
SUBNETTING
Subnet Addresses
• An organization can subdivide it’s host address space
into groups called subnets.

• The subnet ID is generally used to group hosts based


on the physical network topology.

10 NetID SubnetID HostID


Default mask and subnet mask
Comparison of a default mask and
a subnet mask
Finding the Subnet Address
Given an IP address, we can find the
subnet address the same way we found the
network address. We apply the mask to the
address. We can do this in two ways:
straight or short-cut.
Straight Method
In the straight method, we use binary
notation for both the address and the
mask and then apply the AND operation
to find the subnet address.
Example 15

What is the subnetwork address if the


destination address is 200.45.34.56 and the
subnet mask is 255.255.240.0?
Solution

11001000 00101101 00100010 00111000


11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.


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,
we write the mask and the address in binary
and apply the AND operation.
What is the subnetwork address if the
destination address is 19.30.84.5 and the
mask is 255.255.192.0?
The number of subnets must be
a power of 2.
A company is granted the site address
201.70.64.0 (class C). The company needs
six subnets. Design the subnets.

Solution
The number of 1s in the default
mask is 24 (class C).
Solution (Continued)

The company needs six subnets. This number


6 is not a power of 2. The next number that is
a power of 2 is 8 (23). We need 3 more 1s in
the subnet mask.
The total number of 1s in the subnet mask is
27 (24  3).
The total number of 0s is 5 (32  27).
Solution (Continued)
The mask is

11111111 11111111 11111111 11100000


or
255.255.255.224

The number of subnets is 8.


The number of addresses in each subnet
is 25 (5 is the number of 0s) or 32.
A company is granted the site address
181.56.0.0 (class B). The company needs
1000 subnets. Design the subnets.

Solution
The number of 1s in the default mask is 16
(class B).
Solution (Continued)

The company needs 1000 subnets. This


number is not a power of 2. The next number
that is a power of 2 is 1024 (210). We need 10
more 1s in the subnet mask.
The total number of 1s in the subnet mask is
26 (16  10).
The total number of 0s is 6 (32  26).
Solution (Continued)

The mask is
11111111 11111111 11111111 11000000
or
255.255.255.192.
The number of subnets is 1024.
The number of addresses in each subnet is 26
(6 is the number of 0s) or 64.
A network with three levels of
hierarchy (subnetted)
Note:

The idea of subnetting and


supernetting of classful addresses is
almost obsolete.

TCP/IP Protocol Suite 60

You might also like