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

Lec 09 IPv4 Addressing Lec 10 IPv4 Subnetting

Uploaded by

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

Lec 09 IPv4 Addressing Lec 10 IPv4 Subnetting

Uploaded by

fatimah120193
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 94

BITS 1313

DATA COMMUNICATION
& NETWORKING
Lecture 9

IPv4 Addressing
Fundamental
CONTENTS

Introduction
Notations
Classful addressing
Classless addressing
INTRODUCTION
 IP Address?
 An address that identifies the connection of a host to
network.
 Devided into 2:
 Internet Protocol version 4 (IPv4)
 Up to 4.2 billion address.
 Internet Protocol version 6 (IPv6)
 Up to 340 trilion address.

 Where is IPv5?
 It held as experimental address forced to the development of
IPv6
INTRODUCTION
 The IPv4 addresses are unique and universal.
 The exact address space of IPv4 is
232 or 4,294,967,296.
 Consists of 4 bytes (32 bits)
NOTATIONS
Binary Notation

 The original format


 Why binary?
 …because computer operates in binary.
 Display as 32 bits
 …in 4 bytes as an Octet
Octet
 Each octet referred as a byte
Dotted Decimal Notation

 To make 32 bit form shorter and easier to


read
 Easier to determine the classes of IP’s
 Dot separating the octets
 Value range every octet are 0 to 255 or
00000000 to 11111111
Example

 Change the following IP addresses from binary


notation to dotted-decimal notation.
10000001 00001011 11101111 00001011
11111001 10011011 00001111 11111011
Example

 Change the following IP addresses from binary


notation to dotted-decimal notation.
10000001 00001011 00001011 11101111
11111001 10011011 11111011 00001111

 Solution
129.11.239.11
249.155.15.251
Example

 Change the following IP addresses from


dotted-decimal notation to binary notation.
111.45.56.78
75.34.45.78
Example

 Change the following IP addresses from


dotted-decimal notation to binary notation.
111.56.45.78
75.45.34.78

 Solution
01101111 00101101 00111000 01001110
01001011 00100010 00101101 01001110
CLASSFUL ADDRESSING

 IPv4 used the concept of classes called


classful Addressing
 divided into FIVE classes A,B,C,D and E
Address Classes
 5 different classes of address – A,B,C,D & E

 Example: 192.11.103.4
12.4.112.23
 How to remember?
Address Classes
 5 different classes of address – A,B,C,D & E
 Class A :: First bit is 1
 Class B :: 1st bit is 1 and 2nd bit is 0
 Class C :: 1st bit is 1, 2nd bit is 1 and 3rd bit is 0
 Class D :: 1st bit is 1, 2nd bit is 1, 3rd bit is 1 and 4th is 0
 Class E :: All first 4 bit are 1
Address Classes
 5 different classes of address – A,B,C,D & E
Example

 Find the class of each address:


 00000001 00001011 00001011 11101111
 11110011
1111 10011011 11111011 00001111
Example

 Find the class of each address:


 00000001 00001011 00001011 11101111
 11110011
1111 10011011 11111011 00001111

 Solution
The first bit is 0; this is a class A address.
The first 4 bits are 1s; this is a class E address.
Example

 Find the class of each address:


 10000001
10 00001011 00001011 11101111
 00001111 11110011
1111 10011011 11111011
Example

 Find the class of each address:


 10000001
10 00001011 00001011 11101111
 00001111 11110011
1111 10011011 11111011

 Solution
The first bit is 0; this is a class B address.
The first bit are 0; this is a class A address.
Example
 Find the class of each address:
 227.12.14.87
 252.5.15.111
 134.11.78.56
Example
 Find the class of each address:
 227.12.14.87
 252.5.15.111
 134.11.78.56

 Solution
 The first byte is 227 (between 224 and 239); the class is D.
 The first byte is 252 (between 240 and 255); the class is E.
 The first byte is 134 (between 128 and 191); the class is B.
