Latest

CCNA RnS Article #38: IP Addressing

CCNA RnS Article #38: IP Addressing 



In this article, we are going to talk about one of the most important topics in the CCNA course which is IP Addressing & subnetting. 

IPv4 Addresses

IPv4 addresses are 32 bits long (mean 32 0s or 1s), divided into two parts network address and the host address. The network portion identifies a physical link and is the same for all the hosts connected to that physical network. The host portion identifies a particular device only.

An IPv4 Address can be represented in different formats –

Bits format –

00001010110101100101011110000011

Decimal format –

181819267

Both the representations above are hard to remember and calculate. Therefore a dotted-decimal representation is developed and used by network engineers. However, the network devices understand the binary format only.

With dotted decimal format, the above 32-bit address is divided into 4 parts, each part is called the octet which is 8-bits long or 1-byte long. With dotted decimal format, let's perform the first step –

00001010.11010110.01010111.10000011

And now convert the same to decimal format –

00001010.11010110.01010111.10000011

10.214.87.131

Points to remember – a possible value in each octet can be between 0 – 255 (with all bits set to 1 will result in 255 and all bits set to 0 will result in 0)

An important factor of IPv4 addressing is that it allows you to perform more calculations compared to other network layer protocols such as NetWare and AppleTalk there we have a fixed network and host portion – this certainly makes life simple. In IPv4 the calculation is required to conserve the IP address for a network – I mean when we have a small number of users in a network, there is no need to have 1000s of devices in that network. With the help of subnetting, we’ll see how effectively we can design our IP addressing schema for the network without wasting IPs.

IPv4 Addressing was designed for all types of networks – small, medium, and large. Wait a minute what is the definition of small, medium, or large I mean how many hosts can be there in each class of network. Ok, that is governed by the “First Octet Rule” which we are going to see next.

First Octet Rule

There are three types sizes of networks as measured by the number of hosts – big, small, and medium;

  • Big networks have a large number of hosts
  • Small networks are just opposite to big networks with less number of hosts and more number of small networks
  • Medium network has a medium number of networks and medium number of hosts in each network

As we have 3 types of networks depending on the number of endpoints and network requirements, so the network address class to cater to the addressing requirement for these networks. 

Address Class

These three types of address format can be represented as follows


Figure 1- Class A, B and C Address Format

The big, medium, and small networks are mapped to these address classes.

Class A IPv4 Addresses are for big networks. In class A address, the first octet is the network portion and the next three octets are the host portion. If we do a simple math, only 256 numbers are available for the network part. However, a huge number of hosts can exist in each network – 224 or 16,777216 hosts.

Class B IPv4 Addresses are for medium networks. In the class B address, the first two octets are for the network portion and the next two octets are for the host portion. In class B address there are 216 or 65,536 networks and hosts in each network.

Class C IPv4 Addresses are for small networks. In the Class B address, the first three octets are for the network position and the last octet is for the host portion.

In an IP address, each octet is 8 bits long a in decimal is is a value between 0 - 255. Using the 1st Octet rule we can easily find which class an IP address belongs to. 

According to this rule –

  • 1.      For class A address, the first bit of 1st Octet (left most) is always 0. With this rule the class A IP address can starts with any value between 0 and 127; IP address starting with 0 is reserved for default address and 127 is reserved for internal loopback address. This leaves a Class A valid IP address first octet is between 1 and 126.
  • 2.      For class B address, the first 2 bits are set as “10”. With binary to decimal conversion formula it is clear the first octet for class B address falls between the 128 and 191.
  • 3.      For class C address the first two bits are set to 1 and third bit is set to zero. The result is, the first octet range is between 192 – 223.

Address Mask

Looking at the IP address we cannot findout what portion identifies the network address and the host address. To solve this puzzle, address mask is used. The address mask is a 32 bit text where one bit for each bit of the IPv4 address. It is also represented in dotted decimal format same as the IPv4 address. It is to remember address mask looks like the IP address but it is not the one. There are standard subnet mask for each class of IPv4 Address –

Figure 2: Standard Address Masks

For each bit of IPv4 address, the device under the hood performs the Boolean AND function with the corresponding bit of the address mask. The AND function – compare two bits and derive a result. The result will be one if and only if, both bits are one. If either or both bits are zero, the result will be zero.

Ahh let’s try to understand the same with example,

Figure 3: AND Operator

Figure 4: Deriving NW Address using AND Operator

As per Figure 4, a logical AND is performed on the IPv4 address and its address mask for every bit; the result is 172.21.0.0 which is the network address for the host 172.21.35.17 with address mask 255.255.0.0.

Why Subnetting?

There can be multiple locations in a network and each location needs to be logically identified so that traffic from one side can reach to other side. This on a very high level is called the routing function. Each network should be unique – also each host on the network must have an address that identifies it uniquely in the network and its network from other networks.

Can’t we use a standard subnet mask?

Probably can be used (in a lab environment) but in real-life scenario, a single class A, B, or C address can be used only on a single data link.

Figure 5: NW with default Subnet Masks

The problem with the above network is scalability, With default subnet mask, addressing the size of the network will be limited and unnecessary there will be a wastage of the host IP addresses. Consider a Data Link 2 in Figure 5. It is a point-to-point link and effectively only 2 IP address can make communication possible. However, with default subnet we are wasting 64,998 IP addresses addresses.

The solution of this problem (wasting IP Addresses) is to perform the subnetting. With subnetting we take a big or major network and divide it into small network called sub-networks in short subnets.

