0% found this document useful (0 votes)
326 views44 pages

IP Subnetting

The document discusses IP subnetting. It begins by explaining that a subnet mask is used to separate the network portion of an IP address from the host portion. It then provides examples of how subnet masks are used to divide a single network into multiple subnets. The examples show how the bitwise AND operation is used on the IP address and subnet mask. It also illustrates how subnetting reduces the maximum number of hosts per subnet by reserving two IP addresses for the subnet network and broadcast addresses.

Uploaded by

Ali Akhtar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
326 views44 pages

IP Subnetting

The document discusses IP subnetting. It begins by explaining that a subnet mask is used to separate the network portion of an IP address from the host portion. It then provides examples of how subnet masks are used to divide a single network into multiple subnets. The examples show how the bitwise AND operation is used on the IP address and subnet mask. It also illustrates how subnetting reduces the maximum number of hosts per subnet by reserving two IP addresses for the subnet network and broadcast addresses.

Uploaded by

Ali Akhtar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

IP Subnetting

Subnet Mask

Host: Im a host on the 192.168.1.0/24 network.


The subnet mask is used to separate the network portion from the host portion of the address. On a host, the subnet mask tells the host what network it belongs to.

Subnet Mask

Host: Im a host on the 192.168.1.0/24 network.


Why does a host need to know what network it belongs to? So, it knows whether to encapsulate the IP packet into an Ethernet frame with: The Destination MAC Address of the default gateway Must know the default gateways IP address The Destination MAC Address of the host with the Destination IP address of the packet
3

Subnet Mask
Network Host

Host IP: 172.16.33.10 10101100.00010000.00100001.00001010 Mask: 255.255.0.0 11111111.11111111.00000000.00000000 ----------------------------------Net Add: 172.16.0.0 10101100.00010000.00000000.00000000

Devices such as hosts use the bit-wise AND operation on the: Host IP address Subnet mask AND operation: 1 AND 1 = 1 0 AND anything = 0
4

Subnet Mask
Network Host

Host IP: 172.16.33.10 10101100.00010000.00100001.00001010 Mask: 255.255.255.0 11111111.11111111.11111111.00000000 ----------------------------------Net Add: 172.16.33.0 10101100.00010000.00100001.00000000

AND operation: 1 AND 1 = 1 0 AND anything = 0

Subnet Mask
Network Host

Host IP: 172.1.17.9 Mask: 255.255.240.0 Net Add: 172.1.16.0

10101100.00000001.00010001.00001001 11111111.11111111.11110000.00000000 ----------------------------------10101100.00000001.00010000.00000000

AND operation: 1 AND 1 = 1 0 AND anything = 0

Subnet Masks: Non-Natural Boundaries


Subnet masks do not have to end on natural octet boundaries 172.1.16.0 10101100.00000001.00010000.00000000 255.255.240.0 11111111.11111111.11110000.00000000 172.1.16.1 172.1.31.254 172.1.31.255 (broadcast) 10101100.00000001.00010000.00000001 10101100.00000001.00011111.11111110 10101100.00000001.00011111.11111111

Number of hosts: 212 2 = 4,096 2 = 4,094 hosts


7

Subnets and Subnet Masks

Formalized in 1985, the subnet mask breaks a single network in to smaller pieces.
Allows network administrators to divide their network into small networks or subnets.

What is subnetting?
Network Network 172 16 Host 0 Host 0

Network Network

Subnet

Host

Subnetting is the process of borrowing bits from the HOST bits, in order to divide the larger network into small subnets. Subnetting does NOT give you more hosts, but actually costs you hosts. You lose two host IP Addresses for each subnet, one for the subnet IP address and one for the subnet broadcast IP address. You lose the last subnet and all of its hosts IP addresses as the broadcast for that subnet is the same as the broadcast for the network. In older technology, you would have lost the first subnet, as the subnet IP address is the same as the network IP address. (This subnet can be used in most networks.)
9

Analogy
Before subnetting: In any network (or subnet) we can not use all the IP addresses for host addresses. We lose two addresses for every network or subnet. 1. Network Address - One address is reserved to that of the network. For Example: 172.16.0.0 /16 2. Broadcast Address One address is reserved to address all hosts in that network or subnet. For Example: 172.16.255.255 This gives us a total of 65,534 usable hosts

