In every network, the first and the last IP addresses are not assigned to any host. The first IP address is called the network address and the last IP address is called the broadcast address.

The network address is a unique address to identify the network portion of the IP network. The network address is the same for all the hosts within the same IP network. All the bits of the host portion in an IP address are set to zero to identify as the network address of any IP network.

 192.168.5.50 —> 11000000.10101000.00000101.00000000  (Network) 255.255.255.0->  11111111.11111111.11111111.00000000 (Mask) [ All ones represent the network portion and all zeroes represent the host portion] Network address will be 192.168.5.0/24

The Broadcast Address is the last address of an IP network. It is used to address all the nodes at the same time. The IP packet with a broadcast address is sent to all the nodes across the network. All the bits of the host portion in an IP address is set to one to identify as the broadcast address.

 192.168.5.50 —> 11000000.10101000.00000101.11111111  (Broadcast) 255.255.255.0->  11111111.11111111.11111111.00000000 (Mask)[ All ones represent the network portion and all zeroes represent the host portion] The broadcast will be 192.168.5.255/24

Network ID = 10.0.0.0

For Class B address : 150.100.0.0/16

Network ID = 150.100.0.0

Network ID = 200.100.100.0

## Decimal to Binary  Conversion and vice versa

To convert the decimal number into binary numbers,

• Divide the decimal number by 2.
• Store the remainder ( either 0 or 1) repeatedly until the decimal number is completely divisible by 2.
• Note down the series of the remainder in 1 or 0 in reverse order.

For Example: Convert (50)10 into binary format

 Division by 2 Remainder 50/2 = 25 0 25/2 = 12 1 12/2 = 6 0 6/2 =3 0 3/2 = 1 1 1/2 =0 1

Writing the remainder in reverse order, we get (110010)2

Since, IP address is represented in a block of 8 bits,

(110010)2 is written as (00110010)2

Hence, (50)10 = (00110010)2

To convert binary into decimal format

• Multiply the binary number with the binary exponential of its place value.
• Add them all to give the decimal number.

For example, to convert (00110010) into decimal format

 Binary Exponents 27 = 128 26 = 64 25 = 32 24 = 16 23 = 8 22 = 4 21 = 2 20 = 1 Binary Number 0 0 1 1 0 0 1 0 128 x 0 64 x 0 32 x 1 16 x 1 8 x 0 4 x 0 2 x 1 1 x 0 Decimal Number 0 + 0 + 32 + 16 + 0 + 0 + 2 + 0 = (50)10

Hence, the decimal equivalent of a binary number  (00110010)2  is  (50)10.

As you have seen, it is easier to calculate the network and broadcast id of a classful address with default subnet  But, the IP address with CIDR notation or variable subnet mask, you need a bit of mathematical calculation. There are different methods of calculating network id and broadcast id, however, using with logical ANDing and  ORing operation is more reliable and accurate.

The logical ANDing and ORing method is performed between Network and broadcast ID by comparing the IP address and the subnet mask. ANDing operation is done to calculate the network address and the ORing method is used to calculate the Broadcast address.

Let us understand it with the help of an example.

Here, /28 ( read as slash 28) is the CIDR ( Classless Inter-Domain Routing) notation. The number after the slash (/) is the number of network bits. By changing the network bits, you will have different subnet masks. We will discuss the CIDR and subnetting concepts in the coming articles.

The following steps will illustrate how to calculate the network ID and the broadcast ID.

### To calculate the network address

Step1: Write the given IP address in binary format.

Step 2: Write the subnet mask in binary form.

Step: Perform the logical  ANDing operation between the corresponding octets of the IP address and the subnet mask.

Step 4: Convert the result back to the decimal format and this will be the network address.

The following example illustrates the calculation of the network address.

Therefore the network address will be: 192.168.5.48

Step1: Write the given IP address in binary format.

Step 2: Write the inverse of the subnet mask in binary form.

Step: Perform the logical  ORing operation between the corresponding octets of the IP address and the inverse of the subnet mask.

Step 4: Convert the result back to the decimal format and this will be the network address.

Therefore, the network address will be: 192.168.5.63

Note:   In the above example, a subnet mask is shown in slash (/) notation or Network Prefix. The number shown after the slash is the number of network bits. In classful addressing, the number of network bits is fixed for each class. For Class A, it 8; for Class B – 16 and Class C -24 respectively, However, the network bits can be varied as per the requirement of the host in a network. In such a case, slash notation is termed as

CIDR notation is introduced by IETF (Internet Engineering Task Force) in 1993 to denote the subnetted network in a simpler format. The subnetting is introduced to control the rapid exhaustion of IP v4 addresses using classful addresses. In subnetting, network bits are varied according to the subnets required or the host requirement in each subnet> Hence, it is easier to denote subnetwork addresses and their mask in CIDR notation.

The following tables show the subnet masks their corresponding CIDR values.

 Subnet Mask CIDR Value 255.0.0.0 /8 255.128.0.0 /9 255.192.0.0 /10 255.224.0.0 /11 255.240.0.0 /12 255.248.0.0 /13 255.252.0.0 /14 255.254.0.0 /15 255.255.0.0 /16 255.255.128.0 /17 255.255.192.0 /18 255.255.224.0 /19 255.255.240.0 /20 255.255.248.0 /21 255.255.252.0 /22 255.255.254.0 /23 255.255.255.0 /24 255.255.255.128 /25 255.255.255.192 /26 255.255.255.224 /27 255.255.255.240 /28 255.255.255.248 /29 255.255.255.252 /30

Remember: Subnet mask /31 and /32 cannot be assigned to any network. Because we need at least two IP addresses to connect two devices in a network.

Also look into the related topics: