Title: Subnetting
1Subnetting
- Dividing a network into multiple networks
2Limitations of this approach
- Subnets are created in lumpy increments
- A class A network can have 1, 254, or 65,534
subnets with 16,777,214, 65,534, or 254 hosts /
subnet respectively - A class B network can have 1 or 254 subnets with
65,534, or 254 hosts / subnet respectively - A class C network can only have 1 subnet (no
subnetting) - One result is wasted IP addresses due to use of
lumpy increments - What if?
- Your physical network supported 1000, 2000
hosts/segment? - If you had a class B network, youd be forced to
create artificially small network segments. - What if you had a class B (or class C) network
and needed more than 254 subnets (or more than 1
subnet)?
3Use of partial octets for mask
- You don't need to allocate the whole octet for
just one use. - So far, octet has been all subnet ID or all host
ID - One octet in the mask can be defined as being
used in part for subnet ID, and partly for host
ID - With a few restrictions, you can allocate any
number of bits in this octets for subnet number
and host ID - Restriction
- At least two bits are needed to represent subnet
ID - At least two bits are used to represent host ID.
4Restrictions on masks
class A
Dividing line between 1s and zeros can be
placed anywhere between these limits
Default mask
2 bit minimum for host ID (all 0s)
2 bit minimum for subnet ID (all 1s)
Class B
2 bit minimum for subnet ID (all 1s)
2 bit minimum for host ID (all 0s)
Default mask
Class C
Everything to the left of the dividing line will
be all 1s, all 0s are to the right
Default mask
5Class B subnet example
- The first two octets represent the IP Network
number. - You can use between 2 and 14 bits of the host ID
to represent subnet ID - You can use between 2 and 14 bits to represent
host ID - Let's say you used 6 bits of the IP host ID area
to represent subnet ID - The resulting subnet mask would be 255.255.252.0
bit position within the octet
Default mask
Mask for subnet
Host ID
6Determining number of subnets hosts/subnet
possible for a subnet mask
- To determine possible number of subnets and
possible number of hosts per subnet, use the
following - subnets 2( number of bits used to store the
subnet ID) - 2 - hosts / subnet 2( number of bits used to store
the host ID) 2 - Example Class B mask 255.255.252.0 uses 6 bits
to represent subnet ID, and 10 bits to represent
Host ID within the subnet - subnets 26 2 64 2 or 62 subnets
- hosts / subnet 210 2 1024 2 or 1022
hosts - Why minus 2?
- Subnet ID shouldnt be all 1s or all 0s
- Host ID cant be all 1s or all 0s
7Possible octet mask values
- There are 9 possible values any given octet will
be in a subnet mask - 255 - all 8 bits are part of the subnet mask -
11111111 - 254 - 1st 7 bits are part of the subnet mask -
11111110 - 252 - 1st 6 bits are part of the subnet mask -
11111100 - 248 - 1st 5 bits are part of the subnet mask -
11111000 - 240 - 1st 4 bits are part of the subnet mask -
11110000 - 224 - 1st 3 bits are part of the subnet mask -
11100000 - 192 - 1st 2 bits are part of the subnet mask -
11000000 - 128 - 1st bit is part of the subnet mask -
10000000 - 0 - all of the octet represents host ID
- 00000000
8More examples
- Class A mask 255.255.192.0
- 10 bits used for subnet mask 1022 subnets
possible - 14 bits used for host ID (within subnet) 16,382
maximum / subnet - Class B mask 255.255.248.0
- 5 bits used for subnet mask 30 subnets possible
- 11 bits used for host ID 2046 hosts / subnet
- Class C mask 255.255.255.224
- 3 bits used for subnet mask 6 subnets possible
- 5 bits used for host ID 30 hosts / subnet
9Defining a subnet mask
- Feasible masks are limited by
- How many network segments you need
- indicates minimum number of bits needed in subnet
mask for subnet ID - Expected maximum number of hosts / segment
- indicates minimum number of bits needed in subnet
mask to represent host ID - This should give you one or more options of masks
that would provide the needed number of subnets
and hosts/ subnet - If not, youve specified an impossible solutions,
e.g. 50 subnets with 200 hosts/subnet on a class
C network.
10Defining a subnet mask
- Determine the number of bits for subnet ID
- Add 2 to the number of subnets needed
- Convert this number into binary and determine how
many binary digits are needed - 4 subnets 4 2 (6) is 110 (requires 3 bits)
- 100 subnets 100 2 (102) is 1100120 (requires
7 bits) - 500 subnets 500 2 (502) is 111110100 (requires
9 bits) - After the default mask for the network ID,
allocate that number of bits as 1s in the mask - Why add 2?
- subnet ID shouldnt be all 0s or all 1s (see
next slide)
11Defining a subnet mask
- With a 3 bit subnet mask, there are 8 numbers
that can be represented - As shown below, zero and 224 (all 0s and all
1s) would normally not be used for subnet IDs - This results in only 6 usable subnet IDs being
possible given 3 bits
12Defining a subnet mask
- Assume a class A network
- 4 subnets
- 11111111.1110000.00000000.00000000 or
255.224.0.0 - 100 subnets
- 11111111.11111110.00000000.0000000 or
255.254.0.0 - 500 subnets
- 11111111.11111111.10000000.00000000 or
255.255.128.0 - Assume a class B network
- 4 subnets 255.255.224.0
- 100 subnets 255.255.254.0
- 500 subnets 255.255.255.128
13Defining a subnet mask
- Determine number of hosts needed per network
segment - Add 2 to this number
- Convert this number into binary and determine how
many binary digits are needed - 4 hosts is 110 (requires 3 bits)
- 100 hosts is 1100110 (requires 7 bits)
- 500 hosts is 111110110 (requires 9 bits)
- Your mask must have at least the required number
of bits set to zero in the low-order (right-hand)
positions of the mask - Plus 2? host ID cannot be all 1s or all 0s
14Defining subnet IDs and Host IDs
- The subnet mask is used to determine possible
subnet IDs for the network - These are assigned them to the networks
subnetworks - Given a subnet ID, that defines the range of
possible host IDs - Determining the network ID host ID from an IP
address with such a partial-octet mask is NOT
user-friendly
15Defining subnet IDs
- Assume an octet mask of 224 11100000
- Start numbering IDs at 00100000
- End number of IDs at 11000000
- Convert each 8-bit number to decimal for
interpretation
00000000 0 00100000 32 01000000 64 01100000
96 10000000 128 10100000 160 11000000
192 11100000 224
Not used
16A shortcut for enumerating subnet IDs
- For a given mask such as 224
- Determine the decimal value of the 1st (lowest)
possible subnet ID value in the octet. - For example, with 224, this number was 32
- Add 32 to the current subnet ID to determine the
next subnet ID 64 32 32 - Repeat the above until you enumerate all possible
IDs - 96 64 32
- 128 96 32 .. And so on
17Defining the range of host IDs for each subnet
- The starting point for the range of host IDs is
to set the right-most host ID bit to be one, and
all other host ID bits to be zero - The end-point would be the reverse the
right-most host ID bit is set to zero, and all
other host ID bits are ones. - For example, given a 255.255.224.0 subnet mask
Invalid x.y.32.1 x.y.63.254 x.y.64.1
x.y.95.254 x.y.96.1 x.y.127.254 x.y.128.1
x.y.159.254 x.y.160.1 x.y.191.254 x.y.192.1
x.y.223.254 Invalid
Host ID Ranges
Subnet IDs
18Interpreting the IP address
- Following from the last slide
- x.y.32.1 is x.y.001 00000.00000001
- x.y.63.254 is x.y.001 11111.11111110
- 00100000 (32) 11111 (31) equals 63
- x.y.64.1 is x.y.010 00000.00000001
- x.y.95.254 is x.y.010 11111.11111110
- 01000000 (64) 11111 (31) equals 95
19Bitwise anding
- A prior explanation for mask use said that for a
given bit - "1" over a number says "Look at the number
underneath" a "0" says "Don't look. - What hosts really do with a mask is to perform
bitwise anding of mask bits with IP address bits - Logical anding
- 1 and 1 yields 1
- 1 and 0 yields 0
- 0 and 1 yields 0
- 0 and 0 yields 0
20Bitwise anding examples
Remaining Values
32-32 0
63-32 31
45-32 13
73-64 9
21Example of two class B subnetworks with a
255.255.224.0 mask
Network 131.210.64.0 Mask 255.255.224.0
Network 131.210.32.0 Mask 255.255.224.0
131.210.32.100
131.210.64.56
131.210.73.123
131.210.45.150
To the Internet
22Example 1 use of the subnet mask
Source host
- Suppose host 131.210.32.100 wants to send a
packet to 131.210.45.150 - 1st, the host uses its subnet mask to determine
its own subnet ID - Then the host applies its mask to the destination
address - If these two numbers are the same, it indicates
that the destination is on the same subnet as the
source it doesnt need to be routed.
Destination host
23Example 2 use of the subnet mask
Source host
- Suppose host 131.210.32.100 wants to send a
packet to 131.210.73.123 - The host uses its subnet mask is used to
determine its subnet ID - Then the host applies its mask to the destination
address - If these two numbers are not the same, it
indicates that the destination is on a different
subnet than the source it needs to be routed.
Destination host
24Example 3 use of the subnet mask
Source host
- Suppose host 131.210.32.100 wants to send a
packet to 60.5.10.100 (somewhere on the Internet) - The host uses its subnet mask is used to
determine its subnet ID - Then the host applies its mask to the destination
address - If these two numbers are the same, it indicates
that the destination is on a different subnet
than the source it needs to be routed. - The router sends it onto the Internet since its
not a local subnet, its on a network of a
different organization
Destination host
25Alternate way of expressing mask
- 131.210.32.100/19
- This says that the mask is 255.255.224.0 (19
bits) - Subnet 131.210.32.0, host 0.0.0.100
- 131.210.73.123/19
- This says that the mask is 255.255.224.0 (19
bits) - Subnet 131.210.64.0, host 0.0.9.123
- 10.1.53.100/20
- The mask is 255.255.240.0 (20 bits)
- Subnet 10.1.48.0, host 0.0.5.100
26Designing a Variable-Length Subnet Mask
- Analyze requirements for individual subnets
- Aggregate requirements by their relationships to
the nearest power of two - Use subnets that require largest number of
devices - To decide the minimum size of the subnet mask
- Aggregate subnets that require fewer of hosts
- Define VLSM scheme that
- Provides the necessary number of subnets of each
size to fit its intended use best
27Calculating Supernets
- Supernets
- Steal bits from network portion of an IP
address to lend those bits to the host - Permit multiple IP network addresses to be
combined - Allow an entire group of hosts to be reached
through a single router address
28Classless Inter-Domain Routing
- Limitations
- Network addresses must be contiguous
- When address aggregation occurs
- CIDR address blocks work best when they come in
sets that are greater than 1 and equal to some
lower-order bit pattern that corresponds to all
1s - Addresses commonly applied to Class C addresses
- To use a CIDR address on any network
- Routers in routing domain must understand CIDR
notation
29Public Versus Private IP Addresses
- Private IP addresses ranges
- May be in the form of IP network addresses
- Address masquerading
- May be performed by boundary devices that include
proxy server capabilities - Private IP address limitation
- Some IP services require a secure end-to-end
connection
30(No Transcript)