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

Chapter 4

Uploaded by

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

Chapter 4

Uploaded by

Adugna Negero
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

CHAPTER 4

IP ADDRESSING & SUB-NETTING CONCEPTS

4.1. IP Addressing Concepts

IP address – is a logical address and is a combination of the Network address (N) and Host
address (H). It is used to create a unique address for each device on a network. IP address is
needed to deliver the packet to the correct network address. It is a 4-octet numbers separated by
dot (.). An IP address is a 32-bit sequence of 1s & 0s. All bits representing network address are
1s or 255. All bits representing host portion of the address are 0s. A 32 bits number is used to
represent the network and host portions of a particular IP address. Bits in the network portion
plus bits in the host portion is equal to 32 bits.

Network Portion in the IP address Host portion in the IP address

32 bits

 Each octet in the IP address is ranging from 0 to 255.


 The first address is 0.0.0.0 and the last address is 255.255.255.255.
Address types:
 Network address: The address by which we refer to the network (area code).
 Broadcast address: A special address used to send data to all hosts in the network.
 Host address: An address assigned to an end devices in the network.
Obtaining an IP address:
IP address can be assigned to computers either statically or dynamically. Static addressing is
manually done by a system administrator. Dynamic addressing is the process by which network
devices can obtain a unique IP address automatically. Static addressing is best for small and
frequently changing network environment, but it is difficult to assign to all computers in the
network when the number of devices increases. In this case dynamic addressing is preferable.
IP address classes:
In different address classes the number of octets representing the network and host portion varies
accordingly:
 Class A – First octet represents the network portion and the remaining octets represent the
host portion. Class A IP addressing is used for very large networks. There are 224 possible
combinations and 224-2 usable hosts in the host portion.

1
 Class B – First and second octets represent network and the remaining octets represents host
portion. Class B IP addressing is used for medium networking. There are 216 possible
combinations and 216-2 usable (possible) hosts in the host portion.
 Class C- First, second and third octets represent network portions and the remaining octet
represents the host portion. Class C IP addressing is used for small network environment.
There are 28 possible combinations and 28-2 possible hosts in the host portion.
 Class D – within class D IP addressing, there is no specific distinction between network and
host portions in the network. It is used for multicast groups (for Network technicians).
 Class E – used for research purposes (reserved).
o Why (-2) is for possible host combinations in the network?
Because the first and the last IP addresses are not assigned to the host (computers in the
network); the first IP address 0.0.0.0 is reserved for a default network and the last IP address
255.255.255.255 is used for broadcasts.

Network portion, Host portion and octets in class A, B, C, and D IP addressing

Class A Network Host

Octet 1st 2nd 3rd 4th

Class B Network Host

Octet 1st 2nd 3rd 4th

Class C Network Host

Octet 1st 2nd 3rd 4th

Class D Host

Octet 1st 2nd 3rd 4th

2
Determining address classes
To determine address class, one can use the first few higher order bits in the binary number of
the first octet (left to right).
Example:

IP address Higher order bits in the 1st 1st octet address Number of bits in
class octet range the network address

Class A 0 – 01111111 0 – 127 8

Class B 10000000 – 10111111 128 – 191 16

Class C 11000000 – 11011111 192 – 223 24

Class D 11100000 – 11101111 224 – 239 –

Class E 11110000 – 11111111 240 – 255 –

Note: within address class A, 0 and 127 are reserved address (not usable). Usable addresses in
class A are 1 to 126.

Subnet mask- Basic concept


Subnet mask – is used to separate Network and Host portions of an IP address. Subnet mask is a
32 bits number used to get the network address of a particular IP address in the network
environment. There are 232 possible combinations to assign subnet mask to the network portion
of the class address. All bits of the subnet mask corresponding to the network address are set to
1s (255) and those corresponding to host bits are set to 0s. The subnet mask indicates the number
of bits that have been borrowed from the host portion for the subnet portion. Prefix notation or
slash notation format indicates the number of binary 1s in a mask with a slash (/).
e.g. In 192.168.0.100/24 --- IP address = 192.168.0.100, subnet mask = 255.255.255.0

Address class Network/Host representation/model Subnet mask


Class A N H H H 255.0.0.0
Bit set ON OFF OFF OFF
Class B N N H H 255.255.0.0
Bit set ON ON OFF OFF

