Chapter 4
Chapter 4
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.
32 bits
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.
Class D Host
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
Note: within address class A, 0 and 127 are reserved address (not usable). Usable addresses in
class A are 1 to 126.
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).
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
128 64 32 16 8 4 2 1
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).
255.255.255.224
Important Computation
Bits Borrowed 1 2 3 4 5 6 7 8
Cumulative value (mask) 128 192 224 240 248 252 254 255
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
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)
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
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:
Servers 14
Serial links 2
Router interconnection 6
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:
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
: : :
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:
Servers 16 16 – 2 = 14 255.255.255.240(28)
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.
14
VLSM example with IP addresses
15