| Lab 10.6.6 Subnet Mask 1 Estimated time: 45 min. Objectives: This Lab will focus on Class C subnet masks and your ability to accomplish the following tasks: Cite some reasons why a subnet mask would be needed Distinguish between a Default Subnet Mask and a Custom Subnet Mask Determine the subnets available with a particular IP network address and Subnet mask Given a network address and requirements for how many subnets and hosts, be able to determine what subnet mask should be used Given a network address and a subnet mask, be able to determine the number of subnets and host per subnet that can be created as well as useable subnets and useable number of hosts Use the "ANDing" process to determine if a destination IP address is Local or Remote Identify valid and invalid IP host address based on a given a Network number and subnet mask Background: This lab will help you understand the basics of IP subnet masks and their use with TCP/IP networks. The subnet mask can be used to split up an existing network into "subnetworks" or "subnets". This may be done to 1) reduce the size of the broadcast domains (create smaller networks with less traffic), 2) to allow LANs in different geographical locations to communicate or 3) for security reason to separate one LAN from another. Routers separate subnets and the router determines when a packet can go from one subnet to another. Each router a packet goes through is considered a "hop". Subnet masks help workstations, servers and routers in an IP network determine if the destination host for the packet they the want to send is on their own network or another network. Default subnet masks were discussed in a prior lab. This Lab will review the Default Subnet Mask and then focus on Custom Subnet Masks which will use more bits than the default subnet mask by "borrowing" these bits from the host portion of the IP address. This creates a three-part address; 1) The original network address assigned, 2) The subnet address made up of the bits borrowed and 3) the host address made up of the bits left after borrowing some for subnets. Tools / Preparation: This is primarily a written lab exercise but you may want to use Control Panel / Network to review some real network IP addresses. The following resources will be required. PC workstation with Windows operating system (Win 95, 98, NT or 2000) installed on the PC and access to the Windows Calculator. Notes: Step 1 – IP Address Basics. Explanation: IP network addresses are assigned by the Internet Network Information Center (InterNIC). If your organization has a class "A" IP network address, the first octet (8 bits) is assigned be InterNIC and your organization can use the remaining 24 bits to define up to 16,777,214 hosts on your network. This is a lot of hosts! It is not possible to put all of these hosts on one physical network without separating them with routers and subnets. A workstation may be on one network or subnet and a server may be on another network or subnet. When the workstation needs to retrieve a file from the server it will need to use its subnet mask to determine the network or subnet that the server is on. The purpose of a subnet mask is to help hosts and routers determine the network location where a destination host can be found. Refer to the following table to review IP address classes, default subnet masks and the number of networks and hosts that can be created with each class of network address.
Cls | 1st Octet Decimal Range | 1st Octet High Order Bits | Network / Host ID (N=Network, H=Host) | Default Subnet Mask | Number of Networks | Hosts per Network (usable addresses)
A | 1 – 126* | 0 | N.H.H.H | 255.0.0.0 | 126 (27 – 2) | 16,777,214 (2 24 – 2)
B | 128 – 191 | 1 0 | N.N.H.H | 255.255.0.0 | 16,382 (214 - 2) | 65,534 (2 16 – 2)
C | 192 – 223 | 1 1 0 | N.N.N.H | 255.255.255.0 | 2,097,150 (221 – 2) | 254 (2 8 – 2)
D | 224 – 239 | 1 1 1 0 | Reserved for Multicasting
E | 240 – 254 | 1 1 1 1 0 | Experimental, used for research
> > Step 2 – The "ANDing" process. Explanation: Hosts and routers use the "ANDing" process to determine if a destination host is on the same network or not. The ANDing process is done each time a host wants to send a packet to another host on an IP network. If you want to connect to a server, you may know the IP address of the server you want to connect to or you may just enter the host name (e.g. www.cisco.com) and a Domain Name Server (DNS) will convert the host name to an IP address. First the source host will compare (AND) its own IP address to its own subnet mask. The result of the ANDing is to identify the network where the source host resides. It will then compare the destination IP address to its own subnet mask. The result of the 2 nd ANDing will be the network that the destination host is on. If the source network address and the destination network address are the same they can communicate directly. If the results are different then they are on different networks or subnets and will need to communicate through routers or may not be able to communicate at all. ANDing depends on the subnet mask. A default subnet mask for a Class C network is 255.255.255.0 or 11111111.111111111.111111111.00000000. This is compared to the source IP address bit for bit. The first bit of the IP address is compared to the first bit of the subnet mask and the second bit to the second etc. If the two bits are both ones, then the ANDing result is a ONE. If the two bits are a zero and a one or two zeros then the ANDing result is a ZERO. Basically this means that a combination of 2 ones results in a ONE, anything else is a zero. The result of the ANDing process is the network or subnet number that the source or destination address is on. Step 3 – Two Class C networks using the default subnet mask. Explanation: This example will show how a Class C default subnet mask can be used to determine which network a host is on. A default subnet mask does not break an address into subnets. If the default subnet mask is used then the network is not being "subnetted". Host X (source) on network 200.1.1.0 has an IP address of 200.1.1.5 and wants to send a packet to host Z (destination) on network 200.1.2.0 and has an IP address of 200.1.2.8. All hosts on each network are connected to hubs or switches and then to a router. Remember that with a Class C network address ARIN assigns the first 3 octets (24 bits) as the network address so these are two different class C networks. This leaves one octet (8 bits) for hosts so each class C network could have up to 254 hosts (2^8 power = 256 – 2 = 254). The ANDing process will help the packet get from host 200.1.1.5 on network 200.1.1.0 to host 200.1.2.8 on network 200.1.2.0 using the following steps. Host X compares its own IP address to its own subnet mask using the ANDing process
> > Host X IP address 200.1.1.5 | 11001000.00000001.00000001.00000101
> > Subnet Mask 255.255.255.0 | 11111111.11111111.11111111.00000000
> > ANDing Result (200.1.1.0) | 11001000.00000001.00000001.00000000
2. NOTE: The result of step 3a of the ANDing process is the network address of host X which is 200.1.1.0 Next host X compares the IP address of the Host Z destination to its own subnet mask using the ANDing process.
   Host Z IP address 200.1.2.8 | 11001000.00000001.00000010.00001000
   Subnet Mask 255.255.255.0 | 11111111.11111111.11111111.00000000
   ANDing Result (200.1.2.0) | 11001000.00000001.00000010.00000000