Class C N N N N 255.255.255.0
Bit set ON ON ON OFF
Note:
3
 N = Network portion H= Host portion
 ON = All bits corresponding to Network address are set to 1s
 OFF = All bits corresponding to Host address are set to 0s
 The subnet mask in address class A 255.0.0.0 represents
11111111.00000000.00000000.00000000 in binary number in which all bits corresponding
to network address are set to 1s.
Q. What is the subnet mask for an IP address 10.128.16.4?
Solution:
 This IP address is classified under class A, because the 1st octet is between 0 and 127.
 Class A Network and Host address portion is represented by NHHH model.
 The binary number for NHHH model is 11111111.00000000.00000000.00000000
 The subnet mask for the above binary representation is 255.0.0.0.
 Network address is 10.0.0.0.
 Host address is 255.128.16.4.
Reserved Address in the Network
Two addresses on any network can’t be used by hosts. These are
 Network address (doesn’t assigned to the host & it is the first Network address).
 Broadcast address (the last address in the network area, doesn’t assigned to the host).
Network address – used to identify the network itself. The host bits of a network address are all
set to 0s. The network bits are the bits of the network portion within a given address.

Example:
Consider the IP address 10.140.160.63
It is a class A address. Its default subnet mask is 255.0.0.0. The network portion of this class
address is the first octet (in the NHHH model). The network address of the given IP address is
10.0.0.0(by setting all host addresses to 0s).
Broadcast address – used for broadcasting packets to all the devices (hosts) in the network. The
network bits for broadcast address are the bits of the network portion in a given IP address. All
the host bits of a broadcast address are set to 1s (255).

Q: Determine the broadcast address for the IP address 10.140.160.63.


Solution:
 This IP address is class A IP address with NHHH model.
 The network portion of this IP address is the first octet (10).
 The broadcast address for a given IP address is 10.255.255.255(by setting all the host bits to
1s).
4
Note:
The subnet masks are used to tell which part of the IP address represents the network on which
the computer connected (network portion) & the computer’s unique identifiers on that
network(host portion).
If a computer has an IP address of 192.168.1.25 and the subnet mask of 255.255.255.0, then the
network portion (area code on which the computer connected) would be 192.168.1 and the host
would be device #25 on the network. In this case host #0 in the network address 192.168.1.0 is
reserved to represent the network itself and host #255 in the broadcast address 192.168.1.255 is
reserved for broadcasting. We can use an IP address from 192.168.1.1 to 192.168.1.254 to assign
to the hosts as a usable address. Generally, the valid IP address is the address between network
address and broadcast address.

4.2. Sub netting Concepts

Sub netting is the process of dividing a network into smaller networks called sub
networks/subnets using subnet masks other than the convention or standard class A, B, and C
subnet masks (/8, /16, and /24). To create subnets some host bits are reassigned or borrowed as
network bits. Always start borrowing with the left most host bits – the one closest to the last
network octet to expand the network.

Consider the IP address 192.168.10.0/27 borrowing 3 bits from the host bits to create subnets.
Write the subnet mask in the binary form:

255.255.255.0=11111111.11111111.11111111.000 00000

Remaining host bits

Bits to be borrowed as a network bits

128 64 32 16 8 4 2 1

3-bits borrowed =128 + 64 + 32 = 224 = 11100000 in binary

The default subnet mask/network mask/ for this IP address is 255.255.255.0. The new subnet
mask after the network expansion would be 255.255.255.224.

5
The new subnet mask was created by using a binary 1 in the network and subnet bits of 0 (zero)
in the host bits. The subnet mask for class C address after borrowing 3-host bits would be
255.255.255.224 or

Borrowed bits

11111111.11111111.11111111.111 00000

Slash 27 or /27 represents the total network bits and subnet bits (borrowed bits).

Total value of bits borrowed

255.255.255.224

8 + 8 + 8 + 3 = 27 (total bits in the network & subnet) =

24 bits in the Network + 3 bits in the sub net

Number of bits borrowed

Important Computation

Bits Borrowed 1 2 3 4 5 6 7 8
Cumulative value (mask) 128 192 224 240 248 252 254 255

Determining the number of IP address within a subnet mask