Netid and Hostid

 IP address in class A, B and C are divided


into netid and hostid
Class A: 1 netid and 3 hostid
Class B: 2 netid and 2 hostid
Class C: 3 netid and 1 hostid
 BUT not on class D and E
Class type

netid hostid
4 bytes
Example

 192.168.2.1
Class C which is “192.168.2” is netid while “.1” is
hostid

 60.5.6.244
Class A which is “60” is netid while “.5.6.244” is
host id
Classes and Block
 Each class is divide into a fixed number of block
 Each block having a fixed size
 A large part of the available addresses were wasted

Number of blocks and block size in classful IPv4 addressing


Block in class A
Block in class B
Block in class C
Network Address
 In classful addressing, the network address is the one
that is assigned to the organization.
 A network address is different from a netid. A network
address has both netid and hostid, with 0s for the
hostid.
Example

 Given the address 23.56.7.91, find the network


address.
Example

 Given the address 23.56.7.91, find the network


address.

 The class is A. Only the first byte defines


the netid. We can find the network address
by replacing the hostid bytes (56.7.91) with
0s. Therefore, the network address is
23.0.0.0
Broadcast Address
 Broadcast address refers to the ability to address a
message that is broadcast to all stations or hosts on a
network.
 A broadcast address has both netid and hostid, with 1s
for all bits in the hostid
All 1s

123.255.255.255 141.14.255.255 221.45.71.255


Example

 Given the address 128.56.7.91, find the


network address
Example

 Given the address 128.56.7.91, find the


broadcast address

 The class is B. The first and second byte


defines the netid. We can find the broadcast
address by replacing the hostid bytes (7.91)
with 1s. Therefore, the broadcast address is
128.56.255.255
Masking
 In classful address, we can use mask (default
mask) to determine the address classes.
 32 bits contiguous 1s followed by contiguous 0s

Default masks for classful addressing


Example
 A router outside the organization receives a packet
with destination address 190.240.7.91. Show the
default subnet mask and network address for the
address.
Example
 A router outside the organization receives a packet
with destination address 190.240.7.91. Show the
default subnet mask and network address for the
address.

 The router looks at the first byte of the address


to find the class. It is class B.
 The default mask for class B is 255.255.0.0. The
router ANDs this mask with the address to get
190.240.0.0.
Exercise
 Draw a network topology using class C IPv4
address (you suggest it). Your network must
divided into 5 subnetwork and each subnetwork
must have at least 5 computers. Set the IP for:
 Network
 Each host
 Broadcast
Any Questions ??
Lecture 10

IPv4 Addressing
Subnetting
edited by

EH18
IP Addressing & Subnetting
IP Addressing (Re-call)
Subnetting
VLSM
CIDR
IP Addresses
An IP address is an address used to uniquely
identify a device on an IP network.
The address is made up of 32 binary bits which
can be divisible into a network portion and
host portion with the help of a subnet mask.
32 binary bits are broken into four octets (1 octet
= 8 bits)
Dotted decimal format (for example,
172.16.81.100)
IP Address Classes
IP Address Classes

 Class A: The 1st octet is the network id.


Octets 2, 3, and 4 are for subnets/hosts id
 Class B: The 1st two octets are the network
id. Octets 3 and 4 are for subnets/hosts id.
 Class C: The 1st three octets are the
network id. Octet 4 is for subnets/hosts id.
Private Address Range
Address Class Reserved Address Space
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
Private Address Range

 Imagine you get 202.15.6.6 Class C IP


(version 4) from ISP for your network, but on
the same time own more than 255
interconnected nodes, let say 360.
 It’s mean that you cannot uses Class C IP for
your network due the limitation of the IPv4
Class C.
 The solution, uses Private IP!
Private Address Range

 Let say you own 360 host.


 So you cannot use Class C due the limited
maximum host offered.
Private Address Range

 Use Private IP, for example Class Private IP


