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

IP Addressing

This document provides an overview of IP addressing, focusing on IPv4, its structure, and how to configure local area networks. It explains the binary and decimal representation of IP addresses, subnet masks, and the process of incrementing and decrementing IP addresses. Additionally, it covers the significance of subnet masks and network addresses in identifying and managing network devices.

Uploaded by

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

IP Addressing

This document provides an overview of IP addressing, focusing on IPv4, its structure, and how to configure local area networks. It explains the binary and decimal representation of IP addresses, subnet masks, and the process of incrementing and decrementing IP addresses. Additionally, it covers the significance of subnet masks and network addresses in identifying and managing network devices.

Uploaded by

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

6.

IP Addressing
Learning Outcomes:
At the end of this module, the students will be able to:

• Recognize the building blocks of IP address version 4.


• Apply IP addressing in configuring local area network.

6.1 IP Addressing
An IP address is a unique identifier that is used to identify a host in a network. In network configuration,
it is a logical addressing scheme. It is a component of the Internet Protocol (IP), a protocol used in the
addressing scheme of a packet-switched network.

192.168.1.1 192.168.1.2

192.168.1.3 192.168.1.4

Figure 24. Basic wired network showing host IP address assignment.

- 44 -
192.168.1.5

192.168.1.6

192.168.1.10

1192.168.1.7

192.168.1.9
192.168.1.8

Figure 25. Basic wireless network showing host IP address assignment.

As shown in Figures 24 and 25, network devices are linked together using a switch or a wireless
access point where each host can send and receive data. These configurations are entirely wired
and wireless, respectively. However, Figure 26 illustrates that you can set up a hybrid network that
combines wired and wireless connections.

Figure 26. Combination of wired and wireless network

- 45 -
6.2. IPv4
IPv4 is a 32-bit version of IP address. Figure 27 shows an IP address in binary format segmented into
four, with each segment composed of 8 bits, and its decimal equivalent.

8 bits 8 bits 8 bits 8 bits

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1
32 bits
192 168 20 5
Figure 27. Binary IP address with its decimal number equivalent

6.3. Dotted Decimal Notation


Since an IP address is a 32-bit number, writing it in binary can be time-consuming. So, it is usually
represented in decimals, which are made up of four numbers. Each number has an octet value
between 0 and 255 and is separated by dots (dotted-decimal notation). Table 6 presents the minimum
and maximum values, as well as value range of an 8-bit binary number.

Binary (8 bits) Decimal


Minimum value 00000000 0
Maximum value 11111111 255
In-between 00000001-11111110 1 - 254

Table 6. Minimum, maximum, and in-between values of an 8-bit number

Below is an example of an IP address and subnet mask in binary format, as well as their dotted-
decimal equivalent.

IP address in binary : 10000000 00000011 11111110 00000001


Subnet mask : 11111111 11111111 00000000 00000000
IP dotted-decimal equivalent : 128.3.254.1
Subnet mask dotted-decimal equivalent : 255.255.0.0

- 46 -
6.4. Converting an 8-bit binary number to decimal
6.4.1. Using Powers of Two
One method for converting a binary number to its decimal equivalent is to generate a table with the
power of two (2n) values. Those values with corresponding binary 1s will be added together, while
those with corresponding binary 0s will be ignored.
Example 1:

Power of 2 128 64 32 16 8 4 2 1
Binary 0 0 0 0 0 1 0 1

=4+1
= 5 → Decimal equivalent
Example 2:

Power of 2 128 64 32 16 8 4 2 1
Binary 0 0 0 0 1 0 1 1

=8+2+1
= 11 → Decimal equivalent

Example 3:

Power of 2 128 64 32 16 8 4 2 1
Binary 1 0 0 0 0 1 1 0

= 128 + 4 + 2
= 134 → Decimal equivalent

- 47 -
6.4.2. Consecutive 1-bit values starting from the leftmost bit.
When there are consecutive 1-bit values starting from the leftmost bit of the binary number going to
the right, we can memorize their equivalent decimal value in the table below:

Power of 2 128 64 32 16 8 4 2 1 Decimal


1 0 0 0 0 0 0 0 128
1 1 0 0 0 0 0 0 192
1 1 1 0 0 0 0 0 224
Binary 1 1 1 1 0 0 0 0 240
values 1 1 1 1 1 0 0 0 248
1 1 1 1 1 1 0 0 252
1 1 1 1 1 1 1 0 254
1 1 1 1 1 1 1 1 255

Decimal number sequence: 128, 192, 224, 240, 248, 252, 254, 255

- 48 -
Worksheet 6-1. Binary to Decimal Conversion

Find the decimal equivalent of the binary numbers below:


1. 00000001
2. 00000010
3. 00000011
4. 10000001
5. 11110100

- 49 -
6.5. Incrementing/decrementing IPv4-based Address
In a binary number, the leftmost bit is known as the MSB (most significant bit), while the rightmost bit
is known as the LSB (least significant bit). To increase or decrease this number, we should begin with
the rightmost digit (LSB) and work our way to the left (MSB) until all bits are set to 1.

6.5.1. Incrementing an 8-bit binary number and getting its decimal equivalent

Binary number: 00000000


