6: Subnet Mask and Subnetting

When we understand the following rule, it will help us in the understanding of the subnetting.

Suppose that we have 1 place that we need to replace it with a binary number. What numbers can be used? The answer is ‘0’ or ‘1’, which are 2 values or (21 values), from decimal ‘0’ to decimal ‘1’.

Image1439.JPG

Suppose that we have 2 places that we need to replace it with binary number. What numbers can be used? The answer is ‘00’, ‘01’, ‘10’ or 11, which are 4 values or (22 values), from decimal ‘0’ to decimal ‘3’.

Image1447.JPG

Now, if you have 3 places… you will have 8 values (23 values), from decimal ‘0’ to decimal ‘7’.

Image1454.JPG

Therefore, what if we have 4 or 5 or…8 places?

Image1463.PNG

From the previous, we can deduce that,

Image1470.PNG

6.1 Subnet mask

Always, you will find the subnet mask information associated with any IP adderss.

The subnet mask enables you to know the network portion and host portion of any IP address.

If no subnet mask information is associated with the IP, then the default is to determine the network portion and the host portion of this IP address depending on its IP class.

The subnet mask determines the network portion and the host portion of an IP address by converting the network portion to all ones and converting the host portion to all zeros.

Therefore, for the ‘class A’ subnet mask, the first bye will be all ones and the last three bytes will be all zeros.

Class A IP subnet mask

Image1478.JPG

Class B IP subnet mask

Image1486.PNG

Class C IP subnet mask

Image1494.JPG 

6.1.1 Getting the network IP using the subnet mask

To get the network IP from any IP address, we should convert the host portion to zeros.

The theoretical method to get the network IP, is to make a logical AND operation between the IP and its subnet mask.

Image1503.PNG Figure 6.1: getting the network IP

The following illustrates the AND function,

9892.jpg Figure 6.2: the logical AND function

6.2 Subnet mask examples

Example 1

Get the network IP and the broadcast IP from the following IP and subnet mask ‘193.129.2.131/25’. In addition, get the number of available host IPs, and determine the first and the last available host IP.

Image1514.JPG 

To get the number of available host IPs, we use the following rule,

Image1525.JPG

Therefore, the number of available host IPs =

Image1532.JPG 

Example 2

Get the network IP and the broadcast IP from the following IP and subnet mask ‘130.5.192.68/26’. In addition, get the number of available host IPs, and determine the first and the last available host IP.

Image1540.JPG

The number of available host IPs=

Image1547.JPG

6.3 Subnetting

Suppose that we have one network IP and we have three networks. How we can use this only one network IP to be able to assign one network IP to every network of our networks?

The solution is to make ‘subnetting’.

6.3.1 What is subnetting?

Subnetting is to get many ‘network IPs’ from only one network IP, by changing in the network portion and the host portion in the original network IP.

6.3.2 Subnetting example 1

You have one ‘class C’ IP address (194.5.24.0), and you have two networks, every one of them has 100 computers. You should subnet this IP to fulfill your needs.

Solution:

Convert the given IP to binary formatting and determine the network portion and the host portion.

Determine how many bits you need to add to the network portion in order to have the correct number of network IPs.

Image1556.JPG

Now, you can get the new subnet mask

Image1563.JPG

Make sure you can cover the number of host IPs in every network.

Image1571.JPG

Now, you can get the subnetted network IPs.

5518.jpg

6.3.3 Subnetting example 2

You have one ‘class B’ IP address (134.18.0.0), and you have three networks, every one of them has 100 computers. You should subnet this IP to fulfill your needs.

Solution:

Convert the given IP to binary formatting and determine the network portion and the host portion.

Image1579.JPG

Determine how many bits you need to add to the network portion in order to have the correct number of network IPs.

5528.jpg

Now, you can get the new subnet mask.

Image1587.JPG

Make sure you can cover the number of host IPs in every network.

Image1596.JPG

Now, you can get the subnetted network IPs.

Image1607.JPG