We can calculate the number of IP address in a subnet mask by subtracting the last octet of a
given subnet mask from 256 (28) possible combinations. If we have a subnet mask of
255.255.255.192/29 then the number of IP address with in this subnet would be 256 – 192 = 64.
This is also used as an increment to determine the next network address in the subnet.
Determining range of IP addresses
To determine range of IP addresses (boundary of the network – network address and broadcast
address) within each subnet, we have to know the packet IP address of the network. Packet IP
address is the IP address with slash format. e.g. 192.168.3.56/27
Steps:
1. Determine the subnet mask of a given IP address.
2. Subtract the last octet of the network portion in the subnet mask from 256 to get the number
of IP address in the subnet.
3. Divide the last octet of packet IP address by the number of IP address in the subnet (under
step 2) and don’t bother with the remainder.

6
4. Multiply this result by the number of IP address in the subnet to get the last octet in the
network address.
5. The last octet of the broadcast address is the sum of the last octet in the network address and
number of IP address in the subnet minus 1(one).
6. Usable or valid host IP addresses are the address between the network address and the
broadcast address.
Q. Determine the network boundaries and the valid host IP addresses in the subnet for the
packet IP address of 192.168.3.56/27.
Solution:
 This packet IP address is class C address with a default subnet mask of 255.255.255.0.
 /27 for this class address indicates 3-bits are borrowed, this means 8+8+8=24 for the first 3-
octets of Network portions.
 27-24=3 (number of bits borrowed), because 24+3=27.
 The total cumulative values for 3-bits borrowed are 224.
 The new subnet mask for a given packet IP address would be 255.255.255.224.
 Number of IP address in the subnet = 256 – 224 = 32. (step 2)
 56/32 = 1 (step 3)
 32 x 1 = 32 last octet in the network address to yield 192.168.3.32. (step 4)
 32 + 32 -1 = 63 the last octet in the broadcast address to yield 192.168.3.63. (step 5)
The Network boundaries (Network address & Broadcast address) for the packet address
192.168.3.56 would be:
Network address = 192.168.3.32
The first host IP address = 192.168.3.33
The last host IP address = 192.168.3.62
Broadcast address = 192.168.3.63
The increment number to determine the next network address in the next subnet is 32 (number of
network or 2the remaining host bits = 25).
Determining:
 Number of subnet networks (2borrowed bits) = 2b, b = borrowed bits.
 Number of hosts per subnet (2remaining host bits) = 2r, r = remaining bits.
 Number of usable hosts per subnet (2remaining host bits – 2).
Slash format /25 /26 /27 /28 /29 /30 /31 NA

Bits borrowed 1 2 3 4 5 6 7 8

7
Mask/value 128 192 224 240 248 252 254 255

Total sub networks 2 4 8 16 32 64 128 –

Total hosts per subnet 128 64 32 16 8 4 2 –

Usable hosts per subnet 126 62 30 14 6 2 – –

Given a packet IP address of 172.16.10.36/27, determine the followings:

 IP address: 172.16.10.36
 Address class: Class B
 Subnet mask: 255.255.255.224 (8+8+8+3 = 27 in which 8+3 bits are borrowed).
 Total bits borrowed: 11.
 Bits in the network portion: /27 = 8+8+8+3 = 27.
 Bits in the host portion: 8 - 3= 5.
 Number of subnets: 2borrowed bits = 211 = 2048.
 Number of hosts in each subnets: 2remaining host bits = 25 = 32.
 Subnet ID (Network address) for the first subnet: 172.16.10.32.
o 256 – 224 = 32 number of IP address
o 36 last octet in the IP address/32 number of IP address = 1(don’t bother about the
remainder).
o 1x32 = 32 last octet in the network address to yield 172.16.10.32.
 Broadcast address for the first sub network: 172.16.10.63
o Last octet in the broadcast address = No. of Network address + Last octet in the
network address – 1, i.e. 32+32 – 1= 63 to yield 172.16.10.63
 Valid host range in the first subnet: First valid= 172.16.10.33
Last valid= 172.16.10.62

(.33 to .62)

Some benefits of sub-netting are:


 Reduce network traffic and bandwidth utilization.
 Optimizing network performance.
 More efficient use and allocation of network address.
 Simplified administration and management.

