network layer (part iii)

65
Network layer (Part III)

Upload: obelia

Post on 24-Feb-2016

22 views

Category:

Documents


0 download

DESCRIPTION

Network layer (Part III). Basics of Subnetting : Classical IP Addressing. Network administrators sometimes need to divide networks, especially large ones, into smaller networks. These smaller divisions are called subnetworks and provide addressing flexibility. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Network layer (Part III)

Network layer (Part III)

Page 2: Network layer (Part III)

Basics of Subnetting : Classical IP Addressing

• Network administrators sometimes need to divide networks, especially large ones, into smaller networks.

• These smaller divisions are called subnetworks and provide addressing flexibility.

• Most of the time subnetworks are simply referred to as subnets

Page 3: Network layer (Part III)

Basics of Subnetting : Classical IP Addressing

• Similar to the host number portion of Class A, Class B, and Class C addresses, subnet addresses are assigned locally, usually by the network administrator.

• Also, like other IP addresses , each subnet address is unique.

Page 4: Network layer (Part III)
Page 5: Network layer (Part III)

Basics of Subnetting : Subnetwork

• Subnet addresses include the Class A, Class B, or Class C network portion, plus a subnet field and a host field.

• The subnet field and the host field are created from the original host portion for the entire network.

• The ability to decide how to divide the original host portion into the new subnet and host fields provides addressing flexibility for the network administrator.

• To create a subnet address, a network administrator borrows bits from the original host portion and designates them as the subnet field.

Page 6: Network layer (Part III)
Page 7: Network layer (Part III)

Figure 1

Page 8: Network layer (Part III)

Basics of Subnetting : Subnetwork• Internally, networks may be divided into smaller networks

called sunetworks, or simply sub-nets.• By providing a third level of addressing, subnets provide extra

flexibility for the network administrator.• For example, a class “B” network provided by the interNIC,

can be broken up into many networks.• In this example, 131.108.1.0, 131.108.2.0 and 131.108.3.0 are

all subnets within the network 131.108.0.0• Figures 1 and 2 illustrate the hierarchical nature of subnet

addresses.

Page 9: Network layer (Part III)

Figure 2

Page 10: Network layer (Part III)

Basics of Subnetting : Subnetwork• To create a subnet address, a network administrator borrows bits

from the host field and designates them as the subnet field. • The minimum number of bits that can be borrowed is 2.• If you were to borrow only 1 bit, to create a subnet, then you

would only have a network number - the .0 network - and the broadcast number - the .1 network.

• maximum number of bits that can be borrowed can be any number that leaves at least 2 bits remaining, for the host number.

• In this example of a Class C IP Address, bits from the host field for the subnet field have been borrowed.

Page 11: Network layer (Part III)
Page 12: Network layer (Part III)

Basics of Subnetting : Purpose for subnetting

• A primary reason for using subnets is to reduce the size of a broadcast domain.

• Broadcasts are sent to all hosts on a network or subnetwork.

• When broadcast traffic begins to consume too much of the available bandwidth, network administrators may choose to reduce the size of the broadcast domain.

Page 13: Network layer (Part III)
Page 14: Network layer (Part III)

Basics of Subnetting : Subnet mask

• The subnet mask (formal term: extended network prefix), tells the network devices which part of an address is the network field and which part is the host field.

• A subnet mask is 32 bits long and has 4 octets, just like an IP address.

Page 15: Network layer (Part III)

Basics of Subnetting : Subnet mask• To determine the subnet mask for a particular subnetwork IP

address follow these steps.• (1) Express the subnetwork IP address in binary form. • (2) Replace the network and subnet portion of the address with all

1s.• (3) Replace the host portion of the address with all 0s.• (4) As the last step convert the binary expression back to dotted-

decimal notation.• Note: The extended network prefix includes the class A, B, or C

network number, plus the subnet field (or subnet number) that is being used to extend the routing information (which is otherwise just the network number).

