Show
Before we discuss how to implement it it is useful to understand why and when we need to do it and to do that we are first going to work through a simple analogy to illustrate the problem subnetting solves Subnetting AnalogyAs an analogy imagine a school and we need to split it into class rooms. But why split it into class rooms? The answer is to stop classes interfering with one another. Now each classroom has a desk with a computer and we have been tasked with creating a labeling system for the computers. Now say we have 30 classrooms each with a maximum of 30 students and computers. If we assign numbers to our classrooms and computers then we could have for example: computer 11, classroom 24 We need two digits for the classroom which would allow for a maximum of 100 classrooms (0-99). We need two digits for the computer which would allow for a maximum of 100 computers (0-99). If we also say that classroom numbers 0 and 99 and computer numbers 0 and 99 were reserved and not allowed to be assigned then we now have a maximum of 98 classrooms and 98 computers which is enough for own requirements. So lets create our label we could use the following scheme:
There are many possible permutations we just need to pick one and tell every one about out labeling scheme. Lets assume we go for 2411 where 24 is the classroom and 11 is the computer. So now when we see the following 0223 we now know that this refers to classroom 2 and computer 23. This we do easily in our heads once we know the labelling scheme. We could even make it easier for ourselves by creating a paper mask that we put over the label that would reveal the classroom. IP Addresses and SubnettingJust like in our classroom example an IP address is split into two components a network component and a node component. So the address 10.0.2.1 is split into Network plus Node. So is the network number 10, or 10.2 or 10.0.2 ? In early IPv4 networks address classes were used to identify the number of bytes allocated to the network component. The main classes were class A,B,C. With the allocation as follows: Class A network,node,node,node To determine the class you needed to examine the most significant byte (far left).
IP Subnetting- Problems with Large NetworksAll modern networks use the Ethernet data link protocol. Ethernet uses a shared media and is negatively effected when a large number of nodes are connected to the same media. This is just the same as having too many kids in the same classroom. You can equate a network and node address to our classroom and desk number What would happen if you had a classroom with 100’s of desks i.e. hundreds of pupils? So even though a Class A address can accommodate thousands of nodes it it totally impractical to put this many nodes on a single network. The solution to the problem was to split the network into small networks called sub networks or subnets. Take for example a class A address which uses 1 byte for the network ID and 3 bytes for the Node ID. Written Net.Node.Node.Node It is important to understand that the network part of the address is only used for routing IP packets on the public internet. Once the packet enters the private network then the Node address is used and the public Network address is not used. Now a network administrator can interpret the node address any way they want, and so it is possible to split the node address into subnet and Node. So we could have Net.Subnet.Node.Node or Net.Subnet.Subnet.Node. The technique used to create subnets is to use a Mask. The mask effectively hides the Node component and leaves the network and sub network components. If the IP address was printed on paper we could hide the last byte by placing a paper mask over the number with three holes. Note: if your binary is a little rusty see the binary numbers tutorial To do this on a computer we use a number which we then logically AND with with IP address. Here is the logic table for AND 1 and 1 =1 So our mask to hide the last byte is 255.255.255.0 As 0 and Anything is always 0 The best way to see this is to write the numbers out in binary 000001011.00000001.00000001.00010101
= 11.1.1.21 and then do a logical AND the Network address is 11.1.1.0 which corresponds to network 11 subnet 1.1 The Subnet mask determines how the IPv4 address is split. Th example above used a class A IP address we can do the same with a class B address. Net.Net.Node.Node —->Net.Net.Subnet.Node Using
Mask 255.255.255.0 Subnetting on a byte boundary is the easiest to do and understand but we can also subnet on non byte boundaries. Worked Examples1- You have been allocated a class A network address of 29.0.0.0. You need to create at least 20 networks and each network will support a maximum of 160 hosts. Would the following two subnet masks Work? 255.255.0.0 and or 255.255.255.0 Yes both would work. Mask 255.255.0.0 has 8 bits for the subnet and 16 bits for the host 8 bits would accommodate 28=256 subnets 16 bits would accommodate 216= over 64000 hosts Mask 255.255.255.0 has 16 bits for the subnet and 8 bits of the host. Have possible 28 -2 hosts =254 which is enough. 2. – You have been allocated a class B network address of 135.1.0.0 and and need to create 4 subnets each with around 200 hosts what is the easiest mask to use to satisfy the criteria? Easiest is to sub net on a byte boundary which would mean a subnet mask of 255.255.255.0 This would allocate 8 bits for the subnet and 8 bits for the host. We need to accommodate around 200 hosts which requires 8 bits which we have. We need 4 subnets which requires 4 bits and we have 8 bits. So we have more than enough. Classless Inter-Domain Routing (CIDR)Classless Inter-Domain Routing was introduced in 1993 to replace the classful network design. Instead of allocating network addresses using address classes based on 8 bit groups it uses variable length subnet masking. Example: In CIDR notation this is designated by a /24 following the IP address. So: IP address 192.168.1.168 subnet mask 255.255.255.0 is written as: 192.168.1.168/24 in CIDR notation. Table: CIDR and Subnet Examples
Worked Examples
Decimal 192 =11000000 binary which means that 2 bits of this octet are used for the subnet. Now add the 24 bits 255.255.255 and we have 26 bits. So we write: 222.1.1.20/26 2. Write is the IP address 135.1.1.25 mask 255.255. 248.0 in CIDR notation Decimal 248 =11111000 binary which means that 5 bits of this octet are used for the subnet. Now add the 16 bits 255.255. and we have 21 bits. So we write: 135..1.1.25/21 Simple Subnetting Exercise QuestionsThe best way to learn to do subnetting is to try some examples. We will look a some common subnetting problems that arise when creating networks. 1 – You have been allocated a class C network address of 201.1.1.0 how may hosts can you have? 2- You have been allocated a class A network address of 21.0.0.0. You need create at least 10 networks and each network will support a maximum of 100 hosts. Would the following two subnet masks Work. 255.255.0.0 and or 255.255.255.0 3 – You have been allocated a Class B network address of 129.1.0.0. You have subnetted it using the subnet mask 255.255.255.0 How many networks can you Have and how many hosts can you place on each network? Answers A1– 256-2= 254 – Why? host addresses of all 0’s and all 1’s are not allowed. A2- Yes you only need 8 bits for 100 hosts and both subnet masks would give you that. A subnet mask of 255.255.255.0 would give you lots of networks (2 16) and 254 hosts. A subnet of 255.255.0.0 would give you lots of hosts (approx 216) and 256 networks. A3 – the network has 8 bits and so does the node component. This means that you have have 28 =256 networks and 256 -2 = 254 hosts Subnetting Class C AddressesSo far we have been subnetting on a byte boundary using class A and B addresses. Now we are going to look at how we subnet on a non-byte boundary using a Class C Address. Exercise- You have been allocated a class C network address of 195.1.1.0. You need to create 5 sub networks each network has a maximum of 10 hosts. Now our current subnet mask is 255.255.255.0 We can only use the first 8 bits for out subnets as these 8 bits have been allocated as host addresses. So for 10 hosts we need 4 bits (16-2 =14 hosts) for 5 subnets we need 3 bits (8 networks possible) possible masks: 11100000=224 (Note: 3 bits for sub networks) 11110000=240 (Note: 4 bits for sub networks) So Subnet masks of 255.255.255.224 and 255.255.255.240 would both work. In CIDR notation we have 195.1.1.0/27 and 195.1.1.0/28 Subnet Table and CalculatorBelow is a simple subnet table that makes it easier for calculating subnets. There are also many online subnet calculators available like this one Was This Useful? Subnet Worked ExamplesSubnetting Worked Examples and Exercises Subnet QuizesTest you knowledge using these online quizes
Related Tutorials and Resources:
Please rate? And use Comments to let me know more We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. How many usable hosts are available given a Class C IP address with the default subnet?A Class C address consists of a 24-bit network address and an 8-bit local host address. The first three bits in the network address indicate the network class, leaving 21 bits for the actual network address. Therefore, there are 2,097,152 possible network addresses and 256 possible local host addresses.
How many valid hosts are usable in a Class C IP address?Class C network numbers use 24 bits for the network number and 8 bits for host numbers. Class C network numbers are appropriate for networks with few hosts--the maximum being 254. A class C network number occupies the first three bytes of an IP address.
What is the default subnet mask for a Class C network?Class C networks use a default subnet mask of 255.255. 255.0 and have 192-223 as their first octet.
How many subnets can a Class C network use?Class C. |