Binary (8 bits) Decimal
00000000 0
1. Add 1 to the LSB.

00000001 1
2. Increment by 1.

00000010 2
3. Increment by 1.

00000011 3

4. Continuously increment the number by 1 to reach the maximum value for 8 bits, that is,
11111111 or 255.

… …
00000100 4
00000101 5
00000110 6
00000111 7
00001000 8
00001001 9
00001010 10
00001011 11
00001100 12
00001101 13
00001110 14
00001111 15
00010000 16
00010001 17
… …
11111100 252
11111101 253
11111110 254
11111111 255

6.5.2. Incrementing an IPv4 IP address and getting its decimal equivalent

Applying the incrementation process discussed above, we can increment the 32-bit binary address
below and get its dotted-decimal counterpart:
00000000 00000000 00000000 00000000

- 50 -
STEP 1
Start from 00000000 00000000 00000000 00000000.
Increment (+1)
Binary Dotted decimal
00000000 00000000 00000000 00000000 0.0.0.0
00000000 00000000 00000000 00000001 0.0.0.1
00000000 00000000 00000000 00000010 0.0.0.2
00000000 00000000 00000000 00000011 0.0.0.3
00000000 00000000 00000000 00000100 0.0.0.4
… ….
00000000 00000000 00000000 11111110 0.0.0.254
00000000 00000000 00000000 11111111 0.0.0.255

STEP 2
Starting from the value highlighted above, that is, 0.0.0.255, increment by 1.

Increment (+1)
Binary Dotted decimal
00000000 00000000 00000000 11111111 0.0.0.255
00000000 00000000 00000001 00000000 0.0.1.0
00000000 00000000 00000001 00000001 0.0.1.1
00000000 00000000 00000001 00000010 0.0.1.2
00000000 00000000 00000001 00000011 0.0.1.3
00000000 00000000 00000001 00000100 0.0.0.4
… …
00000000 00000000 00000001 11111110 0.0.1.254
00000000 00000000 00000001 11111111 0.0.1.255

When incrementing IP address, once the maximum value is reached for each octet, e.g, 255 or
11111111, that octet will become 0 (eight 0s in binary) and will increment to the next significant bit
(left). So, getting the last value highlighted above, that is, 00000000 00000000 00000001 11111111,
we will have the succeeding values:
Increment (+1)
Binary Dotted-decimal
00000000 00000000 00000010 00000000 0.0.2.0
00000000 00000000 00000010 00000001 0.0.2.1
00000000 00000000 00000010 00000010 0.0.2.2
00000000 00000000 00000010 00000011 0.0.2.3
00000000 00000000 00000010 00000100 0.0.2.4
… …
00000000 00000000 00000010 11111111 0.0.2.255

STEP 3
Continuously increase the number by 1 from the highlighted value below.
Increment (+1)
Binary Dotted-decimal

- 51 -
00000000 00000000 00000010 11111111 0.0.2.255
00000000 00000000 00000011 00000000 0.0.3.0
00000000 00000000 00000011 00000001 0.0.3.1
00000000 00000000 00000011 00000010 0.0.3.2
00000000 00000000 00000011 00000011 0.0.3.3
00000000 00000000 00000011 00000100 0.0.3.4
00000000 00000000 00000011 00000101 0.0.3.5
00000000 00000000 00000011 00000110 0.0.3.6
00000000 00000000 00000011 00000111 0.0.3.7
… …
11111111 11111111 11111111 11111111 11111111 255.255.255.255

As shown in the last value highlighted above, continuously counting the IP address yielded a
maximum value of:
11111111. 11111111. 11111111. 11111111 or 255.255.255.255.

- 52 -
Worksheet 6-2. Incrementing Binary Number

1. Increment the binary number 00000100 ten times and write the decimal equivalent in the blank
provided below.
Incrementation (+1)
Binary Decimal
00000100 4
1
2
3
4
5
6
7
8
9
10

2. Increment the binary number 00000000 00000000 11111111 11111101 and get its dotted-
decimal equivalent.

Incrementation (+1)
Binary Dotted-decimal
00000000 00000000 11111111 11111101 0.0.255.253
00000000 00000000 11111111 11111110 0.0.255.254
00000000 00000000 11111111 11111111 0.0.255.255

Continue counting this binary and its decimal


equivalent. Write the answers on the blank
provided below.
______________________________________ _________
______________________________________ _________
______________________________________ _________
______________________________________ _________
______________________________________ _________
______________________________________ _________
______________________________________ _________

3. Given the 32-bit address below:


11000000 00000000 11111111 11111111
What is the address preceding it? (decrement by 1)
Binary: ___________________________________
Dotted decimal equivalent: _______________
What is the address after it? (increment by 1)

- 53 -
Binary: ___________________________________
Dotted decimal equivalent: _______________

What is the minimum value of this address?


Binary: ___________________________________
Dotted decimal equivalent: _______________

What is the maximum value of this address?


Binary: ___________________________________
Dotted decimal equivalent: _______________

- 54 -
6.6. Subnet Mask
A subnet mask is a 32-bit binary number that is used to extract the network address, range of IP
addresses, and broadcast address from given network information. The subnet mask can be used to
get the network and host portions of an IP address. A subnet mask consists of all 1s for network bits
and all 0s for host bits. In the subsequent topics, you will observe that subnet masks are an essential
component in IP addressing. The following are the default subnet masks used in a classful network:

1. 255.0.0.0 (11111111.00000000. 00000000.00000000)


2. 255.255.0.0 (11111111.11111111.00000000.00000000)
3. 255.255.255.0 (11111111.11111111.11111111.00000000)

6.7. Network Address


A network address is an identifier that identifies the location of hosts. It is known as the control network
because it is where all the connected devices come together. In Figure 25, all interconnected devices
have the same network address (underlined), but each has a different host address.

Network: 192.168.1.0
Subnet Mask: 255.255.255.0

Figure 28. Interconnected hosts residing in the same network address

As seen in the figure above, the host portion of a network address is set to 0 (00000000 in binary).
The address of the network depicted above, for example, is 192.168.1.0/255.255.255. In the later
topics, we will use the subnet mask and various rules to determine whether a given network
information is a network address or not.

6.8. Street Analogy


The network can be likened to a real-world place. Let’s consider a real-world street. The capacity of a
street determines the number of houses on it. The more houses that can be accommodated on a
street, the longer it is. Each house on the street has a unique number that distinguishes it from the
rest of the houses. On the other hand, all these houses share one feature: they are all on the same
street and thus have the same address. The figure below depicts a main road, a street, and the houses
on that street.
- 55 -
Figure 29. Street scenario

As shown in Figure 26, Magnolia Street has ten (10) houses, each with its own unique house identifier.
Using the house number, a message sent to or received from one of the people within the street can
be successfully received and delivered. Suppose that someone in H-005 sends a message to
someone in H-001. The sender would simply use the same street address specifying the house
number H-001. The only time the street address is required is when someone from another street
sends a message to someone on Magnolia St. However, if the message exchange is within Magnolia
St., only the house number will be used in the communication process. This principle holds true for a
computer network.

Figure 30. Network scenario

Figure 29 and Figure 30 show the similarity between the actual street location and the computer
network. The street represents the network, the street address (Magnolia St.) represents the network
address (192.168.20.0), the houses represent the hosts (computer, mobile, etc.), while the house
number (H-001– H-030) represents IP address of the host (192.168.20.1 – 192.168.20.254).

Street Network
Street address Network address
House no. IP address
House Host/End device

Table 7. Street-network comparison


- 56 -
Other attributes of a street are equally important. As illustrated in Figure 28, a street has a capacity to
hold 20 houses and currently has 10 houses. So, we can still build ten more houses on it. Because
the last house number is currently H-010, the next house will be H-011, and so on. There will be no
more space on this street after the 20th house is built. As a result, house numbers on Magnolia St.
only ranges from H-001 to H-020.

H-011 H-020
………………

Figure 31. Range of houses that can be built in a street.

Similarly, we have a network with an address 192.168.20.0 with the subnet mask 255.255.255.0.
Because there are a total of 254 IP addresses available in this network, this network can support 254
hosts. Since there are only ten hosts on this network, it still has the capacity to hold 244 hosts. As we
see, there are still far too many IP addresses available for a single network to support multiple devices!

.11 .254
………………

Figure 32. The number of hosts that a network can support.

6.9. Parts of an IP Address


As we previously learned, a subnet mask is used to determine the network portion (np) and host
portion (hp) of an IP address. The steps for obtaining the elements of an IP address are outlined below.

6.9.1. Extracting the Network and Host Portion of an IP Address

Given this IP address: 192.168.1.20 / 255.255.255.0. Extract its network and host portion.

- 57 -
Use the following rules to extract the np and the hp of the IP address:
1) An octet that corresponds to 255 of the subnet mask is part of np.
2) An octet that corresponds to 0 of the subnet mask is part of hp.
STEP 1
Compare the corresponding number (octet) of the subnet mask from that of the IP address:

Address : 192.168.1. 20
Subnet mask : 255.255.255.0

Octet Address Corresponding subnet mask


1st octet 192 255
2nd octet 168 255
3rd octet 1 255
4th octet 20 0

STEP 2
Write the network portion by applying Rule 1.
np = 192.168.1
STEP 2
Write the host portion by applying Rule 2.

hp = 20

Using the rules stated above, we see that the network portion is 192.168.1 while the host portion is
20. This is a shortcut method of extracting the network and host portions of the IP address in dotted
decimal format.

To see how this process works in binary, first convert the IP address 192.168.1.20 / 255.255.255.0 to
binary format:

IP Address: 11000000 10101000 00000001 00010100


Subnet Mask: 11111111 11111111 11111111 00000000

Using a bit-by-bit comparison of the IP address and the subnet mask, all 1s in the subnet mask
correspond to the network portion of the IP address, while all 0s correspond to the host portion.

- 58 -
1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 IP
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 SM
1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0

Network Portion (np) Host Portion (hp)

Network Portion Host Portion


Dotted-decimal Dotted-decimal
Binary Format Binary Format
equivalent equivalent
11000000 10101000 00000001 192.168.1 00010100 20

- 59 -
Worksheet 6-3. Identifying Network and Host Portion of an Address

Write the network portion and the host portion of the following IP addresses on the space provided.