98 Apples (100 2)

10

Analogy

10 barrels x 10 apples = 100 apples 10 10 10

98 Apples (100 2)

10

10

10

10

10

10

10
It is the same as taking a barrel of 100 apples and dividing it into 10 barrels of 10 apples each.

11

2 = 1 network address + 1 broadcast address

10 barrels x 8 apples = 80 apples 8


(less 2)

8
(less 2)

8
(less 2)

98 Apples (100 2)

8
(less 2)

8
(less 2)

8
(less 2)

8
(less 2)

8
(less 2)

8
(less 2)

However, in subnetting we will see that we lose two apples per subnet: one for the network address one for the broadcast address

8
(less 2)

12

2 = 1 network address + 1 broadcast address

8 barrels x 8 apples = 64 apples 8

X
(less 2) (less 2)

8
(less 2)

8
(less 2)

98 Apples (100 2)

8
(less 2)

8
(less 2)

8
(less 2)

8
(less 2)

8
(less 2)

In legacy networks, we also lost: The first basket (subnet) The network address of the first subnet is the network address of the entire network The last basket (subnet) The broadcast address for the last subnet is the same as for the entire network.

X
(less 2)

13

14

15

Subnet Example
Network address 172.16.0.0 with /16 Base Network Mask Using Subnets: Subnet Mask 255.255.255.0 or /24
Subnet addresses: All 0s in host portion

Network Network 172 172 172 172 172 172 172 16 16 16 16 16 16 16

Subnet 0 1 2 3 Etc. 254 255

Host 0 0 0 0 0 0 0
16

Subnets Addresses
256 Subnets 28

Subnet Example
Network address 172.16.0.0 with /16 Base Network Mask Using Subnets: Subnet Mask 255.255.255.0 or /24

Network Network 172 172 172 172 172 172 172 16 16 16 16 16 16 16

Subnet 0 1 2 3 Etc. 254 255

Hosts 1 1 1 1 1 1 1 254 254 254 254 254 254 254

Broadcast

255 255 255 255 255 255 255


17

Each subnet has 254 hosts, 28 2

Host IP Address: 172.16.3.50 A host of the 172.16.3.0 /24 network With NO subnetting:
Network 172.16.0.0 First Host 172.16.0.1 Last Host 172.16.255.254 Broadcast 172.16.255.255

65,534 host addresses, one for network address and one for broadcast address. Host IP Address: 172.16.3.50 A host of the 172.16.0.0 /16 network

18

With subnetting:
Network 172.16.0.0 172.16.1.0 172.16.2.0 172.16.3.0 172.16.4.0 172.16.5.0 172.16.6.0 172.16.7.0 172.16.254.0 172.16.255.0

Host IP Address: 172.16.3.50 A host of the 172.16.3.0 /24 network


Last Host 172.16.0.254 172.16.1.254 172.16.2.254 172.16.3.254 172.16.4.254 172.16.5.254 172.16.6.254 172.16.7.254 172.16.254.254 172.16.255.254 Broadcast 172.16.0.255 172.16.1.255 172.16.2.255 172.16.3.255 172.16.4.255 172.16.5.255 172.16.6.255 172.16.7.255 172.16.15.255 172.16.255.255

First Host 172.16.0.1 172.16.1.1 172.16.2.1 172.16.3.1 172.16.4.1 172.16.5.1 172.16.6.1 172.16.7.1 172.16.254.1 172.16.255.1

19

With subnetting:
Network 172.16.0.0 172.16.1.0 172.16.2.0 172.16.3.0 172.16.4.0 172.16.5.0 172.16.6.0 172.16.7.0 172.16.254.0 172.16.255.0 First Host 172.16.0.1 172.16.1.1 172.16.2.1 172.16.3.1 172.16.4.1 172.16.5.1 172.16.6.1 172.16.7.1 172.16.254.1 172.16.255.1 Last Host 172.16.0.254 172.16.1.254 172.16.2.254 172.16.3.254 172.16.4.254 172.16.5.254 172.16.6.254 172.16.7.254 172.16.254.254 172.16.255.254 Broadcast 172.16.0.255 172.16.1.255 172.16.2.255 172.16.3.255 172.16.4.255 172.16.5.255 172.16.6.255 172.16.7.255 172.16.15.255 172.16.255.255 Hosts 254 254 254 254 254 254 254 254 254 254 --65,024

