Lab Activity 10 Basic Sub Netting
Lab Activity 10 Basic Sub Netting
Objectives Identify the reasons to use a subnet mask. Distinguish between a default subnet mask and a custom subnet mask. Given the requirements, determine the subnet mask, number of subnets, and hosts per subnet. Understand usable subnets and usable number of hosts. Use the ANDing process to determine whether a destination IP address is local or remote. Identify valid and invalid IP host address based on a network number and subnet mask. Background / Preparation This lab helps you understand the basics of IP subnet masks and their use with TCP/IP networks. You can use the subnet mask to split up an existing network into subnetworks or subnets. Some of the primary reasons for subnetting are as follows: Reduce the size of the broadcast domains. (Create smaller networks with less traffic.) Allow LANs in different geographical locations to communicate through routers. Provide improved security by separating 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 whether the destination host for the packet they want to send is on their own network or another network. This lab reviews the default subnet mask and then focuses on custom subnet masks, which uses more bits than the default subnet mask by borrowing these bits from the host portion of the IP address. This process creates a three-part address: The original network address The subnet address consisting of the bits borrowed The host address consisting of the bits left after borrowing some for subnets.
Step 1. Review IP address basics and default subnet masks. a. If your organization has a Class A IP network address, the first octet (8 bits) is assigned and does not change. Your organization can use the remaining 24 bits to define up to 16,777,214 hosts on your network. That 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. b. It is common for a workstation to be on one network or subnet and a server to be on another. When the workstation needs to retrieve a file from the server, it must 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 appears. Refer to Table 8-2.1 to review IP address classes, default subnet masks, and the number of networks and hosts that you can create with each class of network address.
IP Address Classes and Information 1st Octet High Order Bits 0 10 110 Network/ Host ID (N = Network, H = Host) N.H.H.H N.N.H.H N.N.N.H Default Subnet Mask Number of Networks 126 (27 2) 16,382 (214 2) 2,097,150 (221 2) Hosts per Network (Usable Addresses) 16,777,214 (224 2) 65,534 (216 2) 254 (28 2)
A B C D E
224-239 1110 Reserved for multicasting 240-254 1 1 1 1 0 Experimental; used for research *You cannot use Class A address 127 because it is reserved for loopback and diagnostic functions.
Step 2. Review the ANDing process. Hosts and routers use the ANDing process to determine whether a destination host is one the same network. The ANDing process happens each time a host wants to send a packet to another host on an IP network. To connect to a server, the host must know the IP address of the server or the host name (for example, http://www.cisco.com). If the host uses the host name, a Domain Name System (DNS) server converts it to an IP address. First, the source host compares (ANDs) 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 then compares the destination IP address to its own subnet mask. The result of the second ANDing is 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, they are on different networks or subnets, and they need to communicate through routers, or they might not be able to communicate at all. ANDing depends on the subnet mask. Subnet masks are always all ones. A default subnet mask for a Class C network is 255.255.255.0 or 11111111.11111111.11111111.00000000. The host compares this mask to the source IP address bit for bit. It compares the first bit of the IP address to the first bit of the subnet mask, the second bit to the second, and so on. If the two bits are both 1s, the ANDing result is a 1. If the two bits are a 0 and a 1 or two 0s, the ANDing result is a 0. Basically, this rule means that a combination of two 1s results in a 1, but anything else is a 0. the result of the ANDing process is the network or subnet number that the source or destination address is on. Step 3. Determine a host network using two Class C default subnet masks. This example in Figure 8-2.1 shows how you can use a Class C default subnet mask to determine which network a host is on. A default subnet mask does not break an address into subnets. If you use the default subnet mask, 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, which 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, the first three octets (24 bits) are assigned as the network address, so these are two different Class C networks. This requirement leaves one octet (8 bits) for hosts, so each Class C network can have up to 254 hosts (28 = 256 2 = 254).
Figure 8-2.1 Using a Class C default subnet mask to determine a hosts network
Source Network: 200.1.1.0 Subnet Mask: 255.255.255.0 Source Network: 200.1.2.0 Subnet Mask: 255.255.255.0
The ANDing process helps 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 by 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: Subnet Mask 255.255.255.0: ANDing Result (200.1.1.0): 11001000.00000001.00000001.00000101 11111111.11111111.11111111.00000000 11001000.00000001.00000001.00000000
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: Subnet Mask 255.255.255.0: ANDing Result (200.1.2.0): 11001000.00000001.00000010.00001000 11111111.11111111.11111111.00000000 11001000.00000001.00000010.00000000
Note: The result of Step 3b of the 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 results from Step B, and they are different. Host X now knows that Host Z is not in its 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 then repeats the ANDing process to determine which router interface to send the packet out. Step 4. Determine the host subnet using a Class C network custom subnet mask. This example uses a single Class C network address (200.1.1.0) and shows how you can use a Class C custom subnet mask 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, the first three octets (24 bits) are assigned as the network address. This requirement leaves 8 bits (one octet) for hosts, so each Class C network can have up to 254 hosts (28 = 256 2 = 254).
Perhaps you want less that 254 hosts (workstations and servers) all on one network, and you want to create two subnetworks and separate them with a router for security reasons or to reduce traffic. This setup creates smaller independent broadcast domains and can improve network performance and increase security because one or more routers will separate these subnetworks. Assume you need at least two subnetworks and at least 50 hosts per subnetwork. Because you have only one Class C network address, you have only 8 bits in the fourth octet available for a total of 254 possible hosts, so you must create a custom subnet mask. You use the custom subnet mask to borrow bits from the host portion of the address. Perform the following steps: The first step to subnetting is to determine how many subnets you need. In this case, you need two 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 need. Because you need two subnets, add the one bit and the two bit, which equals three. This number is greater than the number of subnets you need, so you need to borrow at least two bits from the host address starting from the left side of the octet that contains the host address. Table 8-2.2 provides this information. Table 8-2.2 Calculating Subnet Bits to Be Borrowed 4th Octet Host Address Bits Host Address Bit Values (from Right) 1 128 1 64 1 32 1 16 1 8 1 4 1 2 1 1
(Add bits starting from the right side [the 1 and the 2] until you get more than the number of subnets you need.) Note: An alternate way to calculate the number of bits to borrow for subnets is to take the number of bits borrowed to the power of 2. The result must be greater than the number of subnets you need. For example, if you borrow 2 bits, the calculation is 2 to the second power, which equals 4. Because the number of subnets you need is two, this result should be adequate. After you know how many bits to borrow, you take them from the left side of the host address (the fourth octet). Every bit you borrow leaves fewer bits for the hosts. Even though you increase the number of subnets, you decrease the number of hosts per subnet. Because you need to borrow two bits from the left side, you must show that new value in the subnet mask. The existing default subnet mask was 255.255.255.0, and the new, custom subnet mask is 255.255.255.192. As Table 8-2.3 indicates, the 192 results from adding the first two bits from the left (128 + 64 = 192). These bits now become 1s and are part of the overall subnet mask. This change leaves 6 bits for host IP addresses, or 26 = 64 hosts per subnet. Table 8-2.3 Determining the Custom Subnet Mask 4th Octet Borrowed Bits for Subnet Subnet Bit Values (from 1 128 1 64 1 32 1 16 1 8 1 4 1 2 1 1
Left Side) With this information, you can build Table 8-2.4. The first two bits are the subnet binary value. The last six bits are the host bits. By borrowing 2 bits from the 8 bits of the host address, you can create 4 subnets (2^2) 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 unusablebecause the 0 net has all zeros in the host portion of the address and the 192 net has all 1s in the host portion of the address. Table 8-2.4 Determining the Usable Subnets Subnet Number 0 Subnet 1st Subnet 2nd Subnet 3rd Subnet Subnet Bits Borrowed Binary Value 00 01 10 11 Subnet Bits Decimal Value 0 64 128 192 Host Bits Possible Binary Values (Range) (6 Bits) 000000 111111 000000 111111 000000 111111 000000 111111 Subnet/ Host Decimal Range 0-63 64-127 128-191 192-254 Usable?
No Yes Yes 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. Because you borrowed 2 of the 8 bits for subnets and you have 6 bits left, the number of hosts per subnet is 26 or 64. Another way to figure the number of hosts 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 the maximum number of possible combinations of 8 bits), which equals 64. This result means you start at 0 for the first network and add 64 for each additional subnetwork. If you take the second subnet (the 64 net) as an example, you cannot use the IP address of 200.1.1.64 for a host ID because it is the network ID of the 64 subnet. (The host portion is all 0s.) You cannot use the IP address of 200.1.1.127 because it is the broadcast address for the 64 net. (The host portion is all 1s.) Another common way to represent a subnet mask, is the use of the slash/number (/#) where the # following the slash is the number of bits used in the mask (network and subnet combined). As an example, a Class C network address such as 200.1.1.0 with a standard subnet mask (255.255.255.0) would be written as 200.1.1.0/24, indicating that 24 bits are used for the mask. The same network, when subnetted by using two host bits for subnets, would be written as 200.1.1.0/26. This indicates that 24 bits are used for the network and 2 bits for the subnet. This would represent a custom subnet mask of 255.255.255.192 in dotted decimal format. A Class A network of 10.0.0.0 with a standard mask (255.0.0.0) would be written as 10.0.0.0/8. If 8 bits (the next octet) were being used for subnets it would be written as 10.0.0.0/16. This would represent a custom subnet mask of 255.255.0.0 in dotted decimal format. The slash number after the network number is an abbreviated method of indicating the subnet mask being used. Step 5. Use the following information and the previous examples to answer the following subnetrelated questions. 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 four subnets, which will be interconnected by routers. You need at least 25 hosts per subnet. You need to use a Class C custom subnet mask and a router between the subnets to route packets from one subnet to another. Determine the number of bits you
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 eight possible subnets, of which six can be used.) a. Fill in Table 8-2.5 and answer the questions that follow. Table 8-2.5 Creating a Class C Custom Subnet Mask to Support at Least 25 Host per Subnet Subnet Number Subnet Bits Borrowed Binary Value Subnet Bits Decimal and Subnet Number Host Bits Possible Binary Values (Range) (5 Bits) Subnet/ Host Decimal Range Use?
0 Subnet 1st Subnet 2nd Subnet 3rd Subnet 4th Subnet 5th Subnet 6th Subnet 7th Subnet Notes _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ b. Use the information in Table 8-2.5 you just developed to help answer the following questions. 1. Which octets represent the network portion of a Class C IP address? ______________________________________________________________________________
3. What is the binary equivalent of the Class C network address in the scenario (197.15.22.0)?
Decimal network address: Binary network address: _________. _________. __________. __________. __________. __________. __________. __________.
4. How many high-order bits did you borrow from the host bits in the fourth octet? ______________________________________________________________________________ 5. What subnet mask must use? (Show the subnet mask in decimal and binary.) Decimal subnet address: Binary subnet address: _________. _________. __________. __________. __________. __________. __________. __________.
6. What is the maximum number of subnets that you can create with this subnet mask?
______________________________________________________________________________
7. What is the maximum number of usable subnets that you can create with this mask?
______________________________________________________________________________ 8. How many bits were left in the fourth octet for host IDs? ______________________________________________________________________________ 9. How many hosts per subnet can you define with this subnet mask? ______________________________________________________________________________ 10. What is the maximum number of hosts that you can define 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)? ______________________________________________________________________________
15. 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?
______________________________________________________________________________ ______________________________________________________________________________