The Ultimate Resource for the CCNA 200-301 Exam (Click Here)
IPv4 Address Structure CCNA
IPv4 Address Structure CCNA

IPv4 Address Structure

IPv4 Address Structure
5

Summary

This topic describe the structure of an IPv4 address including the network portion, the host portion, and the subnet mask. Start learning CCNA 200-301 for free right now!!

Note: Welcome: This topic is part of Chapter 11 of the Cisco CCNA 1 course, for a better follow up of the course you can go to the CCNA 1 section to guide you through an order.

Network and Host Portions

An IPv4 address is a 32-bit hierarchical address that is made up of a network portion and a host portion. When determining the network portion versus the host portion, you must look at the 32-bit stream, as shown in the figure.

IPv4 Address

IPv4 Address network portion and host portion
IPv4 Address network portion and host portion

The bits within the network portion of the address must be identical for all devices that reside in the same network. The bits within the host portion of the address must be unique to identify a specific host within a network. If two hosts have the same bit-pattern in the specified network portion of the 32-bit stream, those two hosts will reside in the same network.

But how do hosts know which portion of the 32-bits identifies the network and which identifies the host? That is the role of the subnet mask.

The Subnet Mask

As shown in the figure, assigning an IPv4 address to a host requires the following:

  • IPv4 address – This is the unique IPv4 address of the host.
  • Subnet mask– This is used to identify the network/host portion of the IPv4 address.

IPv4 Configuration on a Windows Computer

IPv4 Configuration on a Windows Computer
IPv4 Configuration on a Windows Computer

Note: A default gateway IPv4 address is required to reach remote networks and DNS server IPv4 addresses are required to translate domain names to IPv4 addresses.

The IPv4 subnet mask is used to differentiate the network portion from the host portion of an IPv4 address. When an IPv4 address is assigned to a device, the subnet mask is used to determine the network address of the device. The network address represents all the devices on the same network.

The next figure displays the 32-bit subnet mask in dotted decimal and binary formats.

Subnet Mask

Subnet Mask
Subnet Mask

Notice how the subnet mask is a consecutive sequence of 1 bits followed by a consecutive sequence of 0 bits.

To identify the network and host portions of an IPv4 address, the subnet mask is compared to the IPv4 address bit for bit, from left to right as shown in the figure.

Associating an IPv4 Address with its Subnet Mask

Associating an IPv4 Address with its Subnet Mask
Associating an IPv4 Address with its Subnet Mask

Note that the subnet mask does not actually contain the network or host portion of an IPv4 address, it just tells the computer where to look for the part of the IPv4 address that is the network portion and which part is the host portion.

The actual process used to identify the network portion and host portion is called ANDing.

The Prefix Length

Expressing network addresses and host addresses with the dotted decimal subnet mask address can become cumbersome. Fortunately, there is an alternative method of identifying a subnet mask, a method called the prefix length.

The prefix length is the number of bits set to 1 in the subnet mask. It is written in “slash notation”, which is noted by a forward slash (/) followed by the number of bits set to 1. Therefore, count the number of bits in the subnet mask and prepend it with a slash.

Refer to the table for examples. The first column lists various subnet masks that can be used with a host address. The second column displays the converted 32-bit binary address. The last column displays the resulting prefix length.

Comparing the Subnet Mask and Prefix Length

Subnet Mask 32-bit Address Prefix Length
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
255.255.255.128
11111111.11111111.11111111.10000000
/25
255.255.255.192
11111111.11111111.11111111.11000000
/26
255.255.255.224
11111111.11111111.11111111.11100000
/27
255.255.255.240
11111111.11111111.11111111.11110000
/28
255.255.255.248
11111111.11111111.11111111.11111000
/29
255.255.255.252
11111111.11111111.11111111.11111100
/30

Note: A network address is also referred to as a prefix or network prefix. Therefore, the prefix length is the number of 1 bits in the subnet mask.

When representing an IPv4 address using a prefix length, the IPv4 address is written followed by the prefix length with no spaces. For example, 192.168.10.10 255.255.255.0 would be written as 192.168.10.10/24. Using various types of prefix lengths will be discussed later. For now, the focus will be on the /24 (i.e. 255.255.255.0) prefix

Determining the Network: Logical AND

A logical AND is one of three Boolean operations used in Boolean or digital logic. The other two are OR and NOT. The AND operation is used in determining the network address.