1. 192.168.20.1/255.255.255.0
np: ____________________
hp: ____________________

2. 11.16.5.20/255.0.0.0
np: ____________________
hp: ____________________

3. 172.16.0.0/255.255.0.0
np: ____________________
hp: ____________________

4. 130.0.0.1/255.255.0.0
np: ____________________
hp: ____________________

5. 223.20.0.1/255.255.255.0
np: ____________________
hp: ____________________

- 60 -
6.10. Host Address
IP address is also called host address. This address is used by the host when sending or receiving
information. Each host should be assigned an IP address that belongs to the same network address.
In a flat network or when nodes are interconnected through L2 network switch (more on this later),
host addresses are only valid within the network's boundaries. Figure 33 shows a networked host with
its corresponding IP addresses.

Network address (net id): 192.168.1.0


Broadcast address (broadcast id): 192.168.1.255
Subnet mask: 255.255.255.0
Host addresses: 192.168.1.1 – 192.168.1.254

Figure 33. Network nodes assigned with IP addresses residing in the same network

As shown in the above figure, the network has an address of 192.168.1.0, a broadcast id of
192.168.1.255, and a host id range of 192.168.1.1 to 192.168.1.254. The switch has six connected
end devices, each of which has been given a distinct host id (IP address) ranging from 192.168.1.1 to
192.168.1.6. This indicates that the 192.168.1.0 network still has 248 host addresses available. Hence,
the network can still support up to 248 devices, each of which can be given an IP address between
192.168.1.7 and 192.168.1.254 only.

Now, examine the network diagram in Figure 34. Notice that the first three hosts above have an
address range of 192.168.1.1-3 while the other group of hosts is in the IP address range of
192.168.2.1-3.

- 61 -
Figure 34. Two IP address groups in the same network

What would be the outcome of this configuration? This set up will produce two isolated networks. Only
the hosts, which are members of the group, can see each other. Despite being physically connected
to the same switch, they are logically isolated from one another because each group has its own
network address.

6.11. Extracting the Network Address


In addition to obtaining the network and host portions of an IP address, the AND operator is used to
obtain the network address of a host given its IP address. The AND operator performs logical
conjunction between two expressions. Table 8 shows the result of this operator on two input values.

Input Values
(AND) Output
A B
1 1 1
1 0 0
0 1 0
0 0 0

Table 8. AND operation on two values

Figure 35 demonstrates that when a host with the IP address 192.168.1.152 is ANDed with a subnet
mask of 255.255.255.0 (both in binary form), the result is the network address 192.168.1.0.

- 62 -
Figure 35. Using subnet mask and “AND” operation to get the network address of a host.

6.11.1. Worked Example


Find the network address of the IP address 192.168.1.152/255.255.255.0.
STEP 1
Convert the IP address and subnet mask to binary.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 IP
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 SM
ta
STEP 2
Determine the host portion (hp) of the network address based on the subnet mask. The host portion
is highlighted.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

STEP 3
Make the host portion 0s.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

Converting the above binary value of the IP address, we obtain:


Network Address = 192.168.1.0

6.11.2. Obtaining Network Address without Binary Conversion

We can also get the network address without converting it to binary. But this technique only works
with default subnet masks.
Let’s use the IP address 192.168.1.152/255.255.255.0 again.
STEP 1
Compare the IP address against the subnet mask per octet.

192 168 1 152


255 255 255 0

- 63 -
STEP 2
Write down the octets of the IP address which has a corresponding 255 in the subnet mask.
Network portion = 192.168.1

STEP 3
Change the host portion (152) which has a corresponding 0 in the subnet mask to zero.
Host portion = 0
STEP 4
Combine the network portion and the host portion to get the network address.
Network address = 192.168.1.0

6.12. Extracting the Broadcast Address


Broadcast address allows data to be sent to all devices in the network. Every network address contains
a broadcast address, which is used by each host on that network to broadcast a message, such as
when a device first joins the network or when shared resources are available. All devices connected
to the network will receive a message sent via a broadcast address. The broadcast address is the
address format's highest numeric value.

6.12.1. Worked Example


A network address of 192.168.1.0 with a subnet mask of 255.255.255.0, for example, has a broadcast
address of 192.168.1.255. Follow these steps to see how this broadcast address was obtained.
STEP 1
Convert the network address and subnet mask to binary.
Network address:

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 NA
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 SM

STEP 2
Get the host portion (hp) of the network address as specified by the subnet mask.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

STEP 3
Make the host portion 1s.

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1

Converting the above binary value, we get:


Broadcast Address = 192.168.1.255

- 64 -
6.12.2. Obtaining Broadcast Address without Binary Conversion
We can get the broadcast address without converting it to binary. But this technique only works with
default subnet masks.
Let’s use the IP address 192.168.1.152/255.255.255.0 again.
STEP 1
Compare the IP address against the subnet mask per octet.

192 168 1 152


255 255 255 0

STEP 2
Write down the octets of the IP address which has a corresponding 255 in the subnet mask.
Network portion = 192.168.1
STEP 3
Change the host portion (152) which has a corresponding 0 in the subnet mask to 255.
Host portion = 255
STEP 4
Combine the network portion and the host portion to get the broadcast address.
Broadcast address = 192.168.1.255
This technique works because any 8-bit number ANDed with 255 is the number itself. Keeping this in
mind, we apply the following dotted-decimal notation rules:

A) To obtain the network address, write down the network portion and make the host portion
0 for each octet.
B) To get the broadcast address, write down the network portion and make the host portion
255 for each octet.

6.12.2. More Examples


Example 1:
Let us go over the processes for obtaining the broadcast address of the network address 192.168.1.0
/255.255.255.0 applying rule B.

STEP 1
Write down the network portion as specified by the subnet mask (255.255.255)
Network portion: 192.168.1
STEP 2
Get the host portion of the network address as denoted by the subnet mask (0). The host portion is
already set to 0 since this is a network address.
192.168.1.0
255.255.255.0

- 65 -
STEP 3
Make the host portion 255.
= 192.168.1.255

Network Address : 192.168.1.0


Subnet mask : 255.255.255.0
Broadcast address = 192.168.1.255 → applying Rule B

As shown in the example above, the network address is 192.68.1.0. We just turn the host portion
which is 0 to 255 (applying Rule B) and we will get the broadcast address, which is 192.168.1.255.

Example 2:
Let us go over the processes for getting the network address and broadcast address of the IP address
172.17.1.3 /255.255.0.0 applying rule A for the network address and rule B for the broadcast address.

STEP 1
Write down the network portion as specified by the subnet mask (255.255)
Network portion: 172.17
STEP 2
Write down the host portion as specified by the subnet mask (0.0)
Host portion: 1.3

STEP 3
To get the network address, set the host portion to 0 for each octet.
Network address = 172.17.0.0
STEP 4
To get the broadcast address, make the host portion 255 for each octet.
Broadcast address = 172.17.255.255

Using the processes described above, the network and broadcast addresses of another set of IP
addresses are shown below.

IP Address : 172.17.1.3
Subnet mask : 255.255.0.0
Network address = 172.17.0.0 → Rule A
Broadcast address = 172.17.255.255 → Rule B

- 66 -
Worksheet 6-4. Determining Network Address in Binary
1) Given the IP address 172.17.1.3/255.255.0.0 used above, get its network and broadcast address
using binary computation:

STEP 1
Convert the 172.17.1.3/255.255.0.0 into binary number and write them down in the blank
provided.
IP Address

Subnet Mask

STEP 2
Get the host portion of the IP address as denoted by the subnet mask.
Host Portion (Binary): ______________________________________________________________

STEP 3
Get the network address and the broadcast address.

Network Address

Broadcast Address

2) Given the IP address 172.17.1.3/255.255.0.0 used above, get its network and broadcast address
using decimal-dotted notation:
_______________________
_______________________

- 67 -
6.13. Determining the Address Type – Network address (NA), Broadcast address (BA), or
Host address (IP)

IPv4 addresses are classified into three types: network addresses, host addresses (IP addresses),
and broadcast addresses. As stated previously, a network address is a standard way to refer to a
network, a host address is a unique address that can be assigned to end devices, and a broadcast
address is a unique address for each network that enables communication to all hosts in that network.
There are three guidelines to follow when determining the address type. Once you've learned this set
of rules, you'll be able to identify the address type in its decimal form, eliminating the need for binary
conversion.

6.13.1. Rules in Determining the Address Type

The address is a network address (net id) if the host portion (hp) is all set to 0s (0 in decimal).
If the host portion (hp) contains all 0s (0 for each octet when using decimal notation), the address is a
network address (net id). Thus, the following rules were established:

A) If the host portion (hp) contains all 0s (0 for each octet when using decimal notation), the address
is a network address (net id).
ex. 00000000 (0)
00000000.00000000 (0.0)
00000000.00000000.00000000 (0.0.0)
B) If the host portion (hp) contains all 1s (255 for each octet when using decimal notation), it is a
broadcast address (ba).
ex. 11111111 (255)
11111111. 11111111 (255.255)
11111111. 11111111. 11111111 (255.255.255)
C) If the host portion (hp) has any combination of 0 and 1 but does not contain all 0 bits or all 1 bit,
the address is a host address (IP address).
ex. 00010101 (21)
11111110 (254)
11111111.00000001 (255.1)
0000011.00000101.00000000 (3.5.0)
11111111.00000000 (255.0)
11111111.11111111.11111110 (255.255.254)
00000000.00000001 (0.1)
11111110.00000001 (254.1)

- 68 -
6.13.2. Examples

Let's look at various examples.


#1)
Address : 192.168.1.20
Subnet mask : 255.255.255.0
np = 192.168.1
hp = 20
Binary equivalent of 20: 00010100
Rule C is met.
Type of address = IP address

In this example, the host portion of the address is 20. Based on its binary equivalent, the number is a
combination of 0 and 1. This satisfies Rule C. Hence, this is a host address (IP address).

#2)
Address : 10.255.255.255
Subnet mask : 255.0.0.0
np = 10
hp = 255.255.255
Binary equivalent: 11111111.11111111.11111111
Type of address = Broadcast address (bid)

In this example, the host portion of the address is 255.255.255. This satisfies Rule B. Hence, this is a
broadcast address.

#3)
Address : 192.168.20.0
Subnet mask : 255.255.255.0
np = 192.168.20
hp = 0
Binary equivalent: 00000000