(192.168.0.0) and divide your 360 host to
subnets.
Private Address Range

 Let say 4 subnets for your 360 host.


Private Address Range

 Let say 4 subnets for your 360 host, and install


your IP’s.
202.15.6.6

Network Address: 192.168.0.0


Broadcast Address:192.168.255.255
Private Address Range

 Let say 4 subnets for your 360 host, and install


your IP’s.
202.15.6.6

Network Address: 192.168.0.0


Broadcast Address:192.168.255.255

NA:
68.0.
.60 NA: 1
2.168.0

192.
192.1

92.16
168.
.65 .71 .73 .87 .98
NA: 19
.5 .11 .23 .37 .58
NA:

8.0.1
0.18
20

192.168.0.___ 0 192.168.180.___
BA: BA:
NA: NA:

.125 .133 .138 .148 .168 .185 .193 .198 .240 .244

192.168.60.___ 192.168.120.___
BA: BA:
NA: NA:
Private Address Range

 So where will be the


NAT? Con
fi gur
e NA
T he
re!! 202.15.6.6
!

Network Address: 192.168.0.0


Broadcast Address:192.168.255.255

NA:
68.0.
.60 NA: 1
2.168.0

192.
192.1

92.16
168.
.65 .71 .73 .87 .98
NA: 19
.5 .11 .23 .37 .58
NA:

8.0.1
0.18
20

192.168.0.___ 0 192.168.180.___
BA: BA:
NA: NA:

.125 .133 .138 .148 .168 .185 .193 .198 .240 .244

192.168.60.___ 192.168.120.___
BA: BA:
NA: NA:
Default Subnet Masks
 Distinguishes which portion of the address
identifies the network and which portion
of the address identifies the node.
 Default masks:
 Class A: 255.0.0.0
 Class B: 255.255.0.0
 Class C: 255.255.255.0
Subnetting
Creates multiple logical networks that exist
within a single Class A, B, or C network.
If you do not subnet, you will only be able
to use one network from your Class A, B, or
C network, which is unrealistic
Each data link on a network must have a
unique network ID, with every node on that
link being a member of the same network
Benefits of Subnetting

1) Reduced network traffic


2) Optimized network performance
3) Simplified management
4) Facilitated spanning of large geographical
distances
IP Subnet-Zero

 This command allows you to use the first and


last subnet in your network design.
 For example, the Class C mask of 192
provides subnets 64 and 128, but with the IP
subnet-zero command, you now get to use
subnets 0, 64, 128, and 192
Lets start subnetting
How to create subnets
Determine the number of required network IDs:
One for each subnet
One for each wide area network connection
Determine the number of required host IDs per subnet:
One for each TCP/IP host
One for each router interface
Based on the above requirements, create the following:
One subnet mask for your entire network
A unique subnet ID for each physical segment
A range of host IDs for each subnet
Subnetting a Class A/B/C Address

 How many subnets does the chosen subnet


mask produce?
 How many valid hosts per subnet are
available?
 What are the valid subnets?
 What’s the broadcast address of each subnet?
 What are the valid hosts in each subnet?
Practice Example #1C: 255.255.255.128 (/25)
Network 192.168.10.0
How many subnets? Since 128 is 1 bit on (10000000),
the answer would be 21= 2.
How many hosts per subnet? We have 7 host bits off
(10000000), so the equation would be 27– 2 = 126
hosts.
What are the valid subnets? 256 – 128 = 128.
Remember, we’ll start at zero and count in our block
size, so our subnets are 0, 128.
What’s the broadcast address for each subnet? The
number right before the value of the next subnet is all
host bits turned on and equals the broadcast address.
For the zero subnet, the next subnet is 128, so the
broadcast of the 0 subnet is 127.
What are the valid hosts? These are the numbers
between the subnet and broadcast address
Logical Network Implementation

.2 .3 .130 .131

192.168.10.0 .1 .129 192.168.10.128