> NOTE: The result of step3b ANDing process is the network address of host Z which is 200.1.2.0. Host X compares the ANDing results from step A and the ANDing result from step B and they are different. Host X now knows that host Z is not in its Local Area Network (LAN) and it must send the packet to its "Default Gateway" which is the IP address of the router interface of 200.1.1.1 on network 200.1.1.0. The router will then repeat the ANDing process to determine which router interface to send the packet out. Step 4 – One Class C network using a Custom subnet mask. Explanation: This example uses a single Class C network address (200.1.1.0) and will show how a class C custom subnet mask can be used to determine which subnetwork (or subnet) a host is on and to route packets from one subnetwork to another. Remember that with a class C network address ARIN assigns the first 3 octets (24 bits) as the network address. This leaves 8 bits (one octet) for hosts so each class C network could have up to 254 hosts (2^8 power = 256 – 2 = 254). Perhaps you want less than 254 host (workstations and servers) all on one network and you want to create 2 sub-networks and separate them with a router for security reason or to reduce traffic. This will create smaller independent broadcast domains and can improve network performance and increase security since these subnetworks will be separated by a router. Assume you will need at least 2 subnetworks and at least 50 hosts per subnetwork. Since you only have one Class C network address you have only 8 bits in the fourth octet available for a total of 254 possible hosts, you must create a Custom Subnet mask. You will use the custom subnet mask to "BORROW" bits from the host portion of the address. The following steps will help accomplish this: The first step to "subnetting" is to determine how many subnets are needed. In this case you will need 2 subnetworks. To see how many bits you should borrow from the host portion of the network address, add the bit values from right to left until the total is equal to or greater than the number of subnets you will need. Since we need 2 subnets, add the one bit and the two bit which equals three. This is over the number of subnets we need, so we will need to borrow at least two bits from the host address starting from the left side of the octet that contains the host address.
> Network address: 200.1.1.0 |  |  |  |  |  |  |  |
> 4th octet Host address bits:
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1
Host address bit values (from right)
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1

(Add bits starting from the right side (the 1 and the 2) until you get more than the number of subnets needed)

2. Once we know how many bits to borrow we take them from the left side of the first octet of the host address. Every bit we borrow from the host leaves fewer bits for the hosts. Even though we increase the number of subnets, we decrease the number of hosts per subnet. Since we need to borrow 2 bits from the left side, we must show that new value in our subnet mask. Our existing default subnet mask was 255.255.255.0 and our new "Custom" subnet mask is 255.255.255.192. The 192 comes from the value of the first two bits from the left (128 + 64 = 192). These bits now become 1s and are part of the overall subnet mask. This leaves 6 bits for host IP addresses or 2^6 = 64 hosts per subnet.

   4th Octet borrowed bits for subnet:

   1 1 1 1 1 1 1 1
   Subnet bit values: (from left side)
   128 64 32 16 8 4 2 1

