0% found this document useful (0 votes)
29 views40 pages

Chapter 4 P2

The document provides an overview of the TCP/IP protocols, focusing on the IP protocol, its addressing schemes, and the differences between IPv4 and IPv6. It discusses classful and classless addressing, subnetting, and the importance of unique IP addresses for devices on the Internet. Additionally, it explains the structure of IP addresses, including network and host IDs, and the implications of address depletion in the context of Internet growth.

Uploaded by

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

Chapter 4 P2

The document provides an overview of the TCP/IP protocols, focusing on the IP protocol, its addressing schemes, and the differences between IPv4 and IPv6. It discusses classful and classless addressing, subnetting, and the importance of unique IP addresses for devices on the Internet. Additionally, it explains the structure of IP addresses, including network and host IDs, and the implications of address depletion in the context of Internet growth.

Uploaded by

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

The TCP/IP protocols

The IP protocol and IP addresses

 One of the most important protocols in the TCP/IP suite is the


IP protocol.

 This is used at the Internet layer of TCP/IP (i.e. the Network


layer in the OSI model) and is used to attach network addresses
to packets.

 The IP protocol provides best effort delivery between network


stations.
 IP routes packets on the network by using IP addresses.
1
Cont.
 IPv4 Addressing Scheme and Notations:
 Classful IP Addressing Vs. Classless IP addressing
 Network Address Translation (NAT)
 IPv6 Addressing Scheme and Notation:
 Addressing Mapping
 Mapping Logical to Physical Addressing:- ARP
 Mapping Physical to Logical Addressing:- RARP

 Internet Control Message Protocol (ICMP) Vs. Internet Group


Management Protocol (IGMP)
2
Cont.
 The Internet Protocol (IP) is a protocol used for communicating data across
a packet-switched internetwork using the Internet Protocol suite, also referred
to as TCP/IP.

 IP is the primary protocol in the Internet Layer of the Internet Protocol Suite
and has the task of delivering distinguished protocol datagrams (packets)
from the source host to the destination host solely based on their addresses.
For this purpose the Internet Protocol defines addressing methods and
structures for datagram encapsulation.

 The first major version of addressing structure, now referred to as Internet


Protocol Version 4 (IPv4) is still the dominant protocol of the Internet,
although the successor, Internet Protocol Version 6 (IPv6), is being deployed
actively worldwide (128 bits).
3
Contd.

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.

Usually, computers communicate through the Internet.


The packet transmitted by the sending computer may pass through
several LANs or WANs before reaching the destination computer.

For this level of communication, we need a global addressing scheme;


we use the term IP address to mean a logical address in the network

layer of the TCP/IP protocol suite.

4
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.

 IPv4 addresses are unique and universal.


 They are unique in the sense that each address defines one, and
only one, connection to the Internet.

 Two devices on the Internet can never have the same address at the
same time.
5
Address Space
A protocol such as IPv4 that defines addresses has an address space.
 An address space is the total number of addresses used by the protocol.

If a protocol uses N bits to define an address, the address space is 2 N

because each bit can have two different values (0 or 1) and N bits can have
N
2 values.

IPv4 uses 32-bit addresses, which means that the address space is 2 32
or
4,294,967,296 (more than 4 billion). This means that, theoretically, if there
were no restrictions, more than 4 billion devices could be connected to the
Internet.

We will see shortly that the actual number is much less because of the
restrictions imposed on the addresses.
6
Notations
There are two prevalent notations to show an 1Pv4 address: binary
notation and dotted-decimal notation.
Binary Notation
 In binary notation, the IPv4 address is displayed as 32 bits. Each octet
is often referred to as a byte. So it is common to hear an IPv4 address
referred to as a 32-bit address or a 4-byte address. The following is an
example of an IPv4 address in binary notation:
 01110101 10010101 00011101 00000010
Dotted-Decimal Notation
 To make the IPv4 address more compact and easier to read, Internet
