|
|
|
 |
 |
 |
 |
 |
 |
|
|
|
|
|

Internetworking Basics |
|
|
|
|
|
 |
 |
|
 |
| |
Chapter 10
Subnets
These notes guide you through understanding subnetting.
Introduction
Subnetting
Subnets and Subnet Masks
Example 1: Creating 2 Subnets
Example 2: Creating 6 Subnets
Calculating the Number of Subnets
Calculating a Subnet Address
Subnet Summary Table
Summary
| |
| |
Introduction
For small LAN's, the administration of the network may be fairly uncomplicated. However, administering larger networks may be more complicated than you would like. Even a small Class C network with 254 hosts, may be difficult to administer.
For example, suppose an organization contains various departments such as Admin, Payroll, Executive, Design, Research but each department requires access to different network resources. Perhaps Design require specialized software and privileged access to web servers, whereas Research requires Internet access but other departments are denied this and Payroll needs to isolated from all other departments. To control each host's access to specific resources can be tricky.
Now, every computer on a TCP/IP network needs a unique IP address in order to communicate. Suppose it was possible to group the different departments such that a different groups of IP address could be used for each separate department. Then access to resources could be made dependant on the IP address group a host is in, making administration easier.
One way of assigning different IP address groups to each department mentioned above would be to purchase five Class C network addresses, one for each department. However, this would be costly and wasteful if say each department contained 50 hosts (250 in total). It would be much more efficient to purchase one Class C network address and then find a way to divide up the 254 host addresses into five separate groups, one for each department. Well, actually, this is quite possible - the subdividing of a network address into smaller IP address groups is called subnetting.
|
| |
Subnetting
Subnetting is extremely useful for dividing a network into smaller more manageable individual LAN segments. If you have a small network, you may not feel it is necessary to subdivide a network, but with a large 'Class B' or 'Class A' network you almost certainly will. Subdividing a network has many advantages; it can make the network easier to administer, security can be improved and network bandwidth can be increased.
As an example of subnetting, suppose I have a LAN with Class C network address 192.168.2.0. Perhaps I could divide the network into two subnets, where hosts on the the first subnet are allocated IP address say from 65 to 126 and hosts on the the second subnet are allocated IP address from 129 to 190. This is shown in the diagram below:-

Alternatively I could divide the network into say six subnets where hosts on the the first subnet are allocated IP address from 33 to 62, hosts on the the second subnet are allocated IP address from 65 to 94 and host on the third subnet are allocated IP addresses from 97 to 126, and so on. This is shown in the diagram below:-