Total address = 256 subnets * (256 hosts 2) = 256 * 254 = 65,024 NOTE: It is common for some network administrator to not use the last subnet.

20

With subnetting:
Network 172.16.0.0 172.16.255.0 First Host 172.16.0.1 172.16.255.1 Last Host Broadcast 172.16.0.254 172.16.0.255 172.16.255.254 172.16.255.255

Major Network Address: 172.16.0.0 Major Network Mask: 255.255.0.0 Major Network Broadcast Address: 172.16.255.255 Subnet Mask: 255.255.255.0 First Subnet: Subnet Address: 172.16.0.0 Subnet Broadcast Address: 172.16.0.255 Last Subnet: Subnet Address: 172.16.255.0 Subnet Broadcast Address: 172.16.255.255

21

Determining Network and Subnet Information


Given any IP address and major network mask we can determine: Major Network Address First host address of the network Last host address of the network Broadcast address of the network Number of usable hosts in the network If the network is subnetted and we know the subnet mask we can determine: Subnet (network) Address First host address of the subnet Last host address of the subnet Broadcast address of the subnet Number of usable hosts in the subnet Number of usable subnets in this network

22

Calculating the number subnets/hosts needed

172.16.1.0 255.255.255.0
Network Host

Network 172.16.1.0/24 Need: As many subnets as possible, 60 hosts per subnet

23

Calculating the number subnets/hosts needed

Number of hosts per subnet

172.16.1. 0 0 0 0 0 0 0 0 255.255.255. 0 0 0 0 0 0 0 0
Network Host 6 host bits

Network 172.16.1.0/24 Need: As many subnets as possible, 60 hosts per subnet

24

Calculating the number subnets/hosts needed

Number of subnets

172.16.1. 0 0 0 0 0 0 0 0 255.255.255. 1 1 0 0 0 0 0 0
Network Host 255.255.255.192 6 host bits

Network 172.16.1.0/24 Need: As many subnets as possible, 60 hosts per subnet New Subnet Mask: 255.255.255.192 (/26) Number of Hosts per subnet: 6 bits, 64-2 hosts, 62 hosts Number of Subnets: 2 bits or 4 subnets

25

Calculating the number subnets/hosts needed

172.16.1.0 255.255.255.0
Network Host

Network 172.16.1.0/24 Need: As many subnets as possible, 12 hosts per subnet

26

Calculating the number subnets/hosts needed

Number of hosts per subnet

172.16.1. 0 0 0 0 0 0 0 0 255.255.255. 0 0 0 0 0 0 0 0
Network Host 4 host bits

Network 172.16.1.0/24 Need: As many subnets as possible, 12 hosts per subnet

27

Calculating the number subnets/hosts needed

Number of hosts per subnet Number of subnets

172.16.1. 0 0 0 0 0 0 0 0 255.255.255. 1 1 1 1 0 0 0 0
Network Host 255.255.255.240 4 host bits

Network 172.16.1.0/24 Need: As many subnets as possible, 12 hosts per subnet New Subnet Mask: 255.255.255.240 (/28) Number of Hosts per subnet: 4 bits, 16-2 hosts, 14 hosts Number of Subnets: 4 bits or 16 subnets

28

Calculating the number subnets/hosts needed

172.16.1.0 255.255.255.0
Network Host

Network 172.16.1.0/24 Need: Need 6 subnets, as many hosts per subnet as possible

29

Calculating the number subnets/hosts needed

Number of subnets

172.16.1. 0 0 0 0 0 0 0 0 255.255.255. 0 0 0 0 0 0 0 0
3 subnet bits Network Host

Network 172.16.1.0/24 Need: Need 6 subnets, as many hosts per subnet as possible

30

Calculating the number subnets/hosts needed

Number of hosts per subnet