8
Sub netting Practice
If an organization was given or purchased a packet IP address of 192.168.4.0/27 from internet
service provider (ISP) and requests you to design and expand a given packet IP address into 3
sub networks only in the organization. How can you design the subnet working for an
organization?
Procedures:
 Determine number of total subnets in the network (23 = 8) – borrowed bits.
 Determine the number of hosts per subnet increments (25=32) – remaining bits
 Determine the subnet ID, number of IP addresses, host range and broadcast address in each
sub network.
 Start your design in the following manner:
Subnet# subnet ID Host range Broadcast address within each subnet

0 192.168.4.0 .1 to .30 192.168.4.31

1 192.168.4.32 .33 to .62 192.168.4.63

2 192.168.4.64 .65 to .94 192.168.4.95

3 192.168.4.96 .97 to .126 192.168.4.127

If an organization continues to expand its network, what will be the last subnet ID, host range
and broadcast address?
Note that, since 3-bits are borrowed, there are 5-bits remaining for the hosts. Therefore, there
are 25(32) hosts per subnet. This number is used to identify the next subnet ID of the subnet or as
an increment in the subnet, where as 23 (8) bits represent the number of total or possible sub
networks.
Identifying unused extra IP addresses in the sub network

9
The network administrator configures the IP addressing using given IP packet for the serial link
between two routers as shown above in the figure. Each interface on the same router belongs to a
different network address; the facing interfaces on opposing routers need to share a network to
talk. How many IP numbers do we really need on the network interconnecting the two routers?
Because a point-to-point link will never have anything but two devices, we need only two IP
numbers, one for each serial interface (se0/1 and se0/2). Unfortunately, we have an eight-bit
subnet mask (255.255.255.0), so we are wasting 252 of the 254 usable and available numbers on
the subnet.
Sub-netting the IP address 172.16.10.0/24
The network mask is 255.255.0.0 where as the sub-network mask after borrowing 8 bits is
255.255.255.0.
Network address 172.16.10.0
The first host IP address in the sub network 172.16.10.1
The last host IP address in the sub network 254 (256-0=256-2=254 usable IP addresses)
Broadcast IP address for this sub network 255 (last usable IP +1=254+1=255)
Number of sub networks/increment=256-0=256 (if the number of increment is 256 then the
number of sub-network will be only one).
Number of hosts in the subnet 28=256
Usable host addresses=256-2=254
Among all these IP addresses the network administrator uses two of them only (172.16.10.1 and
172.16.10.2) and all the rest 252 host IP addresses were lost.
One best solution to solve such kind of IP addressing problem is using the concept of Variable
Length Subnet Masks (VLSM).
What is a variable length subnet mask?
As the name suggests, with variable length subnet masks (VLSMs) we can have different subnet
masks for different subnets of the same network. So, for the preceding example, we could have a
subnet mask of 255.255.255.252(30). In this case, we have only two usable host IP address (22 –
2), which is exactly what we need for our serial link between the two routers. (30) Or /30
indicates number of bits in the subnet mask.
The network address 172.16.10.0/24 now can be written in the form of 172.16.10.0/30 which
provides the VLSM of 255.255.255.252.
Using VLSM, instead of making our subnet mask longer, as in the previous example, we can
make our subnet mask shorter. This is also called super- netting.

10
VLSM design Example
For the network topology designed below, we have the following set of requirements for our
network addressing:

Segments Number of valid host IP address required

Servers 14

Ethernet users 158

Serial links 2

Router interconnection 6

VLSM design topology

Note that, we can easily determine the subnet mask required for each segment in our example by
looking the closest host number size which is greater than or equal to the number of hosts
needed in our design.
All maximum number of hosts in the subnet is given in base-2 format (2n where n is greater or
equal to 2).

11
We can determine the required valid number of IP address by subtracting 2 from the maximum
number of hosts in the subnet-those two addresses are not valid host address, one is network
address and the remaining one is broadcast address for that sub network.

Table to determine the subnet mask for the required number of hosts in the design:

Maximum number of hosts Bits in the subnet mask Subnet mask


in the subnet
(prefix-slash format)

4 /30 255.255.255.252

8 /29 255.255.255.248

16 /28 255.255.255.240

32 /27 255.255.255.224

64 /26 255.255.255.192

128 /25 255.255.255.128

256 /24 255.255.255.0

: : :