With a Class C network, I could increase the number of subnets up to 62 if I desired, with 2 hosts in each subnet; the choice is mine. So, the next question to ask is - how do devices on the network know how many subnets I have decided to have?
Well, the answer is - the number of subnets on a network can be worked out from the subnet mask.
|
| |
Subnets and Subnet Masks
To explore the method for creating subnets, lets see how to divide a Class C network into two subnets first and then into six subnets. You may recall that for a Class C network address the hosts are identified using the last octet of IP address, i.e.
| Class C: |
Network |
Network |
Network |
Host |
~~Example 1: Creating 2 subnets~~
Suppose my network address is 192.168.2.0. Then hosts on my network can been assigned a host address ranging from 1 to 254 (00000001 to 11111110). The numbers 00000000 and 11111111 cannot be used as host addresses. To subdivide this network into two, I could borrow 2 bits from the last octet - the host part of the address - and use them for subnetting.
The possibilities are:-
| Subnet 1 |
01000000 |
Hosts with the first 2 bits starting with 01 could be regarded as being in Subnet 1. This means hosts with addresses from 01000001 to 011111110, (65 to 126)
|
| Subnet 2 |
10000000 |
Hosts with the first 2 bits starting with 10 could be regarded as being in Subnet 2 . This means hosts with addresses from from 10000001 to 10111110, (129 to 190) |
| Subnet ? |
00000000 |
Cannot use the 00 combination to subnet since this might be confused with the network address |
| Subnet ? |
11000000 |
Cannot use the 11 combination to subnet since this might be confused with the broadcast address |
So, by borrowing 2 bits from the host part of the network address, I can create four subnets, two of which are useable, two which aren't.
For each useable subnet, I can allocate 62 hosts with an IP address starting with 01 and declare them as being in Subnet 1. Another 62 hosts can be allocated an IP address starting with 10 and can be declared as being in Subnet 2. Of course, I by doing this, I end up with 2 subnets, each containing up to 62 hosts, making a total of 124 hosts. This is less than the 254 hosts I could have if I didn't subnet, but it is worth it in terms of increased security, improvement in network bandwidth and ease of administration.
To ensure all devices on my network understand that the network is subnetted, I shall change the default subnet mask of 11111111.11111111.11111111.00000000 (255.255.255.0) for my Class C network. Since I am borrowing the first 2 bits of the host address to define each subnet address, the first two bits of the subnet mask can be changed as follows:
11111111.11111111.11111111.11000000 (255.255.255. 192)
So, the rules for creating two useable subnets can be summarized as:
- Borrow 2 bits from the host part of the network address for the subnet addresses.
- Change the equivalent 2 bits of the subnet mask to 1's.
~~Example 2: Creating 6 subnets ~~
Suppose my network address is 192.168.2.0 and I wish to subdivide this network into six. I could borrow 3 bits from the last octet - the host part of the address - and use them for subnetting.
The possibilities are:-
| Subnet 1 |
00100000 |
Hosts with the first 3 bits starting with 001 could be regarded as being in Subnet 1. This means hosts with addresses from 00100001 to 001111110, (33 to 62)
|
| Subnet 2 |
01000000 |
Hosts with the first 3 bits starting with 010 could be regarded as being in Subnet 2. This means hosts with addresses from 01000001 to 010111110, (65 to 94) |
| Subnet 3 |
01100000 |
Hosts with the first 3 bits starting with 011 could be regarded as being in Subnet 3. This means hosts with addresses from 01100001 to 01111110, (97 to 126) |
| Subnet 4 |
10000000 |
Hosts with the first 3 bits starting with 100 could be regarded as being in Subnet 4 . This means hosts with addresses from 10000001 to 10011110, (129 to 158) |
| Subnet 5 |
10100000 |
Hosts with the first 3 bits starting with 101 could be regarded as being in Subnet 5. This means hosts with addresses from 10100001 to 10111110, (161 to 190) |
| Subnet 6 |
11000000 |
Hosts with the first 3 bits starting with 110 could be regarded as being in Subnet 6. This means hosts with addresses from 11000001 to 11011110, (193 to 222) |
| Subnet ? |
00000000 |
Cannot use the 00 combination to subnet since this might be confused with the network address |
| Subnet ? |
11100000 |
Cannot use the 11 combination to subnet since this might be confused with the network address |
So, by borrowing 3 bits from the host part of the network address, I can create eight subnets, six of which are useable, two which aren't.
For each useable subnet, I can allocate 30 hosts with an IP address starting with 001 and declare them as being in Subnet 1. Another 64 hosts can be allocated an IP address starting with 010 and can be declared as being in Subnet 2, and so on. Of course, I by doing this, I end up with 6 subnets, each containing up to 30 hosts, making a total of 180 hosts. This is less than the 254 hosts I could have if I didn't subnet, but it is worth it in terms of increased security, improvement in network bandwidth and ease of administration.
To ensure all devices on my network understand that the network is subnetted, I shall change the default subnet mask of 11111111.11111111.11111111.00000000 (255.255.255.0) for my Class C network. Since I am borrowing the first 3 bits of the host address to define each subnet address, the first three bits of the subnet mask can be changed as follows:
11111111.11111111.11111111.11100000 (255.255.255. 224)
So, the rules for creating six useable subnets can be summarized as:
- Borrow 3 bits from the host part of the network address for the subnet addresses.
- Change the equivalent 3 bits of the subnet mask to 1's.
Both examples above, used Class C network addresses. You should note that bits can be borrowed from the host parts of Class A and Class B network addresses too. You should also note that the number of bits that are borrowed from the host part of an IP address actually determine the number of subnets you can have, as the next section explains.
~Now try the activity~
| Activity A |
- Specify the subnet mask if each network below is divided into 4 subnets with 2 of the subnets useable.
120.0.0.0
140.64.0.0
- Specify the subnet mask if each network below is divided into into 8 subnets with 6 of the subnets useable.
120.0.0.0
140.64.0.0
You can check your answers here
|
|
| |
Calculating the Number of Subnets
If 2 bits are borrowed from the host part, 2 subnets can be created. If 3 bits are borrowed from the host part, 6 subnets can be created. If 4 bits are borrowed from the host part, 14 subnets can be created. The formula for calculating the number of subnets is:-
2n - 2 --> where n is the number of bits borrowed.
As an example, given the subnet mask of 255.255.255.192, I can work out that 2 bits have been borrowed for subnetting, since 192 in binary is 11000000. So the number of subnets possible are 22 - 2 = 2.
~Now try the activity~
| Activity B |
- For each subnet mask calculate the number of useable subnets possible
- Subnet Mask:
255.255.255.224
- Subnet Mask:
255.255.255.240
- Subnet Mask:
255.255.248.0
You can check your answers here
- Now try the flip card activity on subnetting.
|
|
| |
Calculating a Subnet Address
When a network is divided into subnets, each subnet has a subnet address and subnet broadcast address. We have seen how a network can be divided into 2 useable subnets by borrowing 2 bits of the host part of a network address. Hosts in the first subnet have host addresses like 01XXXXXX and hosts in the second subnet have host addresses like 10XXXXXX. So the subnet and subnet broadcast addresses are:-
| Subnet |
Subnet Address |
Subnet Broadcast Address |
| 01XXXXXX |
01000000 |
01111111 |
| 10XXXXXX |
10000000 |
10111111 |
For the subnet address, each unborrowed bit of the host part is set to 0 - similar to a network adddress. For the broadcast address, each unborrowed bit of the host apart is set to 1.
Now suppose you are given an IP address and subnet mask and need to calculate the subnet address. Take the IP address 200.200.4.37 for example. You know this is a Class C address, with a standard subnet mask of 255.255.255.0. If a different subnet mask is specified, such as 255.255.255.240 then you can be sure the host is on a subnet. Now all you have to do is work out that subnet address.
Given a specific host IP address and subnet mask, you can perform a Boolean AND operation to calculate the subnet address for that host. Here is the example again:-
IP Address: 200.200.4.37
Subnet Mask: 255.255.255.240
Try working out the number of subnets first?
Since 240 in binary is 11110000 then we can see that 4 bits have been borrowed for subnetting. Using the formula 2n - 2, this means that this network has been divided into 14 different subnets. Now we need to calculate the specific subnet this particular host is on.
Using a Boolean AND operation, can work out the subnet address?
|
in decimal |
in binary |
IP Address |
200.200.4.37 |
11001000.11001000.00000100.00100101
|
| Subnet Mask |
255.255.255.240 |
11111111.11111111.11111111.11110000 |
| |
|
AND |
| Subnet Address |
200.200.4.32 |
11001000.11001000.00000100.00100000 |
So the host with IP address 200.200.4.37 is on subnet 200.200.4.32. This is shown in the diagram below:-