addresses are usually written in decimal form with a decimal point (dot)
separating the bytes. The following is the dotted-decimal notation of the
above address:

117.149.29.2
7
Example: Dotted-decimal notation and
binary notation for an IPv4 address

8
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.

9
Example 2

Change the following IPv4 addresses from dotted-decimal


notation to binary notation.

Solution
We replace each decimal number with its binary equivalent.

10
Example 3

Find the error, if any invalid IP is set , in the following


IPv4 addresses.

Solution
a. There must be no leading zero (045).
b. They 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.
11
Classful Addressing
 IPv4 addressing, at its inception, used the concept of classes. This
architecture is called classful addressing.

 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.

12
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

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.
13
Network ID and Host ID
 In classful addressing, an IP address in class A, B, or C
is divided into network ID and host ID.
 These parts are of varying lengths, depending on
the class of the address.

 In class A, 1 byte defines the network ID & 3 bytes define the


host ID.

 In class B, 2 bytes define the network ID & 2 bytes define the


host ID.

 In class C, 3 bytes define the network ID & 1 byte defines the


host ID.

st nd rd th
1 octet 2 octet 3 octet 4 octet
Class A Network Host Host Host

Class B Network Network Host Host


Class C Network Network Network Host
14
Default Mask
Although the length of the network ID and host ID (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 0s. The masks for classes A, B, and C are shown below

The mask can help us to find the network ID and the host ID. For
example, the mask for a class A address has eight 1s, which means the
first 8 bits of any address in class A define the network ID; the next 24 bits
define the host ID.

15
Address Depletion

The flaws in classful addressing scheme combined with the fast growth of
the Internet led to the near depletion of the available addresses.

Yet the number of devices on the Internet is much less than the 2 32

address space.

We have run out of class A and B addresses, and a class C block is too
small for most midsize organizations.

One solution that has alleviated the problem is the idea of classless
addressing.
16
Subnetting
During the era of classful addressing, subnetting was introduced.
If an organization was granted a large block in class A or B, it could
divide the addresses into several contiguous groups and assign each group

to smaller networks (called subnets) or, in rare cases, share part of the
addresses with neighbors.

Subnetting increases the number of 1s in the mask.


Subnetting is the process of borrowing bits from the HOST bits, in
order to divide the larger network into small subnets.

Subnetting does NOT give you more hosts, but actually costs you hosts.
17
Contd.
Network Network Host Host

172 16 0 0

Network Network Subnet Host

You lose two host IP Addresses for each subnet, and perhaps one
for the subnet IP address and one for the subnet broadcast IP
address.
You lose the last subnet and all of it’s hosts’ IP addresses as the
broadcast for that subnet is the same as the broadcast for the
network.
In older networks, you would have lost the first subnet, as the
subnet IP address is the same as the network IP address. (This
subnet can be used in most networks.)
18
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.

Address Blocks

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.
19
Restriction
 To simplify the handling of addresses, the Internet authorities
impose three restrictions on classless address blocks:
1. The addresses in a block must be contiguous, one after another.

2. The number of addresses in a block must be a power of 2 (1, 2, 4, 8 .... ).

3. The first address must be evenly divisible by the number of addresses.

20
Contd.

 The above figure shows a block of addresses, in both binary


and dotted-decimal notation, granted to a small business that
needs 16 addresses.

 We can see that the restrictions are applied to this block. The
addresses are contiguous. The number of addresses is a power
4
of 2 (16 = 2 ), and the first address is divisible by 16. The first
address, when converted to a decimal number, is 3,440,387,360,
which when divided by 16 results in 215,024,210.

21
Classless addressing Mask

A better way to define a block of addresses is to select any address in the block and
the mask.

As we discussed before, 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 –
Classless Inter Domain Routing notation).

2 to calculate the number of subnet mask n no of 1s ne subnet mask


2 -2 to calculate the number of host b/c 2 bites are reserved n Represent number of zeros in subnet mask