Number of subnets

172.16.1. 0 0 0 0 0 0 0 0 255.255.255. 1 1 1 0 0 0 0 0
3 subnet bits Network Host 255.255.255.224

Network 172.16.1.0/24 Need: Need 6 subnets, as many hosts per subnet as possible New Subnet Mask: 255.255.255.224 (/27) Number of Hosts per subnet: 5 bits, 32-2 hosts, 30 hosts Number of Subnets: 3 bits or 8 subnets

31

VLSM (Variable Length Subnet Mask)


If you know how to subnet, you can do VLSM. Example: 10.0.0.0/8 Subnet in /16 subnets: 10.0.0.0/16 10.1.0.0/16 10.2.0.0/16 10.3.0.0/16 Etc. Subnet one of the subnets (10.1.0.0/16) 10.1.0.0/24 10.1.1.0/24 10.1.2.0/24 10.1.3.0/24 etc
32

What is VLSM and Why is it used?

VLSM allows an organization to use more than one subnet mask within the same network address space. Implementing VLSM is often referred to as "subnetting a subnet", and can be used to maximize addressing efficiency. Classful routing protocols require that a single network use the same subnet mask. Therefore, network 192.168.187.0 must use just one subnet mask such as 255.255.255.0. VLSM is simply a feature that allows a single autonomous system to have networks with different subnet masks. If a routing protocol allows VLSM, use a 30-bit subnet mask on network connections, 255.255.255.252, a 24-bit mask for user networks, 255.255.255.0, or even a 22-bit mask, 255.255.252.0, for networks with up to 1000 users.

33

A waste of Space

The above addressing scheme is fine for a small LAN. However, this addressing scheme is extremely wasteful if using point-to-point connections
34

When to use VLSM?

35

When to use VLSM?

Subnet 6 is further broken into /30 subnets for Point-to-Point WAN Links

36

When to use VLSM?

37

Route Aggregation with VLSM


When using VLSM, try to keep the subnetwork numbers grouped together in the network to allow for aggregation. This means keeping networks like 172.16.14.0 and 172.16.15.0 near one another so that the routers need only carry a route for 172.16.14.0/23. The use of Classless InterDomain Routing (CIDR) and VLSM not only prevents address waste, but also promotes route aggregation, or summarization. Without route summarization, Internet backbone routing would likely have collapsed sometime before 1997 Route summarization, or supernetting, is only possible if the routers of a network run a classless routing protocol, such as OSPF or EIGRP. Classless routing protocols carry a prefix that consists of 32-bit IP address and bit mask in the routing updates. For summarization to work properly, carefully assign addresses in a hierarchical fashion so that summarized addresses will share the same highorder bits.

38

Route Aggregation with VLSM

Remember the following rules: 1. A router must know in detail the subnet numbers attached to it. 2. A router does not need to tell other routers about each individual subnet if the router can send one aggregate route for a set of routers. 3. A router using aggregate routes would have fewer entries in its routing table.

39

Route Aggregation with VLSM

Remember the following rules: 1. A router must know in detail the subnet numbers attached to it. 2. A router does not need to tell other routers about each individual subnet if the router can send one aggregate route for a set of routers. 3. A router using aggregate routes would have fewer entries in its routing table.

40

Route Aggregation with VLSM

What is the summary route ?


41

Route Aggregation with VLSM

42

Subnetting Exercise 1
Host IP Address Network Mask Subnet Mask Find: Number of Subnet Bits Number of Subnets Number of Host Bits per Subnet Number of Usable Hosts per Subnet Subnet Address for this IP Address IP Address of First Host on this Subnet IP Address of Last Host on this Subnet Broadcast Address for this Subnet 172.25.114.250 255.255.0.0 (/16) 255.255.255.192 (/26)

43

Subnetting Exercise 2

Host IP Address Subnet Mask Number of Subnet Bits Number of Subnets Number of Host Bits per Subnet Number of Usable Hosts per Subnet Subnet Address for this IP Address IP Address of First Host on this Subnet IP Address of Last Host on this Subnet Broadcast Address for this Subnet

172.30.1.33 255.255.255.0

44

You might also like