Subnetting Warren Toomey GCIT
Introduction Each device on the Internet needs an IP address to identify its connection to the Internet –PCs have one connection, so only 1 IP address –Routers: multiple connections, many IP addresses Where do they come from, how are they allocated? You buy an IP address range from your nearest Network Information Centre: APNIC Network admins must subnet this range and allocate a unique IP address to each device in their network
Routers If we had a single large network, problems –Too many broadcasts: high CPU load on devices –No way to enforce internal network security Routers: create multiple broadcast domains –Each side of a router is a separate broadcast domain –Isolates broadcasts, reduces CPU load Routers can also implement packet-level security
Routers and Subnets Each side of a router needs an IP address from a different IP address range If we divide our network up with routers, we also have to divide the IP range from APNIC up into smaller ranges This is known as subnetting Each subdivided IP address range is called a subnet
IP Addresses: Net, Host Fields When you buy an IP range from APNIC, it is divided into network and host sections IP addresses are 32 bits wide. The prefix mask tells you which section is the network field and which section is the host field Example: APNIC allocates you /23 Out of the 32 bits, the first 23 represent your network (i.e ). The other 9 bits represent each host IP address –You get to allocate a unique host IP address to each device on your network
Subnetting When we subnet an IP allocation, we borrow bits from the host field to represent and identify each subnet that we want to create If we borrow 1 bit, we create 2 1 = 2 subnets If we borrow 2 bits, we create 2 2 = 4 subnets If we borrow 3 bits, we create 2 3 = 8 subnets If we borrow 4 bits, we create 2 4 = 16 subnets etc.
Subnetting: Example Example: APNIC allocates you /23 You decide to borrow 3 bits from the 9 host bits This will create 2 3 = 8 subnets. Each subnet has the /26 prefix because we had /23 and borrowed 3 more bits However, this means the host field on each subnet is now only 6 bits long (9 – 3) This means that each subnet now has only 2 6 = 64 unique IP addresses on it On each subnet –the first IP address identifies the subnet –The last IP address is the broadcast address
Subnetting: Step Size Each subnet is a unique, non-overlapping set of IP addresses You need to know the step factor between each subnet. It is the number of IP addresses in that subnet Example: if a subnet is size /26, only 6 bits left for hosts and 2 6 = 64, so the step size is 64
Subnetting: Step Size You also need to write each subnet in dotted decimal notation You need to learn this table. Write it down!!! Cross-check: step size + mask number = 256 Prefix MaskDotted Decimal MaskStep Size / in the 3 rd octet / in the 4 th octet / in the 4 th octet / in the 4 th octet / in the 4 th octet / in the 4 th octet / in the 4 th octet
Subnetting: Example Example: APNIC allocates you /23 You decide to borrow 3 bits from the 9 host bits This will create 2 3 = 8 subnets with the /26 mask /26 is the same as Step size is 64 First subnet identity: same as the original IP allocation Can't go past 255. Add 1 in the next column and go to (not !)
Subnetting: Example 2 APNIC allocates you /25 You decide to borrow 2 host bits to make 2 2 = 4 subnets Each subnet is /27, , step size 32 Your subnets are: – /27 – /27 – /27 – /27
Subnetting: Example 2 Your subnets are: – , , and , all with the prefix mask /27 –Step size is 32 The first IP on each one is the subnet identity; the last is the broadcast address Subnet IdentityUsable IP AddressesBroadcast Address to to to to
Subnetting: Example 2 Each subnet identity is even, each broadcast is odd First usable IP is odd, last usable IP is even Each broadcast address is the one before the next subnet identity address Subnet IdentityUsable IP AddressesBroadcast Address to to to to
Subnetting: Example 3 You can't make 5 subnets, you can only make –2 1 = 2, 2 2 = 4, 2 3 = 8, 2 4 = 16 etc. You have purchased /26 from APNIC You want to make 3 subnets How many bits are you going to borrow from the host field to make them? How many subnets will actually be created? What will be the prefix mask be on each subnet? What will be the step size between subnets? What is the dotted decimal net mask?
Subnetting: Example 3 You have purchased /26 from APNIC You want to make 3 subnets You have to borrow 2 bits from the host field to make 2 2 = 4 subnets The subnet prefix mask is /28, step size 16 The dotted decimal netmask is The first subnet is /28 What is the identity of the second subnet? What is the broadcast address of the second subnet?
Subnetting: Example 3 You have purchased /26 from APNIC You want to make 3 subnets You borrowed 2 bits from the host field to make 2 2 = 4 subnets Write out this table for all 4 subnets you created Subnet IdentityUsable IP addressesBroadcast Address
Subnetting: Example 4 Sometimes we want to subnet where we need a minimum number of IP addresses on each subnet Example: you have a network with four broadcast domains separated by one router. One section has 23 devices, one section has 15 devices, one section has 9 devices, one section has 20 devices. Each subnet will be the same size and must have at least 23 IP addresses. We must decide to keep enough host bits If our subnets were /28, then only 4 host bits, 2 4 = 16 which would be too small We can't go past /27, keeping 5 host bits, 2 5 = 32 hosts
Subnetting: Example 4 You have a network with four broadcast domains separated by one router. One section has 23 devices, one section has 15 devices, one section has 9 devices, one section has 20 devices. You have purchased /24 from APNIC You need to make subnets for each broadcast domain What will the prefix be for each subnet? How many subnets will you create? Write out the identity, usable range and broadcast table
Subnetting: Other Questions Usable IP addresses cannot be the identity or the broadcast address of a subnet The identity address must be a multiple of the step size Example: /24 is subnetted into /26 subnets /26 is step size 64, so the subnet identities are 1.0, 1.64, and Question: Is /28 –The identity address for this subnet? –A usable IP address on this subnet? –The broadcast address for this subnet?
Subnetting: Other Questions For each of the IP addresses below, is it: –The identity address for this subnet? –A usable IP address on this subnet? –The broadcast address for this subnet? / / /28