Page 16: Network layer (Part III)
Page 17: Network layer (Part III)

Basics of Subnetting : Boolean operations: AND, OR, and NOT

• The term "operations" in mathematics refers to rules that define how one number combines with other numbers.

• Decimal number operations include addition, subtraction, multiplication, and division.

• There are related, but different, operations for working with binary numbers.

• The basic Boolean operations are AND, OR, and NOT.– AND is like multiplication– OR is like addition– NOT changes 1 to 0, and 0 to 1

Page 18: Network layer (Part III)

Basics of Subnetting : Performing the AND function

• The lowest numbered address in an IP network is the network address (the network number plus 0 in the entire host field).

• This also applies to a subnet: the lowest numbered address is the address of the subnet.

Page 19: Network layer (Part III)

Basics of Subnetting : Boolean operations: AND, OR, and NOT

• In order to route a data packet, the router must first determine the destination network/subnet address by performing a logical AND using the destination host's IP address and the subnet mask.

• The result will be the network/subnet address. • In the Figure, the router has received a packet for

host 131.108.2.2 - it uses the AND operation to learn that this packet should be routed to subnet 131.108.2.0.

Page 20: Network layer (Part III)
Page 21: Network layer (Part III)

Creating a Subnet : Range of bits needed to create subnets

• To create subnets, you must extend the routing portion of the address.

• The Internet knows your network as a whole, identified by the Class A, B, or C address, which defines 8, 16, or 24 routing bits (the network number).

• The subnet field will become additional routing bits, so that the routers within your organization can recognize different locations, or subnets, within the whole network

Page 22: Network layer (Part III)

Creating a Subnet : Range of bits needed to create subnets

• Question: In the address 131.108.0.0, which are the routing bits?Answer: 131.108 - That's the 16 bit Class B network number.

• Question: What are the other two octets (16 bits) of the address 131.108.0.0 used for? Answer: Well, as far as the Internet knows, that's just a 16 bit host field, because that's what a Class B address is - a 16 bit network number and a 16 bit host number.

Page 23: Network layer (Part III)

Creating a Subnet : Range of bits needed to create subnets

• Question: What part of the address 131.108.0.0 is the subnet field?Answer: When you decide to create subnets, you must divide the original host field (16 bits in the case of Class B) into two parts - the subnet field and the host field. This is sometimes referred to as "borrowing" some of the original host bits to create the subnet field. The other networks in the Internet won't care - they look at the address the same - all they really see is the Class A, B, or C network number, and send the packet on to its destination. The minimum number of bits that you can borrow is 2, regardless of whether you're working with a Class A, B, or C network1 because at least 2 bits must remain for host numbers2, the maximum varies by address class.

Page 24: Network layer (Part III)

Creating a Subnet : Range of bits needed to create subnets

Page 25: Network layer (Part III)
Page 26: Network layer (Part III)
Page 27: Network layer (Part III)

Creating a Subnet : Range of bits needed to create subnets

• The subnet field always follows immediately after the network number.

• That is, the borrowed bits must be the first n bits of the default host field, where n is the desired size of the new subnet field.

• The subnet mask is the tool used by the router to determine which bits are routing bits and which bits are host bits

Page 28: Network layer (Part III)

Creating a Subnet : Range of bits needed to create subnets

• Previous standards did not allow for the use of subnets obtained by borrowing 1 bit (with only 1 subnet bit, the subnet field can only have two values: subnet 0 is part of the network address, and subnet 1 would be part of the network broadcast address) – although many devices can now support subnets obtained by borrowing 1 bit, it is still common practice to avoid doing this to insure compatibility with legacy devices; for our purposes here, you will always borrow at least 2 bits.

• Similarly, a 1 bit host field would allow only for host 0, which is part of the network address, and host 1, which is part of the broadcast address, leaving 0 valid host addresses.

Page 29: Network layer (Part III)

Creating a Subnet : Determining subnet mask size