~Now try the activity~
| Activity C |
- Calculate the subnet address for each host given below
- IP Address:
200.100.2.68
Subnet Mask: 255.255.255.224
- IP Address:
130.40.85.3
Subnet Mask: 255.255.240.0
- IP Address:
113.203.2.3
Subnet Mask: 255.248.0.0
You can check your answers here
|
|
| |
Subnet Summary Table
The table below specifies the number of subnets and hosts possible for each Class of network address, when bits are borrowed from the host part of a network address.
| Host Octet Decimal Notation |
Number of Useable Subnets |
Class A
Number of hosts per subnet |
Class B
Number of hosts per subnet |
Class C
Number of hosts per subnet |
| .192 |
2 |
4,194,302 |
16,382 |
62 |
| .224 |
6 |
2,097,150 |
8,190 |
30 |
| .240 |
14 |
1,048,574 |
4,094 |
14 |
| .248 |
30 |
524,286 |
2,046 |
6 |
| .252 |
62 |
262,142 |
1,022 |
2 |
| .254 |
126 |
131,070 |
510 |
- |
| .255 |
254 |
65,534 |
254 |
- |
~Now try the activity~
| Activity D |
-
A network needs to be divided into subnets.Two separate subnets are required to contain up to 50 hosts each. Two other subnets will contain up to 25 hosts each. To allow for expansion, another subnet may be needed containing 25 to 50 hosts.
- You are required to choose a suitable IP Address Class for this network and specify how you will subnet the network. A private IP network address range can be used.
- Now choose a suitable IP Address Class for this network and specify how you will subnet the network using a public IP network address. Hint: Class A addresses are the most expensive, Class C are the least.
You can check your answers here |
|
|
| |
Summary
On completing these notes you should:-
- Understand the importance of subnetting for easing network administration, increasing bandwidth and aiding with security.
- Be able to calculate the number of subnets on a network given an IP address or class and a subnet mask
- Be able to calculate a subnet address given a host address and subnet mask
- Be able to design simple networks that include subnets.
|
 |
|
 |
|
 |
|
 |
|
| |
|
|

|