Chapter 5 Subnetting And Supernetting

Hyung Min Lee Subnetting and Supernetting

About subnetting & Supernetting • In subnetting, a network is divided into several smaller with each subnetwork(or subnet) having its own subnetwork address.

• In supernetting, an organization can combine several class C addresses to create a larger range of addresses(supernetwork).

5.1 SUBNETTING • Class A, B, C in IP addressing are designed with two levels of hierarchy.(netis and hostid)

• The organization has two-level hierarchical addressing, but it cannot have more than one physical network./ The host cannot be organized into groups, and all of the hosts are at the same level./ The organization has one network with many hosts.

• One solution to this problem is subnetting, the further division of a network into smaller networks called .

Hyung Min Lee Figure 5-1 A network with two levels of hierarchy (not subnetted)

Hyung Min Lee Figure 5-2 A network with three levels of hierarchy (subnetted)

The R1 uses the first two octet(141.14)as the netid, the third octet(2) as the subnetid, and the fourth octet(21) as the hostid.

Hyung Min Lee Subnetting and Supernetting

Three Levels of Hierarchy

• Adding subnetworks creates an intermediate level of hierarchy in the IP addressing system. – Netid: It defines the site. – Subnetid : It defines the physical subnetwork – Hostid: It defines the connection of the host to the network.

Hyung Min Lee Figure 5-3 Addresses in a network with and without subnetting

Hyung Min Lee Figure 5-4 Hierarchy concept in a telephone number

Hyung Min Lee Subnetting and Supernetting

5.2 MASKING • Masking is a process that extracts the address of the physical network from an IP address. • Masking can be done whether we have subnetting or not. – Not subnetted the network: Masking extracts the network address an IP address. – Subnetted the network: Masking extracts the subnetwork address an IP address.

• In masking, we perform a mathematical operation on a 32-bit IP address at the bit level using another 32-bit number called the mask. • To get the network or subnetwork address, we must apply the bit-wise-and operation on the IP address an the mask. • The part of the mask containing 1s defines the netid(network portion) or combination of netid and subnetid(subnetwork portion), The part of the mask containing 0s defines the hostid.

Hyung Min Lee Figure 5-5 Masking

Hyung Min Lee Figure 5-6 Applying bit-wise-and operation to achieve masking

Hyung Min Lee Subnetting and Supernetting

Special Addresses in Subnetting

• A subnetid of all 1s or all 0s is not assigned to any host. • The address with the hostid of all 1s is reserved for broadcasting to all hosts in a specific subnet. • The address with the hostid of all 0s is also reserved to define the subnetwork itself.

Hyung Min Lee Figure 5-7 Special addresses in subnetting

Hyung Min Lee Subnetting and Supernetting

5.3 EXAMPLES OF SUBNETTING

( Example 1 / Class A) An organization with a class A address at least 1,000 subnetworks. Find the subnet mask and configuration of each subnetwork.

(Solution) 1. There is a need for at least 1,000 subnetworks.(we need at least 1,002 subnetworks to allow for the all-1s and all-0s subnetids) 2. This means that the minimum number of bits to be allocated for subnetting should be 10, (29 < 1,002 < 210). 3. 14 bits are left to define the hostids. Subnet mask (11000000 = 192).

Hyung Min Lee Figure 5-8 Masks in example 1

Hyung Min Lee Figure 5-9 Range of addresses in example 1

Hyung Min Lee Figure 5-10 Subnetworks in example 1

Hyung Min Lee Subnetting and Supernetting

( Example 2 / Class B) An organization with a class B address needs at least 12 subnetworks. Find the subnet mask and configuration of each subnetwork.

(Solution) 1. There is a need for at least 14 subnetworks.(we need at least 14 subetworks to allow for the all-1s and all-0s subnetids) 2. This means that the minimum number of bits to be allocated for subnetting should be 4, (23 < 14 < 24). 3. 12 bits are left to define the hostids. Subnet mask (11110000 = 240).