• Subnet masks use the same format as IP addresses. • They are 32 bits long and are divided into four

octets, written in dotted decimal format.• Subnet masks contain all 1s in the network bit

positions (determined by the address class) as well as the desired subnet bit positions, and contain all 0s in the remaining bit positions, designating them as the host portion of an address.

Page 30: Network layer (Part III)

Creating a Subnet : Determining subnet mask size

• By default, if you borrow no bits, the subnet mask for a Class B network would be 255.255.0.0, which is the dotted decimal equivalent of 1s in the 16 bits corresponding to the Class B network number.

• If 8 bits were to be borrowed for the subnet field, the subnet mask would include 8 additional 1 bits, and would become 255.255.255.0.

Page 31: Network layer (Part III)

Creating a Subnet : Determining subnet mask size

• For example, if the subnet mask 255.255.255.0 were associated with the Class B address 130.5.2.144 (8 bits borrowed for subnetting), the router would know to route this packet to subnet 130.5.2.0 rather than to just network 130.5.0.0

Page 32: Network layer (Part III)

Creating a Subnet : Determining subnet mask size

• Another example is the Class C address 197.15.22.131, with a subnet mask of 255.255.255.224.

• With a value of 224 in the final octet (11100000 in binary), the 24 bit Class C network portion has been extended by 3 bits, to make the total 27 bits.

• The 131 in the last octet now presents the third usable host address in the subnet 197.15.22.128.

