## 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

## 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)

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

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

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!