Let’s try to understand the same by simple example, look at the below network architecture where 172.21.0.0 is divided into subnetworks –

Figure 6 - Subnetworks - using single network address across multiple links

You must have noticed that the subnet mask is not the standard class B subnet mask with 16-bit reserved for network address. Instead, we have borrowed additional 8 bits from the host portion of the address – so now we have 24-bits to represent the network address. This resulted that the major network 172.21.0.0 has been divided into subnetworks and each datalink has been addressed instead of wasting the IP addresses using the major network address across the datalinks.

Now after subnetting there are 3 part of the IPv4 Address – network, subnet, and the host part. The address mask is now called – subnet mask. First two octets are the major network (172.21.x.x) and will remain unchanged. However, the 3rd octet is subnet bits instead of host bit. I range from 0 to 255.

Just a point to remember, not all routing protocols (classful routing protocol) can understand the subnet address where all subnet-bits are 0 or all subnet-bits are 1. For example – 172.21.0.0/24 and 172.21.255.0/24. It is because they are not able to differentiate 172.21.0.0 which is major subnet address or the first subnetwork 172.21.0.0. In this case both are same. Likewise, 172.21.255.0 – it is major network broadcast address and at the same time last subnetwork . IGRP and RIPv1 are classful routing protocols that don’t allow to use all-ones and all-zero subnets in a network. On the other hand, classless routing protocol such as EIRP, OSPF etc. understand the differentiator – as the subnet mask information is communicated in the routing updates.

Sometimes we also get confused with the verbal communication of the subnet during our day to day troubleshooting or support tasks. So what is the correct way to communicate a piece of information when subnetting is used as we have done in above feature. It means “Class B address with 8-bits of Subnetting” or “Class B address with 24-bits mask”. I hope it is clear now.

A subnet mask can be represented in the dotted decimal format – 255.255.255.0; in bits count format 172.21.1.0/24; or in Hexadecimal format 0xFFFFFF00.

Designing a IP Addressing for a network

As it is already mentioned that all-zero subnet-bits and the all-ones subnet-bits are not understood by classful routing protocols, likewise, all-zero host address and all-ones host address are reserved in IPv4 networking. Router use all-zero host address as – subnet address and all-ones host address as – broadcast address i.e. 172.21.1.0/24 is the subnet address and 172.21.1.255/24 is the broadcast address in subnet 172.21.1.0/24.

When you have been assigned a task to build a network and designed the IP schema you have to go through the series of steps to successfully come out as an architect –

Step 1 – Determine how many subnets and how many hosts per subnets required

Step 2 – Use 2n – 2 formula to determine the number of subnet bits and the number of hosts bits that will satisfy the requirement established in step 1. If multiple subnet masks meet the requirement, choose one that will best scale to future need.

Step 3 – working in binary, determine all available bit combinations in the subnet space; in each instance, set all the host bits to zero. Convert the resulting subnet address to dotted decimal. These are the subnet addresses.

Step 4 – for each subnet address, again working in binary, all possible bit combinations for the host space without changing the subnet bits. Convert the result to doted decimal; these are the host addresses available for each subnet.

Let’s work in a real scenario and try to design the IP Addressing for a customer. This customer need IP design for 500 remote locations and each location has around 100 hosts.

Step 1 – using the 9 bits for subnet can meet the requirement - 29 - 2 = 510 (locations considering the scalability into mind); if we use 8 bits for subnets than the requirement cannot be met as it will give only 254 subnets only.

Let’s work on the below network setup where we do need 5 subnets for each data-link in the topology –

Figure 7: Network with 5 Datalinks and mini. 25 IP host

Network 192.168.100.0 to be divided in such as way that provide at least 5 subnet addresses. The maximum host addresses are 25 for two LAN subnets. Therefore full IP Addressing design require 5 subnets with each minimum 25 host addresses.

Applying 2n -2 formula, three subnet bits and five host bits will satisfy the requirement : 23 – 2 = 6 and 25 – 2 = 30. A class C subnet mask with 3 bits of subnetting is represented as 255.255.255.224 in the dotted decimal format.

Figure 8: Network, Subnet Bits & Host bits - Subnet Addresses

 In above figure, subnet bits are abstracted and then writing all the possible bit combinations in the space by counting up from zero in the binary – 0, 1, 2, 3 and so on. These are the subnet addresses that will be assigned to datalinks.

Figure 9: Calculating the Subnet Address counting up Subnet Bits  from 0 in binary

Last step to calculate the host addresses available to each subnet. This step is performed by choosing the subnet mask and keeping the network & Subnet bits unchanged, writing all bit combinations in the host space by counting up from zero in binary. Let’s take an example for 192.168.100.32 subnet –  

Figure 10: Calculating the host address counting up host bits from 0 in binary

Note – the first address, in which all the host bits are zero, is the subnet address – that’s the reason it cannot be assigned to host. Another address is the last address where all the host bits are 1, this is the broadcast address in the subnet that represent to all hosts in the subnet. This is also not assigned to host. In any subnet the usable IPs are – 2n – 2; 25 - 2 = 30.

With is I take a halt, the only way to mastery the IP Addressing is to practice. A homework for you to calculate valid host for –

·        Class C IP addresses with 4 Subnet bits

·        Class C IP address with 5 Subnet Bits

Find out subnet broadcasts and network addresses as well. Happy Learning!

 

 Continue Reading...