The address and the /n notation completely define the whole block (the first address,
the last address, and the number of addresses).
22
Q1:Find the number subnet and valid host
 The given network 192.168.1.0 and subnet mask
255.255.255.240/28
I. What is the class of the given network?
II. Find the subnet Mask?
III. find valid host?
Answer
Change in two binary notion
11111111 11111111 11111111 11110000
I. Class C Network because the first binary is 111
II. to find subnet Mask 2 , 24 =16

III. to find valid host


IV. 2 -2,24-2 =16-2=14
Q2:Find the number subnet and valid host
 The given network 150.150.0.0 and subnet mask
255.255.255.252/30
I. What is the class of the given network?
II. Find the subnet Mask?
III. find valid host?
Answer
Change in two binary notion
11111111 11111111 11111111 11111100
IV. Class B Network
V. to find2 subnet Mask 2 , 2
14
VII.2 -2,2 -2 =4-2=2
=16384 VI. to find valid host
First Address
The first address in the block can be found by setting the 32 - n
rightmost bits in the binary notation of the address to 0s.
 Example 5
 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.
25
Last Address
 The last address in the block can be found by setting the
32 - n rightmost bits in the binary notation of the address
to 1s.
 Example 6
 Find the last address for the block in Example 5.
 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 26
Number of Addresses

 The number of addresses in the block is the difference between the


32-n
last and first address. It can easily be found using the formula 2 .
Example 7
 Find the number of addresses in Example 5.
 Solution

The value of n is 28, which means that number
32−28
of addresses is 2 or 16.

27
 Another way to find the first address, the last address,
and the number of addresses is to represent the mask as a
32-bit binary (or 8-digit hexadecimal) number. This is
particularly useful when we are writing a program to find
these pieces of information. In the above example the /28
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.
28
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; the
result is 0 otherwise.

29
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 1 to 0 and each 0 to
1.

30
c. The number of addresses can be found by
complementing the mask, interpreting it as a decimal
number, and adding 1 to it.
31
Examples
 There are three types of Subnetting examples

I. Subnetting when given a required number of


networks

II. Subnetting when given a required number of clients

III. Given an IP address & Subnet Mask, finding


original network range (reverse engineering a
subnet problem)

32
Subnetting when given a required number of networks
Example 1: A service provider has given you the Class C network
range 209.50.1.0. Your company must break the network into 20
separate subnets.
Step 1. Determine the number of subnets and convert to binary
 In this example, the binary representation of 20 = 00010100.
Step 2. Reserve required bits in subnet mask and find incremental value

 The binary value of 20 subnets tells us that we need at least 5 network bits to
satisfy this requirement (since you cannot get the number 20 with any less than 5
bits – 10100)
 Our original subnet mask is 255.255.255.0 (Class C subnet)
 The full binary representation of the subnet mask is as follows:
 255.255.255.0 = 11111111.11111111.11111111.00000000

33
Cont…
 We must “convert” 5 of the client bits (0) to network bits (1) in order
to satisfy the requirements:
 New Mask = 11111111.11111111.11111111.11111000
 If we convert the mask back to decimal, we now have the subnet
mask that will be used on all the new networks – 255.255.255.248

 Our increment bit is the last possible network bit, converted back to a
binary number:

 New Mask = 11111111.11111111.11111111.1111(1)000 – bit with


the parenthesis is your increment bit.
 If you convert this bit to a decimal number, it becomes the number
“8”
34
Cont…
Step 3) Use increment to find network ranges

 Start with your given network address and add your increment to the sub
netted octet: 209.50.1.0

209.50.1.8

209.50.1.16 …etc

 You can now fill in your end ranges, which is the last possible IP
address before you start the next range. 209.50.1.0 – 209.50.1.7

 209.50.1.8 – 209.50.1.15

 209.50.1.16 – 209.50.1.23 …etc

 You can then assign these ranges to your networks! Remember the first
and last address from each range (network / broadcast IP) are unusable.
35
36
?

You might also like