Logical AND is the comparison of two bits that produce the results shown below. Note how only a 1 AND 1 produces a 1. Any other combination results in a 0.

  • 1 AND 1 = 1
  • 0 AND 1 = 0
  • 1 AND 0 = 0
  • 0 AND 0 = 0

Note: In digital logic, 1 represents True and 0 represents False. When using an AND operation, both input values must be True (1) for the result to be True (1).

To identify the network address of an IPv4 host, the IPv4 address is logically ANDed, bit by bit, with the subnet mask. ANDing between the address and the subnet mask yields the network address.

To illustrate how AND is used to discover a network address, consider a host with IPv4 address 192.168.10.10 and subnet mask of 255.255.255.0, as shown in the figure:

  • IPv4 host address (192.168.10.10) – The IPv4 address of the host in dotted decimal and binary formats.
  • Subnet mask (255.255.255.0) – The subnet mask of the host in dotted decimal and binary formats.
  • Network address (192.168.10.0) – The logical AND operation between the IPv4 address and subnet mask results in an IPv4 network address shown in dotted decimal and binary formats.
Determining the Network Logical AND
Determining the Network Logical AND

Using the first sequence of bits as an example, notice the AND operation is performed on the 1-bit of the host address with the 1-bit of the subnet mask. This results in a 1 bit for the network address. 1 AND 1 = 1.

The AND operation between an IPv4 host address and subnet mask results in the IPv4 network address for this host. In this example, the AND operation between the host address of 192.168.10.10 and the subnet mask 255.255.255.0 (/24), results in the IPv4 network address of 192.168.10.0/24. This is an important IPv4 operation, as it tells the host what network it belongs to.

Video – Network, Host and Broadcast Addresses

Click Play to view a demonstration of how the network, host, and broadcast addresses are determined for a given IPv4 address and subnet mask.

Network, Host, and Broadcast Addresses

Within each network are three types of IP addresses:

  • Network address
  • Host addresses
  • Broadcast address

Using the topology in the figure, these three types of addresses will be examined.

Types of IP addresses
Types of IP addresses

Network address

A network address is an address that represents a specific network. A device belongs to this network if it meets three criteria:

  • It has the same subnet mask as the network address.
  • It has the same network bits as the network address, as indicated by the subnet mask.
  • It is located on the same broadcast domain as other hosts with the same network address.

A host determines its network address by performing an AND operation between its IPv4 address and its subnet mask.

As shown in the table, the network address has all 0 bits in the host portion, as determined by the subnet mask. In this example, the network address is 192.168.10.0/24. A network address cannot be assigned to a device.

Network, Host, and Broadcast Addresses

Network Portion Host Portion Host Bits
Subnet mask 255.255.255.0 or /24
255      255      255
11111111 11111111 11111111
0
00000000
Network address 192.168.10.0 or /24
192      168       10
11000000 10100000 00001010
0
00000000
All 0s
First address 192.168.10.1 or /24
192      168       10
11000000 10100000 00001010
1
00000001
All 0s and a 1
Last address 192.168.10.254 or /24
192      168       10
11000000 10100000 00001010
254
11111110
All 1s and a 0
Broadcast address 192.168.10.255 or /24
192      168       10
11000000 10100000 00001010
255
11111111
All 1s

Host addresses

Host addresses are addresses that can be assigned to a device such as a host computer, laptop, smart phone, web camera, printer, router, etc. The host portion of the address is the bits indicated by 0 bits in the subnet mask. Host addresses can have any combination of bits in the host portion except for all 0 bits (this would be a network address) or all 1 bits (this would be a broadcast address).

All devices within the same network, must have the same subnet mask and the same network bits. Only the host bits will differ and must be unique.

Notice that in the table, there is a first and last host address:

  • First host address – This first host within a network has all 0 bits with the last (right-most) bit as a 1 bit. In this example it is 192.168.10.1/24.
  • Last host address – This last host within a network has all 1 bits with the last (right-most) bit as a 0 bit. In this example it is 192.168.10.254/24.

Any addresses between and including, 192.168.10.1/24 through 192.168.10.254/24 can be assigned to a device on the network.

Broadcast address

A broadcast address is an address that is used when it is required to reach all devices on the IPv4 network. As shown in the table, the network broadcast address has all 1 bits in the host portion, as determined by the subnet mask. In this example, the network address is 192.168.10.255/24. A broadcast address cannot be assigned to a device.

Glossary: If you have doubts about any special term, you can consult this computer network dictionary.

Ready to go! Keep visiting our networking course blog, give Like to our fanpage; and you will find more tools and concepts that will make you a networking professional.