Type of address = Network address (net id)

In this example, the host portion of the address is 0. This satisfies Rule A. Hence, this is a network
address.

- 69 -
#4)
Address : 172.17.1.3
Subnet mask : 255.255.0.0
np = 172.17
hp = 1.3
Type of address = IP address (host id)

In this example, the host portion of the address is 1.3. This satisfies Rule C, indicating that this is an
IP address.

- 70 -
Worksheet 6-5. Determining Address Type
Determine if the following network addresses is a network address, broadcast address, or valid host
address. Write NA for network address, BA for broadcast address, and IP for IP address.

1. 192.168.20.1/255.255.255.0 ______
2. 192.168.20.255/255.255.255.0 ______
3. 170.0.0.1/255.255.0.0 ______
4. 128.20.0.0/255.255.0.0 ______
5. 11.16.5.20/255.0.0.0 ______

- 71 -
6.14. Getting the broadcast address, valid host addresses, and network address

6.14.1. Given a network address (NA), get its broadcast address (BA)
To get the broadcast address, simply write down the network portion (NP) of the network address and
change its host portion (HP) to 255.

Example 1:
Net Address : 192.168.1.0
Subnet mask : 255.255.255.0
Broadcast Address : 192.168.1.255

In this example, the NP which is 192.168.1 was retained and the HP was changed to 255.
Hence, the broadcast address of 192.168.1.0 is 192.168.1.255.

Example 2:
Net Address : 172.16.0.0
Subnet mask : 255.255.0.0
Broadcast Address : 172.16.255.255

In this example, we wrote down the NP, which is 172.16 and the HP, which is 0.0, was changed
to 255.255.

Example 3:
Net Address : 10.0.0.0
Subnet mask : 255.0.0.0
Broadcast Address : 10.255.255.255

In this example, we wrote down the NP, which is 10 and the HP, which is 0.0.0, was changed
to 255.255.

6.14.2. Given the network address (NA), get the valid host addresses.

We can get the range of valid host addresses when only the network address is provided. The
procedures outlined below will guide you through each step.

Procedures:
1) Determine the broadcast address.
2) Add 1 to the network address and subtract 1 from the broadcast address.

- 72 -
Here is a quick note of getting the valid host addresses in the example network 130.20.0.0/255.255.0.0

• 130.20.0.0 → network address (all host bits turned off)


• 130.20.255.255 →broadcast address (all host bits turned on)
• The range of valid host addresses would be the values in between the network address and the
broadcast address. That is, 130.20.0.1 to 130.20.255.254.

Here are some examples of how to get the valid host addresses.

Example 1:

Network Address : 192.168.1.0


Subnet mask : 255.255.255.0

STEP 1
Get the broadcast address.
Broadcast Address: 192.168.1.255
STEP 2
Add 1 to the network address.
192.168.1.0 + 1 = 192.168.1.1

STEP 3
Subtract 1 from the broadcast address.
192.168.1.255 - 1 = 192.168.1.254

STEP 4
Write down the range of host addresses in the network.
Range of valid host addresses: 192.168.1.1 – 192.168.1.254

Example 2:
Address : 172.16.0.0
Subnet mask : 255.255.0.0

STEP 1
Get the broadcast address.
Broadcast address: 172.16.255.255
STEP 2
Add 1 to the network address.
172.16.0.0 + 1 = 172.16.0.1

- 73 -
STEP 3
Subtract 1 from the broadcast address.
172.16.255.255 - 1 = 172.16.255.254

STEP 4
Write down the range of host addresses in the network.
Range of valid host addresses: 172.16.0.1 – 172.16.255.254

Example 3:
Address : 10.0.0.0
Subnet mask : 255.0.0.0

STEP 1
Get the broadcast address.
Broadcast address: 10.255.255.255
STEP 2
Add 1 to the net address.
10.0.0.0 + 1 = 10.0.0.1

STEP 3
Subtract 1 from the broadcast address.
10.255.255.255 - 1 = 10.255.255.254

STEP 4
Write the range of host addresses in the network.
Range of valid host addresses: 10.0.0.1 – 10.255.255.254

6.14.3. Given the host address (IP address), get the Network address and the Broadcast address.

When only the host address (IP address) is given, you may extract additional network information from
it including its network and broadcast address. The procedures outlined below will walk you through
the process.

Example 1:
Host Address : 10.26.0.0
Subnet mask : 255.0.0.0

STEP 1
Get the network address.
Network address: 10.0.0.0

- 74 -
STEP 2
Get the broadcast address.
Broadcast address: 10.255.255.255

Example 2:
Host Address : 172.16.20.5
Subnet mask : 255.255.0.0

STEP 1
Get the network address.
Network address: 172.16.0.0
STEP 2
Get the broadcast address.
Broadcast address: 172.16.255.255

Example 3:

Network Address : 192.168.1.11


Subnet mask : 255.255.255.0

STEP 1
Get the network address.
Network address: 192.168.1.0
STEP 2
Get the broadcast address.
Broadcast address: 192.168.1.255

- 75 -
Worksheet 6-6. Network Information Computation