In our example servers need 14 valid IP addresses. In this case the number of host size closest
and greater/equal to 14 is 16 (refer in the table above) and the subnet mask for this sub-network
is 255.255.255.240(28).
We can list the required valid host address and subnet masks for segments in our design:

Segments Maximum IP address Valid IP address Subnet mask


required required

Serial Link 4 4–2=2 255.255.255.252(30)

Router 8 8–2 =6 255.255.255.248(29)


interconnection

Servers 16 16 – 2 = 14 255.255.255.240(28)

Ethernet users 160 160 – 2 = 158 255.255.255.0(24)

12
Assign valid IP ranges to each segment in the sub network using VLSM
Based on the above table now we can determine:
 Sub network address
 First valid IP address
 Last valid IP address
 Broadcast IP address
 Valid IP range needed for each segment sub network in the design
The network administrator must begin allocating addresses starting with the segment requiring
the greatest prefix length/slash format. This helps the network administrator to identify the
already used sub network IP addresses in the sub networks; otherwise he may repeatedly assign
the same sub network addresses to the segments which make the sub networks do not work
properly.
Given IP packet is: 172.16.10.0 (class B address for all sub networks)
Serial Link: Subnet mask = 255.255.255.252(30)
 Sub network address: 172.16.10.0
 First valid IP address: 172.16.10.1
 Last valid IP address: 172.16.10.2
 Broad cast IP address: 172.16.10.3
 Valid IP range : 172.16.10.1 – 172.16.10.2
Router interconnection: Subnet mask = 255.255.255.248(29)
The sub network address for this sub network is 172.16.10.0 which is already used for serial link.
Therefore we have to use the next sub network address for this subnet mask. The increment for
this subnet work is 8 (256-248 =8), hence the next sub network address will be 172.16.10.8. In
fact, there is another two host subnet at 4, (172.16.10.4 – 172.16.10.7) which we had to skip-
that can be used in the future.
 Sub network address: 172.16.10.8
 First valid IP address: 172.16.10.9
 Last valid IP address: 172.16.10.14
 Broad cast IP address: 172.16.10.15
 Valid IP range : 172.16.10.9 – 172.16.10.14
Servers: Subnet mask = 255.255.255.240(28)
Already used sub network addresses are 172.16.10.0, 172.16.10.8, the next sub network should
be determined for this sub network address. The increment for this sub network is 16 (256-240
=16), therefore the sub network address for this subnet should be 172.16.10.16 (16+16=32 – 2
13
=30 which is the last octet of valid IP address for this subnet), from this idea the broad cast
address is with the last octet 31
 Sub network address: 172.16.10.16
 First valid IP address: 172.16.10.17
 Last valid IP address: 172.16.10.30
 Broad cast IP address: 172.16.10.31
 Valid IP range : 172.16.10.17 – 172.16.10.30
Ethernet users: Subnet mask= 255.255.255.0(24)
For this subnet work, a network administrator needs maximum of 160 hosts IP addresses (158
usable host addresses).
The increment for this subnet work is 256 (256 – 0 = 256). To accommodate 160 maximum host
IP addresses, the network admin must starts from the network address with the last octet of zero
(0), i.e. 0/256 = 0, 0*256 (increment) = 0 which will be the last octet of network address
(172.16.10.0), but this network address has been used before in the first sub-network or serial
link.
The next network addresses are 172.16.10.8 and 172.16.10.16 which has been also occupied.
The next free sub-network address is 172.16.10.32 which can only accommodate 16 IP addresses
(.31 to .46), where as we need to accommodate 158 usable IP addresses.
To solve this problem, the network administrator uses the 3rd octet in the sub network which is
255 to determine the 3rd octet in the network address to differentiate from those pre-occupied
addresses.
To do this:
256 – 255 = 1, this is an increment to control over the 3rd octet only. Then the network address
will be 172.16.11.0
Since the increment in the 4th octet is 256 (256 – 0 = 256), the broadcast address will be 256 – 1
= 255 and valid IP addresses will be lays between the network and broadcast addresses.

 Sub network address: 172.16.11.0


 First valid IP address: 172.16.11.1
 Last valid IP address: 172.16.11.254
 Broad cast IP address: 172.16.11.255
 Valid IP range : 172.16.11.1 – 172.16.11.254
We can now take our VLSM address ranges and apply them to our network diagram as shown
below:

14
VLSM example with IP addresses

15

You might also like