360 likes | 613 Views
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?
E N D
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 131.44.40.0 /23 • Out of the 32 bits, the first 23 represent your network (i.e. 131.44.40.0). • 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 21 = 2 subnets • If we borrow 2 bits, we create 22 = 4 subnets • If we borrow 3 bits, we create 23 = 8 subnets • If we borrow 4 bits, we create 24 = 16 subnets etc.
Subnetting: Example • Example: APNIC allocates you 131.44.40.0 /23 • You decide to borrow 3 bits from the 9 host bits • This will create 23 = 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 26 = 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 26 = 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
Subnetting: Example • Example: APNIC allocates you 131.44.40.0 /23 • You decide to borrow 3 bits from the 9 host bits • This will create 23 = 8 subnets with the /26 mask • /26 is the same as 255.255.255.192. 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 0
Subnetting: Example 2 • APNIC allocates you 195.67.43.128 /25 • You decide to borrow 2 host bits to make 22 = 4 subnets • Each subnet is /27, 255.255.255.224, step size 32 • Your subnets are: • 195.67.43.128 /27 • 195.67.43.160 /27 • 195.67.43.192 /27 • 195.67.43.224 /27
Subnetting: Example 2 • Your subnets are: • 195.67.43.128, 195.67.43.160, 195.67.43.192 and 195.67.43.224, 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
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
Subnetting: Example 3 • You can't make 5 subnets, you can only make • 21 = 2, 22 = 4, 23 = 8, 24 = 16 etc. • You have purchased 200.5.6.0 /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 200.5.6.0 /26 from APNIC • You want to make 3 subnets • You have to borrow 2 bits from the host field to make 22 = 4 subnets • The subnet prefix mask is /28, step size 16 • The dotted decimal netmask is 255.255.255.240 • The first subnet is 200.5.6.0 /28 • What is the identity of the second subnet? • What is the broadcast address of the second subnet?
Subnetting: Example 3 • You have purchased 200.5.6.0 /26 from APNIC • You want to make 3 subnets • You borrowed 2 bits from the host field to make 22 = 4 subnets • Write out this table for all 4 subnets you created
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, 24 = 16 which would be too small • We can't go past /27, keeping 5 host bits, 25 = 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 211.11.12.0 /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: 192.160.1.0 /24 is subnetted into /26 subnets • /26 is step size 64, so the subnet identities are 1.0, 1.64, 1.128 and 1.192 • Question: Is 203.45.67.160 /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? • 160.75.82.63 /29 • 211.44.32.100 /27 • 198.45.12.192 /28