a) Find the network portion and the host portion of the following IP addresses:
1. 192.168.20.1/255.255.255.0
2. 11.16.5.20/255.0.0.0
b) Write NA if the address is Network Address, BA if the address is broadcast address and IP if the
address is a valid host address.
3. 11.16.5.255/255.0.0.0
4. 192.168.1.255/255.255.255.0
5. 192.168.1.0/255.255.255.0
6. 193.178.5.1/255.255.255.0
7. 172.16.5.0/255.255.0.0
c) Given the IP address 192.168.20.20, find the network address (net id), broadcast address (bid)
and valid IP address range (host id)
8. Net id: _____________________
Broadcast id: _______________
IP address range: ___________
d) Given the IP address, 10.0.0.255, find the network address (net id), broadcast address
(bid) and valid IP address range (host id)
9. Net id: _____________________
Broadcast id: _______________
IP address range: ___________
Given the network address, find the broadcast address (bid) and valid IP address range (host id)
10. Broadcast id: _____________________
IP address range: _________________

- 76 -
6.15. Determining the number of number of hosts per network and the number of
networks

When computing for the number of hosts per network, we use the formula:
2n – 2 - where n is the number of bits in the host portion
The reason for subtracting by 2 is that we need to exclude the network and
broadcast addresses since they are not valid host addresses.

When computing for the number of networks, we use the formula:


2n - where n is the number of bits in the network portion

6.15.1. Number of hosts per network


Because we intend to get the number of hosts, we must first determine the number of bits in the host
portion and then apply formula 2n-2 to determine the total number of hosts per network.
Scenario 1: Given the network address 192.168.20.0/255.255.255.0, how many hosts are available?
STEP 1
Get the host portion of the address.
-> 192.168.20.0
255.255.255.0
Host portion = 0

STEP 2
Convert the host portion to binary.
-> 0 = 00000000 → 8 host bits.

STEP 3
Plug the number of bits in formula 2n – 2.
-> 28 – 2
256 – 2
-> 254

Total number of hosts = 254

- 77 -
Scenario 2: Given the network address 130.25.0.0/255.255.0.0, how many hosts are available?
STEP 1
Get the host portion of the address.
-> 130.25.0.0
255.255.0.0
Host portion = 0.0

STEP 2
Convert the host portion to binary.
-> 0.0 = 00000000.00000000 → 16 host bits.

STEP 3
Plug the number of host bits in formula 2n – 2.
-> 216 – 2
65,536 – 2
-> 65,534

Total number of hosts = 65,534

Scenario 3: With a network address of 10.0.0.0/255.0.0.0, how many hosts are available?
STEP 1
Get the host portion of the address.
-> 10.0.0.0
255.0.0.0
Host portion = 0.0.0

STEP 2
Convert the host portion to binary.
-> 0.0.0 = 00000000. 00000000.00000000 → 24 host bits.

STEP 3
Plug the number of host bits in formula 2n – 2.
224 – 2
16,777,216 – 2
-> 16,777,214

Total number of hosts = 16,777,214

6.15.2. Number of Network(s)


As with calculating the total number of hosts in a network, we must also determine the number of bits
in the host portion. The total number of networks is then determined using formula 2n.
Scenario 1: With a network address of 192.168.x.0/255.255.255.0, how many network addresses and
hosts per network are available?

- 78 -
In the given network 192.168.x.0, x has a corresponding 255 value in the subnet mask, which means
that it is a part of the network. Since x is an octet, this means that it can hold 8 network bits.
Plugging it in the formula 2n, we get:
28 = 256
Total number of networks = 256
Keep in mind that the 3rd octet is a variable that holds a value from 0 to 255 (range of values in 8 bits).
So, if we do a listing of all the networks in this address, we will come up with the following:
First network: 192.168.0.0
192.168.1.0
192.168.2.0
192.168.3.0
192.168.4.0
….
192.168.254.0
Last network: 192.168.255.0

We now see that 192.168.x.0/255.255.255.0 has 256 networks.


Let us now choose one of the network addresses from the list. Say, 192.168.3.0/255.255.255.0. How
many hosts are available in this network?
STEP 1
Get the host portion of the address.
-> 192.168.3.0
255.255.255.0
Host portion = 0

STEP 2
Convert the host portion to binary.
-> 0 = 00000000 → 8 host bits.

STEP 3
Plug the number of host bits in formula 2n – 2.
28 – 2
256 – 2
-> 254

Total number of hosts = 254

Generally, there are 256 networks available for 192.168.x.0/255.255.255.0, with each network
containing 254 hosts.
Scenario 2: With a network address of 172.16.0.0/255.255.0.0, how many network addresses and
hosts per network are available?

- 79 -
For this scenario, we can observe that there is only one network, that is, 172.16.0.0 (constant). For
the number of hosts in this network, however, we can perform the same procedures outlined
previously.
STEP 1
Get the host portion of the address.
-> 172.16.0.0
255.255.0.0
Host portion = 0.0

STEP 2
Convert the host portion to binary.
-> 0.0 = 00000000.00000000 → 16 host bits.

STEP 3
Plug the number of host bits in formula 2n – 2.
216 – 2
256 – 2
-> 65,534

Total number of hosts = 65,534

