550 likes | 566 Views
Routing within an Organization. Subnets. Subnet. Subnets are a subset of the entire network Networks can be divided into subnets Subnets can be divided into subnets Each subnet is treated as a separate network. Subnetting. Subnetting. University Network.
E N D
Routing within an Organization Subnets
Subnet • Subnets are a subset of the entire network • Networks can be divided into subnets • Subnets can be divided into subnets • Each subnet is treated as a separate network
Subnetting Subnetting University Network • Problem: Organizations have multiple networks which are independently managed • Solution 1: Allocate a separate network address for each network • Difficult to manage • From the outside of the organization, each network must be addressable. • Solution 2: Add another level of hierarchy to the IP addressing structure Engineering School Medical School Library
Multi-Level Subnets • A subnet can be divided into subnets • If the first layer of subnetting used 2 bits for the subnet portion, a second layer can be used to subnet within each subnet • Using more bits from the host portion of the address
Multi-Level Subnets Layer 2 Layer 1 Subnet 1 Subnet 2a Network 1 Subnet 2 Subnet 2b Subnet 3
Example 1 • Given the network address 17.0.0.0, find the class, the block, and the range of the addresses. • SolutionThe class is A because the first byte is between 0 and 127. The block has a netid of 17. The addresses range from 17.0.0.0 to 17.255.255.255.
Example 2 • Given the network address 132.21.0.0, find the class, the block, and the range of addresses. • Solution The class is B, the block is 132.21, and the range is 132.21.0.0 to 132.21.255.255
Example 3 • Given the network address 220.34.76.0, find the class, the block, and the range of addresses • Solution The class is C, the block is 220.34.76, and the range of addresses is 220.34.76.0 to 220.34.76.255
Masking concept Given an address from a block of addresses, we can find the network address by AND-ing with a mask.
Masking concept – default mask Default masks
Note: The network address is the beginning address of each block. It can be found by applying the default mask to any of the addresses in the block (including itself). It retains the netid of the block and sets the hostid to zero.
Example 4 • Given the address 23.56.7.91, find the beginning address (network address). • Solution The default mask is 255.0.0.0, which means that only the first byte is preserved and the other 3 bytes are set to 0s. The network address is 23.0.0.0.
Example 5 • Given the address 132.6.17.85, find the beginning address (network address). • Solution The default mask is 255.255.0.0, which means that the first 2 bytes are preserved and the other 2 bytes are set to 0s. The network address is 132.6.0.0
Example 6 • Given the address 201.180.56.5, find the beginning address (network address). • Solution The default mask is 255.255.255.0, which means that the first 3 bytes are preserved and the last byte is set to 0. The network address is 201.180.56.0
Hosts for Classes of IP Addresses Class A (24 bits for hosts) 224 - 2* = 16,777,214 maximum hosts Class B (16 bits for hosts) 216 - 2* = 65,534 maximum hosts Class C (8 bits for hosts) 28 - 2* = 254 maximum hosts * Subtracting the network and broadcast reserved address
Network IDs and Broadcast Addresses An IP address such as 176.10.0.0 that has all binary 0s in the host bit positions is reserved for the network address. An IP address such as 176.10.255.255 that has all binary 1s in the host bit positions is reserved for the broadcast address.
Subnetting • Is the act of “borrowing” bits from the host portion to create smaller networks (called subnetworks) • Minimum bits that can be borrowed is 2. • Subnetting is used to reduce the number of broadcast domains • Communication between these subnetworks is achieved through a router
Subnet Mask • Determines which part of an IP address is the network field and which part is the host field • Follow these steps to determine the subnet mask: • 1. Express the subnetwork IP address in binary form. • 2. Replace the network and subnet portion of the address with all 1’s. • 3. Replace the host portion of the address with all 0’s. • 4. Convert the binary expression back to dotted-decimal notation.
Subnet Mask Subnet mask in decimal = 255.255.240.0
Subnet Addresses • Imagine that you have a class "B” network. This time however, instead of borrowing all eight bits of the third octet, only seven bits are borrowed to create subnetworks. • Using binary representation, in this example, the subnet mask would be 11111111.11111111.11111110.00000000. • Therefore, 255.255.255.0 can no longer be used as the subnet mask.
Determining Subnet Mask Size Class B address with 8 bits borrowed for the subnet 130.5.2.144 (8 bits borrowed for subnetting) routes to subnet 130.5.2.0 rather than just to network 130.5.0.0.
Determining Subnet Mask Size Class C address 197.15.22.131 with a subnet mask of 255.255.255.224 (3 bits borrowed) The address 197.15.22.131 would be on the subnet 197.15.22.128.
Host Subnet Schemes The number of lost IP addresses with a Class C network depends on the number of bits borrowed for subnetting.
Subnet mask • How do we determine how many bits to “borrow” for a subnet? • Determine the number of sub networks required • Work from the MOST significant (LHS) bits of the first octet after the network number and calculate the number of bits needed to create the required number of subnetworks
Subnet mask • Example: • You are given a class B address and you are required to create 1000 subnetworks. • By working from the LHS of the (first octet after the network number) 3rd octet, calculate the number of bits to equal or slightly exceed 1000. (ie 2x = > 1000) • This would equate to 210 or 1024-2 networks • Hence you will need to borrow 10 bits from the host portion to create 1000 subnetworks
Subnet mask • Example: • The subnetmask in this instance would be255.255.255.192 • How many host per network can you obtain from this addressing scheme? 6 bits left for hosts 10 Bits Borrowed (subnetmask) Natural Class B netmask
Subnet mask • How do we determine how many bits to “borrow” for a subnet given the number of hosts required? • Determine the number of hosts required • Work from the LEAST significant (RHS) bits of the last octet and calculate the number of bits needed to create the required number of subnetworks.
Subnet mask • Example: • You are given a class B address and you require 1000 nodes per subnet • By working from the RHS (last octet) of the 4th octet, calculate the number of bits to equal or slightly exceed 1000. (ie 2x = >1000) • This would equate to 210 or 1024-2 networks • Hence you will need to borrow 6 bits from the host portion to create subnetworks with 1000 hosts each
Subnet mask • Example: • The subnetmask in this instance would be255.255.252.0 • How many subnetworks per network can you obtain from this addressing scheme? 10 bits required for hosts 6 Bits Borrowed (subnetmask) Natural Class B netmask
Algorithm for deriving Subnet information • Given an IP address, you will usually be given a net/subnetmask • If you are given the mask • Subtract the mask from 256 • This is known as the multiplier • The first number in each multiplier value is the network number • The broadcast address is the next multiplier value subtract 1
Algorithm for deriving Subnet information • E.g. given the IP address 192.168.0.100 with the subnet mask of 255.255.255.240 Or 192.168.0.100/28 • What is the network number • What is the broadcast address • What are the valid IP hosts for the subnet
Algorithm for deriving Subnet information • Subtract 256 from the netmask • 256 - 240 = 16 • This is the multiplier ie the networks are in steps of 16 (16,32,48,64,96,112 etc) • The IP address 192.168.0.100 is in the range of |100 / 16| which is the 6 th subnetwork • The network address is 16* 6 = 96 (01100000b) • The Broadcast address is 96 + 16 - 1 => 192.168.0.111 (01101111b) • ie (next multiplier – 1)
Algorithm for deriving Subnet information Host portion Network Portion SN IP address192.168.0.100 Netmask 255.255.255.240 Network Address192.168.0.96 Broadcast Address192.168.0.111
Algorithm for deriving Subnet information • Valid ranges are • 192.168.0.97 to 192.168.0.110 • Number of allowable hosts 97 to 110 (incl) = 14 or [24]16 - 2 = 14 • Remember you cannot use the first address (network address) and the last address (broadcast address) in the range • The number of allowable networks • [24]16 - 2 = 14 ( ie 4 bits used. If a class B address with the last bit subnet, then add another 8 bits to give you 212 –2 allowable subnet)
Algorithm for deriving Subnet information • What if the IP range goes over 2 octets • Use the same principal • Remember octets with all 0’s are considered “boring” and will be assigned the mask of 0 • You will then have to locate the position in the address with both 1’s and 0’s (interesting byte) and use the same algorithm • Similarly all 1’s are also considered boring and will be given the mask of 255 (e.g. subnetting the last byte of a class B address)
Algorithm for deriving Subnet information • Example • Organization address • 131.181.112.0/22 • Netmask expanded : 255.255.252.0 • Last byte is “not interesting” hence we set it to “0” for network and “1” for broadcast • The third byte is “interesting” 256 – 252 = 4 (multiplier) • Networks are in increments of 4 steps • 112/4 = 28 (the 28th subnetwork). Since there is no remainder, it is the beginning of the network address.
Algorithm for deriving Subnet information • Network address :131.181.112.0 • Netmask :255.255.252.0 • Broadcast :112 + 4 – 1 = 115 =>131.181.115.255 • Number of valid hosts :210 –2 = 1024 – 2 = 1022 hosts • Number of subnetworks available for this network26 – 2 = 64 –2 =62 subnetworks • Assignable addresses in this subnetwork131.181.112.1 – 131.181.115.254 • Remember, the 1st and last addresses cannot be used (Network and broadcast).
How does the router handle IP addresses and subnet masks • Let's assume that a device on another network with an IP address of 197.15.22.44 wants to send data to another device attached to Cisco's network with an IP address of 131.108.2.2. • The data is sent out over the Internet until it reaches the router that is attached to Cisco's network. • The router's job is to determine which one of Cisco's subnetworks the data should be routed to.
How does the router handle IP addresses and subnet masks? when the router performs this ”AND-ing" operation, the host portion falls through.
How does the router handle IP addresses and subnet masks? The router looks at what is left which is the network number including the subnetwork.
How does the router handle IP addresses and subnet masks? The router then looks in its routing table and tries to match the network number including the subnet with an interface.
How does the And-ing operation change with different subnet masks? • Imagine that you have a class "B” network with the network number 172.16.0.0. • After assessing the needs of his network, the network administrator has decided to borrow eight bits in order to create subnetworks. • When eight bits are borrowed to create subnets, the subnet mask is 255.255.255.0. • Someone outside the network sends data to the IP address 172.16.2.120.