Hyung Min Lee Figure 5-11 Masks in example 2

Hyung Min Lee Figure 5-12 Range of addresses in example 2

Hyung Min Lee Figure 5-13 Subnetworks in example 2

Hyung Min Lee Subnetting and Supernetting

( Example 3 / Class C) An organization with a class C address needs at least 5 subnetworks. Find the subnet mask and configuration of each subnetwork.

(Solution) 1. There is a need for at least 7 subnetworks.(we need at least 14 subetworks to allow for the all-1s and all-0s subnetids) 2. This means that the minimum number of bits to be allocated for subnetting should be 3, (22 < 7 < 23). 3. 5 bits are left to define the hostids. Subnet mask (11100000 = 224).

Hyung Min Lee Figure 5-14 Masks in example 3

Hyung Min Lee Figure 5-15 Range of addresses in example 3

Hyung Min Lee Figure 5-16 Subnetworks in example 3

Hyung Min Lee Subnet Short Cut Table

# of Bits 1 2 3 4 5 6 7 8

Incrementing 128 64 32 16 8 4 2 1 Value Subnet Mask 128 192 224 240 248 252 254 255

# of Networks(2n- 0 2 6 14 30 62 126 254 2)

Hyung Min Lee Subnetting and Supernetting

5.4 VARIABLE-LENGTH SUBNETTING

• The allows a site to use variable-length subnetting. ( Example) • An organization with a class C address and needs to have 5 subnets with the following number of hosts: 60, 60, 60, 30, 30. (Solution) 1. The site cannot use a subnet mask with only 2 bits in the subnet section because this allows only 4 subnetworks each 62 hosts(256/4 – 2 = 62), (22<5<23) 2. Nor can the site use a subnet mask with 3 bits in the subnet section because this allows 8 subnetworks each with 30 hosts(256/8 – 2 – 30). 3. (Variable length subnetting ) / The router uses 2 different masks, one applied after the other. 4. It first uses the masks with 26 1s(11111111 11111111 11111111 11000000 or 255.255.255.192) to divide the network into 4 subnets. 5. Then it applies the mask with 27 1s (11111111 11111111 11111111 11100000 or 255.255.255.224) to one of the subnets to divide it into two smaller subnets.

Hyung Min Lee Figure 5-17 Variable-length subnetting

Hyung Min Lee Subnetting and Supernetting

5.5 SUPPERNETTING

• 4 class C addresses combine to make one supernetwork. Figure 5-18 Suppernet Mask • A supernet mask is the reverse of the subnet mask. • In a supernet mask, we change some 1s in the netid section to 0s. • Be aware that the position of 1s in the supernet mask defines the lowest address.

( Example) • With the supernet mask of 255.255.252.0 we can have 4 class C address combined into one supernetwork. • If we choose the first address to be X.Y.32.0, the other three addresses are X.Y.33.0, X.Y.34.0, and X.Y.35.0. • Whenever the router receives a packet, it applies the supernet mask to the destination address and compares the result to the lowest address. If the result and the lowest address are the same, the packet belongs to the supernet.

Hyung Min Lee Figure 5-18 Supernetwork

Hyung Min Lee Figure 5-19 Supernet mask

Hyung Min Lee Figure 5-20 Two ways of defining a supernet

210 = 1024

Hyung Min Lee Figure 5-21 Example of supernetting

Hyung Min Lee Subnetting and Supernetting

Classless Interdomain Routing(CIDR) • Supernetting means assigning a set of class C addresses to an organization that needs more than 254 host addresses.

• However , when these class C addresses are entered into the routing table, each occupies one entry in the routing table./ 256 entries in the routing table.

• The classless interdomain routing(CIDR) technique is devised to reduce the number of routing table entries.

• In this technique, instead of entering each single class C address with its corresponding default mask(255.255.255.0), the router can use the supernet mask and the lowest network address in the group.

Hyung Min Lee Figure 5-22 CIDR

Hyung Min Lee