IPv4 Addresses and Subnet Masks

Last Updated on January 28, 2021 by Admin

The Format of an IPv4 Address

An IPv4 address can be written in two ways:

dotted decimal notation – 192.168.1.1
32-bit binary notation – 11000000.10101000.00000001.00000001

The address has 4 octets separated by periods and counted from let to right. There are three types of IPv4 addresses: a network address, a host address, and a broadcast address. In other words you could say a computer is on the 192.168.10.0 /24 network (network address), and is using a host address of 192.168.10.1. The address 192.168.10.1 represents the ip address in dotted decimal notation. That same address in binary notation is 11000000.10101000.00001010.00000001. The 1(00000001) is in the 4th octet.

Converting Binary to Decimal and Vice Versa

The most popular, and (in my opinion) easiest way to convert a binary number to decimal is using a table like so:

128 64 32 16 8 4 2 1
0 0 1 1 1 0 0 1
0 + 0 + 32 + 16 + 8 + 0 + 0 + 1 = 57
Aside from knowing the table well enough to use it without writing it all out, there are various tricks for binary/decimal conversion. Personally, I’ve never found them very practical, but this doubling trick for converting binary to decimal, and this halving trick for converting decimal to binary are pretty cool.

Network Portion and the Host Portion of an IP Address and Subnet Mask

The network portion and the host portion of an ip address is defined its subnet mask. This process is easy if the subnet mask is classful meaning either:

Class C  –  255.255.255.0  or /24,
Class B  –  255.255.0.0  or /16,
Class A  –  255.0.0.0  or /8

So if the ip address is 192.168.1.100 and the subnet mask is classful meaning 255.255.255.0 then the 255s in the subnet mask tell you the network portion and the 0s tell you the host portion. For example, below the network portion is in red and the host portion is in black:

192.168.1.100
255.255.255.0
(So the network is 192.168.1.0, and the host is number 100)

Using the example above the first address in the network is the network address (192.168.1.0). The last address in the network is the broadcast address (192.168.1.255), and the host addresses in the network are the addresses between the network and the broadcast  (192.168.1.1 – 192.168.1.254).

The process is a little more difficult when a non-classful subnet mask is used. In this scenario binary conversion must be used to delineate the network and host portions of an address. Consider the following example:

192.168.1.100 /27 or

192.168.1.100
255.255.255.224
Where are the network and host portions now?

To easily solve the question convert to binary:
11000000.10101000.00000001.01100100  = 192.168.1.100
11111111.11111111.11111111.11100000 = 255.255.255.224
(The 1s in the subnet mask identify the network portion, the 0s the host portion)

The network and host portions are still defined by the subnet mask, just more accurately by seeing the address and mask in binary and identifying the 1s and 0s. The question that you now have to ask yourself is, what is the networkaddress, broadcast address and host addresses if the subnet mask is 255.255.255.224? To answer this question you need to, in binary, logically AND the ip address and subnet mask and you will get the network address. To understand this process and more see my video series on subnetting, ANDing and the Magic Number below.

IPv4 Addresses and Subnet Masks

IPv4 Addresses and Subnet Masks

3 Types of IP Addresses: Network Address, Host Address, and Broadcast Address

Network Address – The address by which we refer to the network
Uses the first address in the network,
The network address is reserved and is not usable by a host
All hosts in a network will have the same network address
All hosts in a network will have the same network bits or network portion

Broadcast Address – The address used to send data to all of the hosts on a network
Uses the highest (last) address in the network,
The broadcast address is reserved and is not usable by a host
The bits in host portion are all 1’s
Also called a directed broadcast

Host Address – The addresses assigned to the end devices in the network
Each and every device in the network needs a unique ip address,
The host addresses lie between the network and broadcast address

Public and Private Addressing

Private addresses are blocks of ip addresses that are not routable on the internet. The private address blocks are:

10.0.0.0 to 10.255.255.255   (10.0.0.0 /8)
172.16.0.0 to 172.31.255.255   (172.16.0.0 /12)
192.168.0.0 to 192.168.255.255   (192.168.0.0 /16)

Since private addresses are implemented on LANs behind a firewall different networks may use the same private address schemes. Private addressing requires Network Address Translation (NAT) in order to translate private addresses to public addresses for use on the internet. With this (NAT) technique, many hosts in a private network can channel all communications through a single public ip address allowing communicate over the internet.

Public Addresses are designed to be used by hosts that are publicly accessible from the internet. Public ip addresses are assigned by the InterNIC and consist of class-based network IDs called CIDR blocks.

Video Tutorial Series – IP Addresses, Binary Conversion, and Network Masks

In order to understanding of subnetting you need to be able to convert IP addresses from decimal to binary. Subnetting, subnetworks, and subnet masks only make sense from the perspective of binary. The reason you need to convert the addresses to binary is that it is the way routers find networks. Routers and computers find networks by ANDing IP addresses with the subnet masks. If you want to understand the logic behind the process you need to be able to see it from the perspective of the router. In the following video tutorials I lay out the simple process of converting IP addresses and subnet masks to binary. I also cover finding the network portion and host portion of a network or subnetwork mask. I recommend watching all of these videos as as my following series on the “Magic Number.”

Video Tutorial Series – Subnetting with the Magic Number – Parts 1 through 6

In this series of tutorials, I explain how you can easily find the network address, broadcast address, and first and last host addresses from any ip address and subnet mask combination. The ability to calculate subnets is the most important skill for success in the Cisco CCNA. The magic number trick will make that process a snap!

Unicast, Broadcast, and Multicast Messaging 

A message or packet sent to a unique ip host address is called a unicast message. A unicast message is a message addressed to a single unique host. By contrast a message or packet sent to a broadcast address is called a broadcast message. It is a message meant for all hosts on a network. A multicast message is a message sent to a multicast address, typically an address starting with 224 like 224.0.0.1. An address that starts with 224 is a Class D address which is an address space reserved for multicasts. A multicast message is like a broadcast message in that most, or all, hosts on the network will open the packet and examine its contents before deciding whether or not to drop the message or send it up the layers for decapsulation.