Network Layer - Part 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 43

NETWORK LAYER

By
Abdul Ghofir, M.Kom
Ref: Forouzan, Data Communications and Networking
Logical Addressing

• Communication at the network layer is host-to-host (computer-to-


computer); a computer somewhere in the world needs to
communicate with another computer somewhere else in the
world.
• For this level of communication, we need a global addressing
scheme; we called this logical addressing.
• The Internet addresses are 32 bits in length; this gives us a
maximum of 232 addresses.
• These addresses are referred to as IPv4 (IP version 4) addresses or
simply IP addresses.
IP Addresses

• Assigned by the Internet Assigned Numbers Authority (IANA)


• Addressing system is divided into IPv4 and IPv6
• It consists of 32 bits for IPv4 and 128 bits for IPv6
• Using the binary and decimal number systems
International Institution for IP Management

• America :America Registry for Internet Number (ARIN)


• Europe : Reseaux IP Europeens (RIPE)
• Africa :African Regional Internet Registry Network Information Center
(AFRINIC)
• Asia Pacific :Asia Pacific Network Information Center (APNIC)
IP Address Category

1. Private IP
• IP Address with a special network address that is used for addressing in the local
network.
• To find out the Private IP is by typing “IPCONFIG” at the Command prompt
➢ Class A : 10.0.0.0 –10.255.255.255
➢ Class B :172.16.0.0 – 172.31.255.255
➢ Class C : 192.168.0.0 – 192.168.255.255
2. Public IP
• It’s an IP Address used on the internet, provided by the ISP
• The way to find out a public IP is by using a particular website.
For example: www.ipsaya.com
IP Address Implementation

1. Static IP
• It’s an IP address that is permanently owned by a computer system.
• It sets manually by Network Admin.
2. Dynamic IP
• An IP Address on a computer system that always changes according to the
use of the IP Address in the network at that time, which is set by the DHCP
(Dynamic Host Configuration Protocol) Server.
IP Address Implementation on Windows
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.
• The address space of IPv4 is:

232 or 4,294,967,296.
IPv4 Addresses

There are two prevalent notations to show an IPv4 address: binary


notation and dotted decimal notation.
• Binary notation:
01110101 10010101 00011101 00000010
• Dotted decimal notation
117.149.29.2
IPv4 Addresses
Example 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 and add dots for separation.
a. X . Y . Z .T
b. X . Y . Z . T
19.12
Example 2:

Change the following IPv4 addresses from dotted-decimal


notation to binary notation.

Solution
We replace each decimal number with its binary
equivalent

19.13
Example 3:

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

19.14
SUBNETTING
Subnet Mask

• Subnet mask is a special technique to divide a computer network


become subnetworks with smaller sizes.
• This activity is called subnetting and it can only be done on IP
addresses consisting of classes A, B and C only.
Binary Conversion to Decimal

11000000 . 10101000 . 00001010 . 00000001

10 1
0 0
1 0 0
1 0 01 0
N = 0 – 7 (8 Bit) 27 26 25 24 23 22 21 20
Result 128 64 32 16 8 4 2 1

Sum
Conversion for Decimal to Binary

5 digit

8 digit 8 digit 7 digit

128 64 32 16 8 4 2 1
192 1 1 0 0 0 0 0 0
168 1 0 1 0 1 0 0 0
100 0 1 1 0 0 1 0 0
20 0 0 0 1 0 1 0 0
Classful Addressing
and
Classless Addressing

19.19
Classful Addressing

• IPv4 addressing, at its inception, used the concept of classes.


• In classful addressing, the address space is divided into five
classes: A, B, C, D, and E. Each class occupies some part of the
address space.
Finding the classes in binary and dotted-decimal notation
Example 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.22
Classful Addressing
Classes and Blocks

• One problem with classful addressing is that each class is divided


into a fixed number of blocks with each block having a fixed size
as shown in Table:
Classful Addressing
Classes and Blocks

In classful addressing, a large part of the


available addresses were wasted.
Classful Addressing
Netid and Hostid

• In classful addressing, an IP address in class A, B, or C is divided


into netid and hostid.
• In class A, one byte defines the netid and three bytes define the
hostid.
• In class B, two bytes define the netid and two bytes define the
hostid.
• class C, three bytes define the netid and one byte defines the
hostid.
Classful Addressing
Mask

• Although the length of the netid and hostid (in bits) is


predetermined in classful addressing, we can also use a mask (also
called the default mask), a 32-bit number made of contiguous 1s
followed by contiguous as.
Default masks for classful addressing
Classful Addressing

Classful addressing, which is almost


obsolete, is replaced with classless
addressing.
Classless Addressing

• To overcome address depletion and give more organizations access


to the Internet, classless addressing was designed and
implemented.
• In this scheme, there are no classes, but the addresses are still
granted in blocks.
Classless Addressing
Address block

• In classless addressing, when an entity, small or large, needs to be


connected to the Internet, it is granted a block (range) of
addresses.
• The size of the block (the number of addresses) varies based on
the nature and size of the entity.
• For example, a household may be given only two addresses; a
large organization may be given thousands of addresses.
• An ISP, as the Internet service provider, may be given thousands or
hundreds of thousands based on the number of customers it may
serve.
A block of 16 addresses granted to a small organization
Classless Addressing

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.
Classless Addressing

The first address in the block can be


found by setting the rightmost
32 − n bits to 0s.
Example 1

A block of addresses is granted to a small organization. We


know that one of the addresses is 205.16.37.39/28.
a. What is the first address in the block?
b. What is the last address in the block?
c. Find the number of addresses in the block!
Solution

The binary representation of the given address is:


11001101 00010000 00100101 00100111

a. If we set 32−28 rightmost bits to 0, we get:


11001101 00010000 00100101 00100000

or
205.16.37.32
Classless Addressing

The last address in the block can be


found by setting the rightmost
32 − n bits to 1s.
Solution

b. If we set 32 − 28 rightmost bits to 1, we get:


11001101 00010000 00100101 00101111
or
205.16.37.47
Classless Addressing

The number of addresses in the block


can be found by using the formula
232−n.
Solution

c. The value of n is 28, which means that number


of addresses is 2 32−28 or 16.
A network configuration for the block 205.16.37.32/28
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.
Task

1. In a block of addresses, we know the IP address of one


host is 25.34.12.56/16. What are:
a. The first address (network address)
b. The last address (limited broadcast address) in this
block?
c. The number of address above!
Task

2. In a block of addresses, we know the IP address of one


host is 182.44.82.16/26. What are:
a. The first address (network address)
b. The last address in this block?
c. The number of address!

You might also like