500 likes | 647 Views
Computer Networks Lab. Subnetting. Prepared By: Eng.Ola M. Abd El- Latif. 22/May / 2010. Network and Host Portions. For each IPv4 address, some portion of the high-order bits represents the network address.
E N D
Computer Networks Lab Subnetting Prepared By: Eng.Ola M. Abd El-Latif 22/May / 2010
Network and Host Portions • For each IPv4 address, some portion of the high-order bits represents the network address. • we define a network as a group of hosts that have identical bit patterns in the network address portion of their addresses.
Host Portions • Although all 32 bits define the IPv4 host address, we have a variable number of bits that are called the host portion of the address. • The number of bits used in this host portion determines the number of hosts that we can have within the network.
Types of address in an IPv4 network • Network address- The address by which we refer to the network • Broadcast address - A special address used to send data to all hosts in the network • Host addresses - The addresses assigned to the end devices in the network
Network Address • All hosts in the 10.0.0.0 network will have the same network bits. • Within the IPv4 address range of a network, the lowest address is reserved for the network address. This address has a 0 for each host bit in the host portion of the address.
Broadcast Address • To send data to all hosts in a network, a host can send a single packet that is addressed to the broadcast address of the network. • The broadcast address uses the highest address in the network range. This is the address in which the bits in the host portion are all 1s. For the network 10.0.0.0 with 24 network bits, the broadcast address would be 10.0.0.255. This address is also referred to as the directed broadcast.
Host Address • As described previously, every end device requires a unique address to deliver a packet to that host. • In IPv4 addresses, we assign the values between the network address and the broadcast address to the devices in that network.
Network Prefixes How do we know how many bits represent the network portion and how many bits represent the host portion? The prefix length is the number of bits in the address that gives us the network portion.
Example • 172.16.4.0 /24, • the /24 is the prefix length • it tells us that the first 24 bits are the network address. • This leaves the remaining 8 bits, the last octet, as the host portion.
Networks are not always assigned a /24 prefix. • Depending on the number of hosts on the network, the prefix assigned may be different. • Having a different prefix number changes the host range and broadcast address for each network.
Calculating network, host and broadcast addresses - we see the representation of the network address - With a 25 bit prefix, the last 7 bits are host bits. - To represent the network address, all of these host bits are '0'. This makes the last octet of the address 0. - This makes the network address 172.16.20.0 /25.
This is always one greater than the network address. In this case, the last of the seven host bits becomes a '1'. With the lowest bit of host address set to a 1, t he lowest host address is 172.16.20.1.
Therefore, all seven host bits used in this network are all '1s'. From the calculation, we get 127 in the last octet. This gives us a broadcast address of 172.16.20.127.
The highest host address for a network is always one less than the broadcast. This means the lowest host bit is a '0' and all other host bits as '1s'. As seen, this makes the highest host address in this network 172.16.20.126.
Public and private address • Although most IPv4 host addresses are public addresses designated for use in networks that are accessible on the Internet, there are blocks of addresses that are used in networks that require limited or no Internet access. • These addresses are called private addresses.
Public addresses • These addresses are designed to be used in the hosts that are publicly accessible from the Internet. Private Addresses The private address blocks are: 10.0.0.0 to 10.255.255.255 (10.0.0.0 /8) 172.16.0.0 to 172.31.255.255 (172.16.0.0 /12) 192.168.0.0 to 192.168.255.255 (192.168.0.0 /16) Set aside for use in private networks.
The use of these addresses need not be unique among outside networks. • Hosts that do not require access to the Internet at large may make unrestricted use of private addresses. • However, the internal networks still must design network address schemes to ensure that the hosts in the private networks use IP addresses that are unique within their networking environment.
Many hosts in different networks may use the same private space addresses. • Packets using these addresses as the source or destination should not appear on the public Internet.
Network Address Translation (NAT) • With services to translate private addresses to public addresses, hosts on a privately addressed network can have access to resources across the Internet. • These services, called Network Address Translation (NAT), can be implemented on a device at the edge of the private network. • NAT allows the hosts in the network to "borrow" a public address for communicating to outside networks.
Historic Network Classes • Class A Blocks • A class A address block was designed to support extremely large networks with more than 16 million host addresses. • Class A IPv4 addresses used a fixed /8 prefix with the first octet to indicate the network address. The remaining three octets were used for host addresses.
all class A addresses required that the most significant bit of the high-order octet be a zero. • This meant that there were only 128 possible class A networks, 0.0.0.0 /8 to 127.0.0.0 /8, • before taking out the reserved address blocks.
Class B Blocks • Class B address space was designed to support the needs of moderate to large size networks with more than 65,000 hosts. A class B IP address used the two high-order octets to indicate the network address. • the most significant two bits of the high-order octet were 10. • This restricted the address block for class B to 128.0.0.0 /16 to 191.255.0.0 /16.
Class C Blocks • The class C address space was the most commonly available of the historic address classes. This address space was intended to provide addresses for small networks with a maximum of 254 hosts. • Class C address blocks used a /24 prefix. • using a fixed value of 110 for the three most significant bits of the high-order octet. • This restricted the address block for class C to 192.0.0.0 /16 to 223.255.255.0/16.
The subnet mask – defining the network and host portions The subnet mask is created by placing a binary 1in each bit position that represents the network portion AND placing a binary 0in each bit position that represents the host portion. The prefix and the subnet mask are different ways of representing the same thing – the network portion of an address.
As shown in the figure, a /24 prefix is expressed as a subnet mask as 255.255.255.0 (11111111.11111111.11111111.00000000). The remaining bits (low order) of the subnet mask are zeroes, indicating the host address within the network.
When this ANDING between the address and the subnet mask is performed, the result yields the network address. • For example, let's look at the host 172.16.20.35/27 • Address 172.16.20.35 10101100.00010000.00010100.00100011 • subnet mask 255.255.255.224 11111111.11111111.11111111.11100000 • network address 172.16.20.32 10101100.00010000.00010100.00100000
Therefore, there are a limited number 8 bit patterns used in address masks. • These patterns are: • 00000000 = 0 • 10000000 = 128 • 11000000 = 192 • 11100000 = 224 • 11110000 = 240 • 11111000 = 248 • 11111100 = 252 • 11111110 = 254 • 11111111 = 255
If the subnet mask for an octet is represented by 255, then all the equivalent bits in that octet of the address are network bits. • Similarly, if the subnet mask for an octet is represented by 0, then all the equivalent bits in that octet of the address are host bits.
Basic subnetting • Subnetting allows for creating multiple logical networks from a single address block. • Since we use a router to connect these networks together, each interface on a router must have a unique network ID. Every node on that link is on the same network.
We create the subnets by using one or more of the host bits as network bits. This is done by extending the mask to borrow some of the bits from the host portion of the address to create additional network bits. • The more host bits used, the more subnets that can be defined. For each bit borrowed, we double the number of subnetworks available. • For example, if we borrow 1 bit, we can define 2 subnets. If we borrow 2 bits, we can have 4 subnets. However, with each bit we borrow, fewer host addresses are available per subnet.
Router A in the figure has two interfaces to interconnect two networks. • Given an address block of 192.168.1.0 /24, we will create two subnets. • We borrow one bit from the host portion by using a subnet mask of 255.255.255.128, instead of the original 255.255.255.0 mask. • The most significant bit in the last octet is used to distinguish between the two subnets. • For one of the subnets, this bit is a "0" and for the other subnet this bit is a "1".
How many subnets does the chosen subnet mask produce? • Use this formula to calculate the number of subnets: • 2^n where n = the number of bits borrowed • In this example, the calculation looks like this: 2^1 = 2 subnets
How many valid hosts per subnet are available ? • To calculate the number of hosts per network, we use the formula of 2^n - 2 where n = the number of bits left for hosts. • Applying this formula, (2^7 - 2 = 126) shows that each of these subnets can have 126 hosts.
What are the valid subnets ? • 256 – subnet mask = block size, or increment number. • An example would be 256 – 192 = 64. The block size of a 192 mask is always 64. Start counting at zero in blocks of 64 until you reach the subnet mask value and these are your subnets 0, 64, 128, 192.
What’s the broadcast address of each subnet ? • Since we counted our subnets in the previous example as 0, 64, 128, and 192, the broadcast address is always the number right before the next subnet. For example, the 0 subnet has a broadcast address of 63 because the next subnet is 64. And so on.
What are the valid hosts in each subnet ? • Valid hosts are the numbers between the subnets, omitting the all 0s and all 1s. • For example, if 64 is the subnet number and 127 is the broadcast address, • then 65–126 is the valid host range—it’s always the numbers between the subnet address and the broadcast address.
Examples : Ex1: We’re going to subnet the network address 192.168.10.0 using the subnet mask 255.255.255.192(/26). • Subnets? 22 = 4 subnets. • Hosts? 26 – 2 = 62 hosts • Valid subnets? 256 – 192 = 64. we start at zero and count in our block size, so our subnets are 0, 64, 128, and 192.
Ex 2: We’re going to subnet the network address 172.16.0.0 using the subnet mask 255.255.240.0(/20). • Subnets? 2^4 = 16. • Hosts? 2^12 – 2 = 4094. • Valid subnets? 256 – 240 =16 0, 16, 32, 48, etc., up to 240. Notice that these are the same numbers as a Class C 240 mask – we just put them in the third octet and add a 0 and 255 in the fourth octet.
Ex3: 192.168.10.17 = Node address 255.255.255.252 = Subnet mask What subnet and broadcast address is the above IP address a member of? • 256 – 252 = 4 • (always start at zero unless told otherwise), 4, 8, 12, 16, 20, etc. The host address is between the 16 and 20 subnets. The subnet is 192.168.10.16, and the broadcast address is 192.168.10.19. • The valid host range is 17–18.
Ex 4: What is the subnet and broadcast address of the host 172.16.88.255/20? • /20 is 255.255.240.0, which gives us a block size of 16 in the third octet, and since no subnet bits are on in the fourth octet, the answer is always 0 and 255 in the fourth octet. • 0, 16, 32, 48, 64, 80, 96…. 88 is between 80 and 96, so the subnet is 80.0 and the broadcast address is 95.255.
Variable Length Subnet Masks (VLSMs) • VLSM is a way to take one network and create many networks using subnet masks of different lengths on different types of network designs.
The above figure shows a network with 11 networks, • two block sizes of 64, • one of 32, • five of 16, and • three of 4. • First, create your VLSM table and use your block size chart to fill in the table with the subnets you need.