An IPv4 (IP Version 4) address has this structure: xxx.xxx.xxx.xxx It are decimal numbers, to make it easier to read them. The computer uses binary digits instead of decimal numbers. For example: IP: 192.168.0.1 Computer: 11000000.10101000.00000000.00000001 The first part of the address is the Network ID. This is the ID of the current network. All computers in the network need to have this prefix. The second part is the host ID. Each PC or router needs a different Host ID. To see the network ID and host ID, you'll need to know what IP class is used. Finding the network ID: Looking at the first number: Class A: 1-126: First number: xxx.xxx.xxx.xxx Class B: 128-191: First and Second number: xxx.xxx.xxx.xxx Class C: 192-223: First - Third number: xxx.xxx.xxx.xxx Class D: 224 - 247: First - Fourth number: xxx.xxx.xxx.xxx (used for multicast) Class E: 248 - 255: First - fourth number: xxx.xxx.xxx.xxx (experimental only). The remaining numbers on the address is the Host ID. Note that 0 and 127 at the beginning are reserved and not used. A system without a connection has the address 127.0.0.1. This is a so called loopback address. NOTE: When using a Class C network, only one number is available for the Host ID. It's not allowed to have 0 at this location, because the host ID would be 0. The higher the class, the less amount of computers can be used in a network. This is because the amount of possible Host IDs gets less, as more numbers are used for the Network ID. Setting a subnet mask A subnet mask 'shows' the computer the difference between the Network ID and Host ID in an IP address. This address usually looks like this: 225.225.225.0. To make it easy, put the IP address and subnet mask below each other: IP: 140.138.3.1 (140.138 is the network ID) subnet mask: 255.255.0.0 As you can see, each number of the Network ID gets a 255. Why is that? Well, the highest number is 255 (11111111 in binary). This means that every number gets 'enabled' (1=enable, 0=disable). So the rest of the subnet mask gets a 0 to turn that part off. This way you turn the network ID on, and the host ID off. Creating subnetworks Note: This is a very complicated process, so forgive me if it's not completely clear. Steps: 1. How many subnetworks do you whish to create? In this example I want to create 6 subnetworks. 2. You'll need to 'borrow' bits from a default subnetmask (255). You can do it by looking at the possible subnetworks with each borrowed bit. To make it easy, create vertical rows with 1's and 0's. Each 'borrowed' bit represents a vertical row. 2 bits: 00 (only 0's not allowed) 10 01 11 (only 1's not allowed) In the first row you use 1 of each number. So 0, 1, 0, 1. The second row is the double amount. So 0,0,1,1,0,0,1,1. The third also double: 0,0,0,0,1,1,1,1,0,0,0,0. The fourth uses 8. The fifth uses 16 etc. You may not use only zeros or ones. To know the amount of possible subnets, count all possible allowed combinations. So when borowing 2 bits, you can have 2 subnets. Continue the row vertically, until you end with only 1's. The best way is to make a large row, and after creating all rows, remove all below the 1's. Example: we have the combinations 00, 10, 01 and 11. I could continue the row, with 01 and 10. But then you'll get duplicated combinations. 3 bits: 000 (not allowed) 100 010 110 001 101 011 111 (not allowed) 6 subnets 4 bits: 0000 (not allowed) 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 (not allowed) 14 subnets When you don't get the exact amount of subnets, then use bits that support more. For example: You want 8 subnets. 3 bits support only 6. So then use at least 4 bits, so it supports the 8 subnets and even more. Now put the amount of 'borrowed' bits as 1's from the left to the right. 2 bits: 11000000 3 bits: 11100000 4 bits: 11110000 Then convert it to a decimal number. When we take 3 bits (11100000), it is converted to 224. Add this to the subnet mask. If it's class B, it should have the mask 255.255.0.0. Now add the 224. New subnet mask: 255.255.224.0. Use this mask on ALL computers in the corresponding network. You can easily calculate the amount of subnets that can be used with the specified amount of 'borrowed' bits with the following formula: 2¨ - 2. At the ¨ enter the amount of 'borrowed' bits. If you borrow 3 bits, you get the formula 2³ - 2 = 6 hosts (-2, because you don't use only 0s and 1s). Now we'll look at the available subnets and IP ranges. First, find out the amount of steps between the subnets. Use this formula: 256 - 224 (the custom subnet mask) = 32 The answer you get at that formula, it the step size. Now enter these below each other. We'll take the class B network 140.80.0.0. Subnets: 1. 140.80.32.0 2. 140.80.64.0 3. 140.80.96.0 4. 140.80.128.0 5. 140.80.160.0 6. 140.80.192.0 3 bits support 6 bits, so that's the maximum amount. Now the IP ranges. Remember that you can't use all zeros (0) or all ones (255), so we keep that out. Class A: xxx.addition.0.1 - xxx.addition.255.245 Class B: xxx.xxx.addition.1 - xxx.xxx.addition.245 Class C: xxx.xxx.xxx.addition - xxx.xxx.xxx.addition We'll use the above example again. 1. 140.80.32.1 - 140.80.63.254 2. 140.80.64.1 - 140.80.95.254 3. 140.80.96.1 - 140.80.127.1 4. 140.80.128.1 - 140.80.159.254 5. 140.80.160.1 - 140.80.191.254 6. 140.80.192.1 - 140.80.224.254 Remember the Host IDs? The lowest is 1, and the highest is 254. You may combine a 1 with zeros, and 254 with 255s) Class A: xxx.xxx.xxx.xxx lowest: 0.0.1. Highest: 255.255.254 Class B: xxx.xxx.xxx.xxx lowest: 0.1. Highest: 255.254 Class C: xxx.xxx.xxx.xxx lowest 1. Highest 254 Calculate amount of possible hosts To calculate the amount of possible host IDs for each subnet, do the following: We 'borrow' 3 bits in this example. It would give 6 subnets (255.255.224.0). But add the 2 unused (all zeros and all ones). So the formula would be 2³ = 8 subnets. If you borrow 3 bits, you'll have 5 bits (8-6 : 11100000) left, filled with zeros. The subnet mask is 255.255.224.0. Binary: 11111111.11111111.11100000.00000000. The amount of zeros at the end represent the Host ID of the IP address. In this case it are 13 zeros (13 bits). Now use the formula 213 - 2. 13 is the amount of bits that you have left for the Host ID. All zeros and all ones are not allowed, so you subtract 2. So the answer: 8192-2=8190 host for each subnet.