• An IP address:
- is a 32 bit long identifier
- encodes a network number (network prefix)
and a host number
Dotted Decimal Notation
• IP addresses are written in a so-called dotted decimal
notation
• Each byte is identified by a decimal number in the range
[0..255]:
• Example:
10000000 10001111 10001001 10010000
1st Byte 2nd Byte 3rd Byte 4th Byte
= 128 = 143 = 137 = 144
128.143.137.144
Example
Example:
•IP address is 128.143.137.144
128.143 137.144
Organizations have multiple
networks which are
independently managed
Subnetting allows us to
RD-CSY2001-2009/10 10
Basic Idea of Subnetting
• Split the host number portion of an IP address into a subnet number
and a (smaller) host number.
• Result is a 3-layer hierarchy
• Then:
RD-CSY2001-2009/10 12
• How many host bits CAN/DO I have to borrow to create
required subnets
– Depends on the class of your network address.
– How do you find the IP address class?
• First octet of IP address
– What are the host bits for the default subnet mask?
• Class C:
– 8 host bits
• Class B:
– 16 host bits
• Class A:
– 24 host bits
RD-CSY2001-2009/10 13
• Class C Address: 210.93.45.0
– Requirement: At least 5 subnets
– how many bits do we borrow (Bits Borrow (BB))?
– How many bits in the host portion (HB) do we have for
default mask?
Since it’s a Class C, we have 8 bits to work with.
– 2 to what power will give us at least 5 subnets?
3
2 - 2 = 6 subnets
– How many bits are left for hosts?
Bits left = Bits available – bits borrowed
5 = 8-3
– Assignable host addresses
5
2 - 2 = 30 hosts
We add up the decimal value of these bits and get 224 (128+64+32).
RD-CSY2001-2009/10 15
• In our Class C example, our subnet mask was
255.255.255.224.
– 224 is our last non-zero octet.
RD-CSY2001-2009/10 16
• We now take our “magic number” and use it as a multiplier
• Our Class C address was 210.93.45.0.
• We borrowed bits in the fourth octet, so that’s where our
multiplier occurs.
– 1st subnet: 210.93.45.32
– 2nd subnet: 210.93.45.64
– 3rd subnet: 210.93.45.96
– 4th subnet: 210.93.45.128
– 5th subnet: 210.93.45.160
– 6th subnet: 210.93.45.192
RD-CSY2001-2009/10 17
• Now you can see why we subtract 2 when determining the number
of host addresses.
– Let’s look at our 1st subnet: 210.93.45.32
– What is the total range of addresses up to our next subnet,
210.93.45.64?
210.93.45.32 to 210.93.45.63 or 32 addresses
– .32 cannot be assigned to a host. Why?
Because it is the subnet’s address.
– .63 cannot be assigned to a host. Why?
Because it is the subnet’s broadcast address.
– So our host addresses are
• .33 - .62 or 30 host addresses--just like we figured out earlier.
RD-CSY2001-2009/10 18
Advantages of Subnetting
• With subnetting, IP addresses use a 3-layer hierarchy:
» Network
» Subnet
» Host
• Improves efficiency of IP addresses by not consuming an
entire address space for each physical network.
• Reduces router complexity. Since external routers do not know
about subnetting, the complexity of routing tables at external
routers is reduced.
Given the following Host IP Address, Network Mask and Subnet mask find the following
information:
• Major Network Information
– Major Network Address
– Major Network Broadcast Address
– Range of Hosts if not subnetted
• Subnet Information
– Subnet Address
– Range of Host Addresses (first host and last host)
– Broadcast Address
• Other Subnet Information
– Total number of subnets
– Number of hosts per subnet
Major Network Information
• Host IP Address: 138.101.114.250
• Network Mask: 255.255.0.0
• Subnet Mask: 255.255.255.192
Step 1:
Translate Host IP Address and Subnet Mask into binary notation
Step 2: Find the Subnet Address
138. 101. 114. 250
IP Address 10001010 01100101 01110010 11111010
Mask 11111111 11111111 11111111 11000000
Network 10001010 01100101 01110010 11000000
138 101 114 192
Step 2:
Determine the Network (or Subnet) where this Host address lives:
1. Draw a line under the mask
2. Perform a bit-wise AND operation on the IP Address and the Subnet Mask
Note: 1 AND 1 results in a 1, 0 AND anything results in a 0
3. Express the result in Dotted Decimal Notation
4. The result is the Subnet Address of this Subnet or “Wire” which is
138.101.114.192
Step 3: Subnet Range G.D.
/ Host Range
S.D.
Host Portion
• Subnet Address: all 0’s
• First Host: all 0’s and a 1
• Last Host: all 1’s and a 0
• Broadcast: all 1’s
Step 5: Total Number of Subnets
G.D. S.D.
• TotalFirstnumber
Host of138subnets
10001010 01100101
101
01110010
114
11 000001
193
– Number
Last Host
of subnet
10001010
bits 01100101
10 01110010 11 111110
– 210 = 1,024 138 101 114 254
• TotalFirstnumber
Host of hosts per
10001010 subnet 01110010
01100101 11 000001
138 101 114 193
– Number of host bits 6
Last Host 10001010 01100101 01110010 11 111110
– 2 = 64
6
138 101 114 254
– 64Broadcast
host per subnets
10001010 01100101 01110010 11 111111
• Subtract one for
138the subnet 101
address 114 255
RD-CSY3021-2008/09
• Variable Length Subnet Masking allows division of address
space based on the size of networks
– Start with network requiring the most addresses
– Create a subnet mask
• (use CIDR – Classless Inter Domain Routing)
– Subnet the subnet as needed to provide address space
required for other subnets
• Be logical – start at beginning or end or address space
• Addresses must be contiguous to enable route
summarization
RD-CSY3021-2008/09
VLSM
• VLSM – the process of
sub-netting a subnet to fit
your needs
-Example:
Subnet 10.1.0.0/16, 8
more bits are borrowed
again, to create 256 subnets
with a /24 mask.
– -Mask allows for 254
host addresses per
subnet
– -Subnets range from:
10.1.0.0 / 24 to
10.1.255.0 / 24
* Same process for Subnet
10.2.0.0/16
VLSM
• Subnet 10.3.0.0/16, 12 more
bits are borrowed again, to
create 4,096 subnets with a /28
mask.
–Mask allows for 14 host
addresses per subnet
–Subnets range from: 10.3.0.0
/ 28 to 10.3.255.240 / 28
• Subnet 10.4.0.0/16, 4 more bits
are borrowed again, to create
16 subnets with a /20 mask.
–Mask allows for 2,046 host
addresses per subnet
–Subnets range from: 10.4.0.0
/ 20 to 10.4.240.0 / 20
RD-CSY3021-2008/09
RD-CSY3021-2008/09
Variable-Length Subnets
• To allow maximum flexibility in choosing how
to partition subnet addresses, the TCP/IP
subnet standard permits variable-length
subnetting in which the partition can be
chosen independently for each physical
network. Once a subnet partition has been
selected, all machines on that network must
honor it.
• The chief advantage of variable-length
subnetting is flexibility.
• variable-length subnetting has serious
disadvantages.
– values for subnets must be assigned carefully to
avoid address ambiguity,
– Routers cannot resolve such ambiguity, which
means that an invalid assignment can only be
repaired by renumbering.
Implementation Of Subnets
Deci
mal 128 64 32 16 8 4 2 1
value
• Convert decimal to binary
– To convert a decimal number in binary we would
use addition till number method. In this method
we start adding from left to get target value. If
after adding right position value, sum is lower
than target number, keep adding, or if sum is
greater than target number skip the position
value. Only the value of on bit [1] will be added in
sum. Off bit [0] has zero value.
Decima
128 64 32 16 8 4 2 1
l value
Bit
0 1 1 1 0 1 0 1
status
Decima
l value
in 0 64 32 16 0 4 0 1
additio
n
Decimal calculation Bit in binary
Base
positio 27 26 25 24 23 22 21 20
n
Decima
128 64 32 16 8 4 2 1
l value
Bit
1 0 1 0 1 0 1 0
status
Decima
l value
in 128 0 32 0 8 0 2 0
additio
n
• Decimal value of 10101010 is
• 170 [ 128+0+32+0+8+0+2+0 ]
Binary bit Decimal value
1 On bit 128
0 Off bit 0
1 On bit 64
0 Off bit 0
1 On bit 32
0 Off bit 0
1 On bit 8
0 Off bit 0
1 On bit 2
0 Off bit 0
Classless Addressing (Supernetting)
• It is an modern representation
• The main goal is to redue wastage of IP address
• It was introduces in 1993 by internet engineering
task force
• It i to replace yhe previous addressing architecture
• It provides address in block size.
• Example: 200.200.200.200/24
198.10.20.30/28
CIDR Notation