> With this information you can build the following table. The first two bits are the Subnet binary value. The last 6 bits are the host bits. By borrowing 2 bits from the 8 bits of the host address you can create 4 subnets with 64 hosts each. The 4 networks created are the "0" net, the "64" net, the "128" net and the "192" net. The "0" net and the "192" net are considered unusable. This is because the "0" net has all zeros in the subnet portion of the address and the 192 net has all ones in the subnet portion of the address.

> Subnet No. | Subnet bits borrowed Binary value | Subnet bits Decimal Value | Host bits possible binary values (range) (6 bits) | Subnet / Host Decimal range | Useable?
> Subnet #0 | 00 | 0 | 000000 – 111111 | 0 – 63 | NO
> Subnet #1 | 01 |  | 64 000000 – 111111 | 64 – 127 | YES
> Subnet #2 | 10 |  | 128 000000 – 111111 | 128 – 191 | YES
> Subnet #3 | 11 |  | 192 000000 – 111111 | 192 – 254 | NO

> Notice that the first subnet always starts at 0 and, in this case, increases by 64 which is the number of hosts on each subnet. One way to determine the number of hosts on each subnet or the start of each subnet is to take the remaining host bits to the power of 2. Since we borrowed two of the 8 bits for subnets and have six bits left, the number of hosts per subnet is 2^6 or 64. Another way to figure the number of host per subnet or the "increment" from one subnet to the next is to subtract the subnet mask value in decimal (192 in the fourth octet) from 256 (which is maximum number of possible combinations of 8 bits) which equals 64. This means you start at 0 for the first network and add 64 for each additional subnetwork. If we take the second subnet (the 64 net) as an example the IP address of 200.1.1.64 cannot be used for a host ID because it is the "network ID" of the "64" subnet (host portion is all zeros) and the IP address of 200.1.1.127 cannot be used because it is the broadcast address for the 64 net (host portion is all ones).

Step

5 – One C lass C network using a C ustom Subnet Mask.

> Task:

Use the following information and the previous examples to answer the following subnet related questions.

Explanation:

Your company has applied for and received a Class C network address of 197.15.22.0. You want to subdivide your physical network into 4 subnets, which will be interconnected by routers. You will need at least 25 hosts per subnet. You will need to use a Class C custom subnet mask and will have a router between the subnets to route packet from one subnet to another. Determine the number of bits you will need to borrow from the host portion of the network address and then the number of bits left for host addresses. (Hint: There will be 8 subnets)

1. Fill in the table below and answer the following questions:

Subnet No. | Subnet bits borrowed Binary value | Subnet bits Decimal & Subnet No. | Host bits possible binary values (range) (6 bits) | Subnet / Host Decimal range | Use?
Subnet #0 |  |  |  |  |
Subnet #1 |  |  |  |  |
Subnet #2 |  |  |  |  |
Subnet #3 |  |  |  |  |
Subnet #4 |  |  |  |  |
Subnet #5 |  |  |  |  |
Subnet #6 |  |  |  |  |
Subnet #7 |  |  |  |  |

> Notes:

> QUESTIONS: Use the table you just developed above to help answer the following questions:

> 2. Which octet(s) represent the network portion of a Class C IP address? _______________
> 3. Which octet(s) represent the host portion of a Class C IP address? _________________
> 4. What is the binary equivalent of the Class C network address in the scenario (197.15.22.0)? Decimal Network address: __________ . __________ . __________ . __________ Binary Network address: __________ . __________ . __________ . __________
> 5. How many high-order bits were borrowed from the host bits in the fourth octet? _____
> 6. What subnet mask must you use (show the subnet mask in decimal and binary)?
>    Decimal Subnet mask: __________ . __________ . __________ . __________
>    Binary subnet mask: __________ . __________ . __________ . __________
> 7. What is the maximum number of subnets that can be created with this subnet mask? _____
> 8. What is the maximum number of useable subnets that can be created with this mask? ____
> 9. How many bits were left in the 4
> th octet for host IDs ? ______
> - How many hosts per subnet can be defined with this subnet mask? _____________
> - What is the maximum number of hosts that can be defined for all subnets with this scenario (assuming you cannot use the lowest and highest subnet numbers and cannot use the lowest and highest host ID on each subnet) ? _____________________________________________
> - Is 197.15.22.63 a valid host IP address with this scenario? ____________
> - Why or why not ? _____________________________________________________________
> - Is 197.15.22.160 a valid host IP address with this scenario? ______
> - Why or why not ? _____________________________________________________________
> - Host "A" has an IP address of 197.15.22.126. Host "B" has an IP address of 197.15.22.129. Are these hosts on the same subnet? ______ Why? ________________________________ ___________________________________________________________________________