Practice Example #2C: 255.255.255.224 (/27)
Network 192.168.10.0
How many subnets? 224 is 11100000, so our
equation would be 23 = 8.
How many hosts? 25– 2 = 30.
What are the valid subnets? 256 – 224 = 32. We
just start at zero and count to the subnet mask
value in blocks (increments) of 32: 0, 32, 64, 96,
128, 160, 192, and 224.
What’s the broadcast address for each subnet
(always the number right before the next subnet)?
What are the valid hosts (the numbers between
the subnet number and the broadcast address)?
Practice Example #2C: 255.255.255.224 (/27)
Network 192.168.10.0
Subnet 0 32 …………. 192 224
Address
First Host 1 33 193 225
Last Host 30 62 222 254
Broadcast 31 63 223 255
Address
Practice Example #1B: 255.255.128.0 (/17)
Network 172.16.0.0

Subnets? 21 = 2
Hosts? 215– 2 = 32,766 (7 bits in the third
octet, and 8 in the fourth)
Valid subnets? 256 – 128 = 128. 0, 128.
Remember that subnetting is performed in the
third octet, so the subnet numbers are really
0.0 and 128.0, as shown in the next table
Broadcast address for each subnet?
Valid hosts?
Practice Example #1B: 255.255.128.0 (/17)
Network 172.16.0.0
Subnet 0.0 128.0
First Host 0.1 128.1
Last Host 127.254 255.254
Broadcast 127.255 255.255
Practice Example #2B: 255.255.240.0 (/20)
Network 172.16.0.0
 Subnets? 24= 16.
 Hosts? 212 – 2 = 4094.
 Valid subnets? 256 – 240 = 0, 16, 32, 48,
etc., up to 240.
 Broadcast address for each subnet?
 Valid hosts?
Practice Example #2B: 255.255.240.0 (/20)
Network 172.16.0.0
Subnet 0.0 16.0 ……….. 240.0

First Host 0.1 16.1 240.1

Last Host 15.254 31.254 255.254

Broadcast 15.255 31.255 255.255


Variable Length Subnet Mask(VLSM)
Subnet with requirements shown?
Variable Length Subnet Mask(VLSM)
Subnet with requirements shown?
5 subnets needed
Can be assigned as follows:
netA: 204.15.5.0/27 host address range 1 to 30
netB: 204.15.5.32/27 host address range 33 to 62
netC: 204.15.5.64/27 host address range 65 to 94
netD: 204.15.5.96/27 host address range 97 to 126
netE: 204.15.5.128/27 host address range 129 to 158
Variable Length Subnet Mask(VLSM)
Subnet with requirements shown?
Variable Length Subnet Mask(VLSM)
Subnet with requirements shown?
Given the same network and requirements as in Sample
Exercise 1 develop a subnetting scheme using VLSM, given:
◦ netA: must support 14 hosts
◦ netB: must support 28 hosts
◦ netC: must support 2 hosts
◦ netD: must support 7 hosts
◦ netE: must support 28 host
Determine what mask allows the required number of hosts.
◦ netA: requires a /28 (255.255.255.240) mask to support 14 hosts
◦ netB: requires a /27 (255.255.255.224) mask to support 28 hosts
◦ netC: requires a /30 (255.255.255.252) mask to support 2 hosts
◦ netD: requires a /28 (255.255.255.240) mask to support 7 hosts
◦ netE: requires a /27 (255.255.255.224) mask to support 28 hosts
Variable Length Subnet Mask(VLSM)
Subnet with requirements shown?
The easiest way to assign the subnets is to
assign the largest first. For example, you can
assign in this manner:
◦ netB: 204.15.5.0/27 host address range 1 to 30
◦ netE: 204.15.5.32/27 host address range 33 to 62
◦ netA: 204.15.5.64/28 host address range 65 to 78
◦ netD: 204.15.5.80/28 host address range 81 to 94
◦ netC: 204.15.5.96/30 host address range 97 to 98
Variable Length Subnet Mask(VLSM)
Subnet with requirements shown?
CIDR

 Classless Interdomain Routing


 Improve address space utilization
 Routing scalability in the Internet
 For example, if an ISP owns network