• The routers in the Internet (that don't know the subnet mask) will only worry about routing to the Class C network 197.15.22.0, while the routers inside that network, knowing the subnet mask, will be looking at 27 bits to make a routing decision.

Page 33: Network layer (Part III)
Page 34: Network layer (Part III)

Creating a Subnet : Computing subnet mask and IP address

• Whenever you borrow bits from the host field, it is important to note the number of additional subnets that are being created each time you borrow one more bit.

• You have already learned that you cannot borrow only 1 bit; the fewest you may borrow is 2 bits.

Page 35: Network layer (Part III)

Creating a Subnet : Computing subnet mask and IP address

• Borrowing 2 bits creates four possible subnets (22) (but you must always remember that there are two reserved/unusable subnets). Each time you borrow another bit from the host field, the number of subnets created increases by a power of 2.

Page 36: Network layer (Part III)

Creating a Subnet : Computing subnet mask and IP address

• The eight possible subnets that are created by borrowing 3 bits is equal to 23 (2 x 2 x 2).

• The sixteen possible subnets created by borrowing 4 bits is equal to 24 (2 x 2 x 2 x 2).

• From these examples, it is easy to see that each time you borrow another bit from the host field, the number of possible subnets doubles.

Page 37: Network layer (Part III)

Creating a Subnet : Computing subnet mask and IP address

• Question: How many bits are being borrowed (how long is the subnet field) for a Class B network using a subnet mask of 255.255.240.0?Answer: The first two octets of the mask (255.255) correspond with the 16 bits in a Class B network number. Remember that the subnet field is represented by all the additional "1" bits past that. The number 240 decimal is 11110000 in binary, and you can see that you are using 4 bits for the subnet field.

• Question: How many possible subnets are there with a 4 bit subnet field? Answer: Start with finding the smallest 4 bit number - 0000 - then the largest 4 bit number - 1111 (15). So the possible subnets are 0-15, or sixteen subnets. However, you know you cannot use subnet 0 (it's part of the network address), and you cannot use subnet 15 (1111) either (broadcast address). So this 4 bit subnet field gives you fourteen usable subnets (1-14).

Page 38: Network layer (Part III)
Page 39: Network layer (Part III)

Creating a Subnet : Computing hosts per subnetwork

• Each time you borrow 1 bit from a host field, there is 1 less bit remaining in the field that can be used for host numbers.

• Specifically, each time you borrow another bit from the host field, the number of host addresses that you can assign decreases by a power of 2 (gets cut in half).

Page 40: Network layer (Part III)

Creating a Subnet : Computing hosts per subnetwork

• To help you understand how this works, use a Class C network address as an example.

• If there is no subnet mask, all 8 bits in the last octet are used for the host field.

• Therefore, there are 256 (28) possible addresses available to assign to hosts (254 usable addresses, after you subtract the 2 you know you can't use).

• Now, imagine that this Class C network is divided into subnets. If you borrow 2 bits from the default 8 bit host field, the host field decreases in size to 6 bits.

• If you write out all of the possible combinations of 0s and 1s that could occur in the remaining 6 bits, you would discover that the total number of possible hosts that could be assigned in each subnet would be reduced to 64 (26).

• The number of usable host numbers would be reduced to 62.

Page 41: Network layer (Part III)

Creating a Subnet : Computing hosts per subnetwork

• In the same Class C network, if you borrow 3 bits, the size of the host field decreases to 5 bits and the total number of hosts that you could assign to each subnet would be reduced to 32 (25).

• The number of usable host numbers would be reduced to 30.

Page 42: Network layer (Part III)

Creating a Subnet : Computing hosts per subnetwork

• The number of possible host addresses that can be assigned to a subnet is related to the number of subnets that have been created.

• In a Class C network, for example, if a subnet mask of 255.255.255.224 has been applied, then 3 bits (224 = 11100000) would have been borrowed from the host field.

• The useable subnets created are 6 (8 minus 2), each having 30 (32 minus 2) useable host addresses

Page 43: Network layer (Part III)

Creating a Subnet : Computing hosts per subnetwork

• Exercise:Divide the last octet into two parts: a subnet field and a host field. If there are 32 possible host addresses that can be assigned to each subnet, then their IP addresses would fall within the range of numbers (but remember the 2 unusable host addresses in each subnet!).

• In a Class C network 199.5.12.0 with subnet mask 255.255.255.224, to which subnet would host 199.5.12.97 belong? (hint: 97 = 01100001 binary) A. subnet 0?B. subnet 1? C. subnet 2? D. subnet 3? E. subnet 4?F. none of the above?

Page 44: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• As you have already learned, the lowest numbered address in an IP network is the network address (the network number plus 0 in the entire host field).

• This also applies to a subnet; the lowest numbered address is the address of the subnet

Page 45: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• In order to route a data packet, the router must first determine the destination network/subnet address.

• To accomplish this the router performs a logical AND using the destination host's IP address and the subnet mask for that network.

• Imagine that you have a Class B network with the network number 172.16.0.0.

• After assessing the needs of your network, you decide to borrow 8 bits in order to create subnets.

• As you learned earlier, when you borrow 8 bits with a Class B network, the subnet mask is 255.255.255.0

Page 46: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• Someone outside the network sends data to the IP address 172.16.2.120.

• In order to determine where to deliver the data, the router ANDs this address with the subnet mask.

• When the two numbers are ANDed, the host portion of the result will always be 0.

• What is left is the network number, including the subnet.• Thus, the data is sent to subnet 172.16.2.0, and only the

final router notices that the packet should be delivered to host 120 in that subnet.

Page 47: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• Now, imagine that you have the same network, 172.16.0.0.

• This time, however, you decide to borrow only 7 bits for the subnet field.

• The binary subnet mask for this would be 11111111.11111111.11111110.00000000. What would this be in dotted decimal notation?

Page 48: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• Again, someone outside the network sends data to host 172.16.2.120.

• In order to determine where to send the data, the router again ANDs this address with the subnet mask.

• As before, when the two numbers are ANDed, the host portion of the result is 0.

• So what is different in this second example? Everything looks the same - at least in decimal.

• The difference is in the number of subnets available, and the number of hosts that can be in each subnet.

• You can only see this by comparing the two different subnet masks.

Page 49: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• With 7 bits in the subnet field, there can be only 126 subnets.

• How many hosts can there be in each subnet?• How long is the host field? • With 9 bits for host numbers, there can be 510

hosts in each of those 126 subnets.

Page 50: Network layer (Part III)

Creating a Subnet : Boolean AND operation

• The two graphics on this page include something you'll learn more about later - an alternate way to express the subnet mask.

• You learned that the 1s of the mask represent the routing bits - the network plus the subnet.

• 255.255.255.0 indicates there are 24 total routing bits. • This is sometimes indicated by following an IP address

with "/24", as in 131.108.3.1 /24 - this says the same thing as the longer subnet mask.

Page 51: Network layer (Part III)
Page 52: Network layer (Part III)
Page 53: Network layer (Part III)

Creating a Subnet : IP configuration on a network diagram

• When you configure routers, you must connect each interface to a different network segment.

• Then each of these segments will become a separate subnet.

• You must select an address from each different subnet to assign to the interface of the router that connects to that subnet.

• Each segment of a network - the actual wires and links - must have different network/subnet numbers.

• The Figure shows what a network diagram might look like using a subnetted Class B network.

Page 54: Network layer (Part III)
Page 55: Network layer (Part III)
Page 56: Network layer (Part III)

Creating a Subnet : Host/subnet schemes

• One of the decisions that you must make whenever you create subnets is to determine the optimal number of subnets and hosts (Note: The number of subnets required in turn determines the number of hosts available.

• For example, if you borrow 3 bits with a Class C network, only 5 bits remain for hosts).

Page 57: Network layer (Part III)

Creating a Subnet : Host/subnet schemes

• You have already learned that you cannot use the first and last subnet.

• You also cannot use the first and last address within each subnet - one is the broadcast address of that subnet, and the other is part of the network address.

• When you create subnets, you lose quite a few potential addresses.

• For this reason, network administrators must pay close attention to the percentage of addresses that they lose by creating subnets.

Page 58: Network layer (Part III)

Creating a Subnet : Host/subnet schemes

Example:If you borrow 2 bits with a Class C network, you create 4 subnets, each with 64 hosts. Only 2 of the subnets are usable and only 62 hosts are usable per subnet, leaving 124 usable hosts out of 254 that were possible before you chose to use subnets. This means you are losing 51% of your addresses.

Page 59: Network layer (Part III)

Creating a Subnet : Host/subnet schemes

• Imagine, this time, that you borrow 3 bits. • You now have 8 subnets, of which only 6 are usable,

with 30 usable hosts per subnet.• This gives you a total of 180 usable hosts, down from

254, but now you are losing only 29% of your addresses.

• Whenever you create subnets, you need to take into consideration future network growth and the percentage of addresses that you would lose by creating subnets.

Page 60: Network layer (Part III)
Page 61: Network layer (Part III)

Creating a Subnet : Private addresses

• There are certain addresses in each class of IP address that are not assigned.

• These addresses are called private addresses.• Private addresses might be used by hosts that

use network address translation (NAT), or a proxy server, to connect to a public network; or by hosts that do not connect to the Internet at all.

Page 62: Network layer (Part III)

Creating a Subnet : Private addresses

• Many applications require connectivity within only one network and do not need external connectivity.

• In large networks, TCP/IP is often used, even when network layer connectivity outside the network isn’t needed. Banks are good examples.

• They may use TCP/IP to connect to automatic teller machines (ATMs).

• These machines do no connect to the public network, so private addresses are ideal for them.

• Private addresses can also be used on a network where there are not enough public addresses available.

Page 63: Network layer (Part III)

Creating a Subnet : Private addresses

• The private addresses can be used together with a network address translation (NAT) server.

• Either a NAT server or a proxy server to provide connectivity to all hosts in a network that has relatively few public addresses available.

• By agreement, any traffic with a destination address within one of the private address ranges will NOT be routed on the Internet.

Page 64: Network layer (Part III)
Page 65: Network layer (Part III)