In this lesson we will attempt to simplify the identification of the Network and Broadcast address using a known IP address, within the network or subnet, and the CIDR or Netmask. In this lesson we will walk you through the terms you need to know, the basic math and some examples.

Terms you need to know:

CIDR: Classless Inter-Domain Routing. Think of it as a replacement for a
Netmask. The CIDR Value is equivalent to the number of on bits in a 32 bit
address going left to right. For example: the CIDR value of 24 means the first
24 bits are turned on and the last 8 bits are turned off:
11111111.11111111.11111111.00000000. (See RFC’s: 1519, 1817, 4632).

Network Address (or Network ID): This is the address that identifies the
subnet of a host.

machines on a given subnet rather than a specific machine. (See RFCs: 826, 919,
922, 947, 1027, 1770, 3021).

Binary: A base 2 numbering system (machine language).

Bitwise AND Operator: Represented by the “&” symbol, the Bitwise AND
Operator returns a one in each bit position if both corresponding bits are one.
Example: x & y = z.

Binary Inversion: In a Binary CIDR or Netmask we are inverting the ones to
zeros and the zeros to ones.

Bitwise OR Operator: Represented by the “|” symbol, the Bitwise OR Operator
returns a 1 in each bit position if one or both corresponding bits are one.

The Steps to identify the Network and Broadcast Address of a Subnet

Convert the IP Address and CIDR (or Netmask) to binary.  If you need
Converting IPv4 to
Decimal and Binary IP Conversion Calculators
.

Use a Bitwise AND (IP & CIDR) Operator to return the corresponding
values of the IP and CIDR addresses. This gives you the Network Address
(Network ID)  A simple way to use the Bitwise AND Operator in Binary is
show in the following example:

Binary CIDR: 11111111.11111111.11111111.00000000

Using the Bitwise AND (&) Operator, compare the Binary IP Address to the
we are using:

Binary IP:
11000000.10101000.00000001.00001111

Binary CIDR:
11111111.11111111.11111111.00000000

Binary Network:
11000000.10101000.00000001.00000000

The resultant Network Address is 11000000.10101000.00000001.00000000.
Converting this back to the format of an IPv4 Address gives us 192.168.1.0.
This is our Network Address. Therefore, 192.168.1.15 belongs to the
192.168.1.0/24 network.

To get the Broadcast Address we need to do a Binary inversion of the CIDR or

The inversion of the CIDR Address of 11111111.11111111.11111111.00000000
becomes: 00000000.00000000.00000000.11111111.

Now we use the Bitwise OR Operator on the Binary Network Address and the

11000000.10101000.00000001.00000000

Inverted Binary CIDR:
00000000.00000000.00000000.11111111

We now convert 11000000.10101000.00000001.11111111 to IPv4 Decimal octet:
192.168.1.255.

Now that you have your feet wet, let’s try a few more.

examples:

10.10.1.97/23
192.168.0.3/25
172.16.5.34/26
192.168.11.17/28

Example one: Convert 10.10.1.97/23 to Binary.

Use Bitwise AND Operator (IP & CIDR):

00001010.00001010.00000001.01100001

11111111.11111111.11111110.00000000

Binary Inversion of CIDR:

Binary CIDR:
11111111.11111111.11111110.00000000

Inverted Binary CIDR:   00000000.00000000.00000001.11111111

Binary Network:    00001010.00001010.00000000.00000000

Inverted Binary CIDR:    00000000.00000000.00000001.11111111

IP Address 10.10.1.97/23 belongs to the 10.10.0.0/23 Network. The network

Example two: Convert 192.168.0.3/25 to Binary.

Use Bitwise AND Operator (IP & CIDR):

IP:
11000000.10101000.00000000.00000011

CIDR:
11111111.11111111.11111111.10000000

Network:     11000000.10101000.00000000.00000000

Binary Inversion of CIDR:

Binary CIDR:
11111111.11111111.11111111.10000000

Inverted Binary CIDR:   00000000.00000000.00000000.01111111

Binary Network:    11000000.10101000.00000000.00000000

Inverted Binary CIDR:    00000000.00000000.00000000.01111111

IP Address 192.168.0.3/25 belongs to the 192.168.0.0/25 Network. The network

Example three: Convert 172.16.5.34/26 to Binary.

Use Bitwise AND Operator (IP & CIDR):

IP:
10101100.00010000.00000101.00100010

CIDR:
11111111.11111111.11111111.11000000

Network:     10101100.00010000.00000101.00000000

Binary Inversion of CIDR:

Binary CIDR:
11111111.11111111.11111111.11000000

Inverted Binary CIDR:   00000000.00000000.00000000.00111111

Binary Network:    10101100.00010000.00000101.00000000

Inverted Binary CIDR:    00000000.00000000.00000000.00111111

IP Address 172.16.5.34/26 belongs to the 172.16.5.0/26 Network. The network

Example four: Convert 192.168.11.17/28 to Binary.

Use Bitwise AND Operator (IP & CIDR):

IP:
11000000.10101000.00001011.00010001

CIDR:
11111111.11111111.11111111.11110000

Network:     11000000.10101000.00001011.00010000

Binary Inversion of CIDR:

Binary CIDR:
11111111.11111111.11111111.11110000

Inverted Binary CIDR:   00000000.00000000.00000000.00001111

Binary Network:    11000000.10101000.00001011.00010000

Inverted Binary CIDR:    00000000.00000000.00000000.00001111

IP Address 192.168.11.17/28 belongs to the 192.168.11.16/28 Network.