172.16.0.0/16, then the ISP can offer
172.16.1.0/24, 172.16.2.0/24,and so on to
customers. Yet, when advertising to other
providers, the ISP only needs to advertise
172.16.0.0/16
Chapter 6

IPv4 Addressing
Subnetting
Extra Notes
edited by

EH17
Subnetting

 Used in classful addressing.


 Introduced to divide a large block in class A
and B into several contiguous groups.
 Increase the number of 1s in the mask.
 Example:
Default class A mask is 255.0.0.0
Subnetmask class A can be 255.255.0.0 or
255.255.255.0
Supernetting

 Combination of several class C blocks to


create a larger range of addresses.
 Example:
An organization that need 1000 addresses can be
granted FOUR contiguous class C blocks.
No. of class C usable addresses is 254
So, 4 x 254 = 1016 and >1000
Supernetting (cont.)

 Decrease the number of 1s in the default mask


Default class C mask is 255.255.255.0 or
11111111.11111111.11111111.00000000 or /24
 To combine 4 addresses by decrease TWO of
1s
11111111.11111111.11111100.00000000 or
255.255.252.0 or /22
CLASSLESS ADDRESSING
 In classful addressing, a large part of the available
addresses were wasted
 Classful addressing, which is almost obsolete, is
replaced with classless addressing
 To overcome address depletion.
 No more classes but still granted in blocks.
Address Block

 No fix range as classful addresses


 Size of the block varies base on nature and
size of entity
Example: House may be given only two addresses
or a large organization may be hundreds.
 Restriction
Addresses in block must be contiguous
Address must be power of 2 (1,2,4,8 …)
Mask

 The address and the “/” notation completely


define the whole block.
First address, last address and number of addresses
 Use formula
256 ÷ a = b, a is no. of needed addresses
 b = 2n, n = bit to borrow
Example

 Network address for single LAN is


192.168.2.0, required 5 addresses for
subnetwork.
Nearest to 5 is 8, so a =8
 256 ÷ 8 = b, so b = 32, then
 b = 2n, n = bit to borrow
32 = 2n, n = 5
 Default class C mask is
255.255.255.0 or
111111111.11111111.11111111.00000000
 Mask after subnetting
Borrow n value, n=5,
111111111.11111111.11111111.11111000
255.255.255.248 or /29
 Range of address
192.168.2.0 to 192.168.2.7
 192.168.0 is network address
 192.168.2.7 is broadcast address
 Useable address is 192.168.2.1 to 192.168.2.6
6 addresses
or

 Range of address
192.168.2.8 to 192.168.2.15
 192.168.8 is network address
 192.168.2.15 is broadcast address
 Useable address is 192.168.2.7 to
192.168.2.14
6 addresses
Example

 Find the network and broadcast address for


host with an address 192.168.3.20/28
 /28 mean borrow 4 bits
 Mask
11111111.11111111.11111111.11110000
255.255.255.240
 Use ANDing proccess
192.168.3.20 AND 255.255.255.240
 Convert to binary

11000000101010000000001100010100
11111111111111111111111111110000
11000000101010000000001100010000

192.168.3.16 is network address


192.168.3.23 is broadcast address
Example:
i. 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 (network 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, rest is 1s we get
11111111 11111111 11111111 11110000
Using ANDing process
11001101 00010000 00100101 00100000
or
205.16.37.32
19.92
Cont.
ii. Find the last address (broadcast address) for the block

Solution
If we set 32 − 28 rightmost bits from 0 to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47

iii. The number of addresses.

Solution
Convert to decimal and adding with 1
1111 = 15 , then + 1
= 16 addresses
Any Questions ??

You might also like