Scenario 3: How many networks exist within the network address range 172.16.0.0 to 172.31.0.0
/255.255.0.0?
We can tell from the subnet mask that the second octet from the left is part of the network (NP). Hence,
counting the numbers from 16 to 31 yields 16 networks.

6.16. Classes of IP Address (IPv4)


When the IP network protocol was first designed, it was divided into several classes based on the size
of the network:

• Class A network is designated for a small number of networks with very large hosts.
• Class B network is designated for a medium-sized network with a medium-sized number of
hosts.
• Class C network is designated with numerous networks with each network containing a small
number of hosts.
There were two additional classes developed, but these are designated for special purposes: Class D
– Multicast, Class E- Research.
As you will see later, the mechanism that identifies the IP address class is defined by its first octet and
its subnet mask.
Class A Address: The first octet of a Class A address is from 1 to 126. Class A addresses contain
eight network bits and 24 host bits. Class A has a total of 126 networks, each with 16,777,216 hosts.
Default subnet mask: 255.0.0.0
Format: network.host.host.host.

- 80 -
Class B Address: The first octet of a Class B addresses is from 128 to 191. Class B addresses contain
16 network bits and 16 host bits. Class B has a total of 16,384 networks, each with 65,534 hosts.
Default subnet mask: 255.255.0.0
Format: network.network.host.host.

Class C Address: The first octet of a Class C addresses is from 192 to 223. Class C addresses
contain 24 bits for the network and 8 bits for the host. There are 2,097,152 networks in Class C, with
254 hosts per network.
Default subnet mask: 255.255.255.0
Format: network.network.network.host.

6.17. Private IP addresses


As computer networks expand, IPv4 address space quickly runs out. Private IP addresses are
designed to conserve IP address space. These are typically used in an organization's network, such
as school campuses or residences. Table x details the private IP address space.

Address Class Reserved Address Space Default Subnet Mask


Class A 10.0.0.0 through 10.255.255.255 255.0.0.0
Class B 172.16.0.0 through 172.31.255.255 255.255.0.0
Class C 192.168.0.0 through 192.168.255.255 255.255.255.0
Table 9. Private IP addresses

As shown in the table, the private class A network contains only one network, 10.0.0.0, with a
broadcast address of 10.255.255.255 and a valid IP address range of 10.0.0.1 to 10.255.255.254
when using the default subnet mask of 255.0.0.0.
Class B networks, on the other hand, have 16 networks ranging from 172.16.0.0 to 172.31.0.0.
Selecting 172.17.0.0 network from this range, it has a broadcast address of 172.17.255.255 and valid
host addresses ranging from 172.17.0.1 to 172.17.255.254.
A class C network contains 256 networks, ranging from 192.168.0.0 to 192.168.255.0. If we pick one
network address from this range, say, 192.168.1.0. Its broadcast address is 192.168.1.255, with a
valid IP address from 192.168.1.1 to 192.168.1.254. However, you should be aware that routers or
switches added to the network typically have a default IP address of 192.168.1.1 or 192.168.1.254.
This also applies to the 192.168.0.0/24 network, where managed switches and routers have a factory
default IP address of 192.168.0.1 or 192.168.0.254. To avoid IP address conflicts, you must refrain
from giving any computers the above-mentioned IP addresses.

6.18. Classless Inter-domain Routing (CIDR)


CIDR has replaced the classful addressing and enhances IP address allocation by providing flexibility
in the subnetting scheme. CIDR allows you to override the default subnet masks and adjust them
based on the organization's needs. CIDR notation, also called “slash notation”, denotes the number
of bits turned on (1s) in the subnet mask starting from the left octet. For example, we can rewrite class
A's default subnet mask of 255.0.0.0 as /8, which indicates that the first 8 bits are used for the network
block (11111111 or 255). For class B, 255.255.0.0 can be rewritten as /16, which means that there
are 16 bits turned on (11111111.11111111 or 255.255). Although IPv4 has a maximum of 32 bits, the

- 81 -
largest /n available is /30 because we need to keep at least two bits for the host portion. Table 10
presents the default subnet masks and their corresponding CIDR slash notation.

Subnet Mask Binary CIDR Value

255.0.0.0 11111111.00000000.00000000.00000000 /8

255.255.0.0 11111111.11111111.00000000.00000000 /16

255.255.255.0 11111111.11111111.11111111.00000000 /24

Table 10. Subnet mask and equivalent CIDR value

With CIDR, the slash notation can be used to represent the subnet mask. So, you can write
192.168.0.1/24 instead of 192.168.0.1/255.255.255.0. The network 10.0.0.0/255.0.0.0 can be
shortened to 10.0.0.0/8. The network 172.16.0.0/255.255.0.0 can be written as 172.16.0.0/16. CIDR
configuration has many advantages over classful addressing since you can easily adjust the network
block using values such as /20, /15, /28, and so on to customize the size of network based on your
needs. However, these topics are outside the scope of this learning material.

- 82 -
Worksheet 6-7. Converting Subnet Mask to CIDR Form
Convert the following network information into CIDR form.

1. 192.167.20.21 / 255.2552.255.0 _________________________


2. 130.17.20.0 / 255.255.0.0 _________________________
3. 10.0.17.0 / 255.0.0.0 _________________________

- 83 -

You might also like