Anda di halaman 1dari 60

Subnets

Routing within an Organization


What is an IP Address?
• An IP address is a unique global address for a network
interface

• 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

•Using Prefix notation IP address is: 128.143.137.144/16


– Network prefix is 16 bits long

•Network mask is: 255.255.0.0 or hex format: ffff0000


-----> Network id (IP address AND Netmask) is: 128.143.0.0
-----> Host number (IP address AND inverse of Netmask) is: 137.144

128.143 137.144
 Organizations have multiple
networks which are
independently managed
 Subnetting allows us to

University Network break LANs into small sub-


networks
 Sub-networks created by
borrowing bits from host-id.
from the given IP address
 What are the maximum
Engineering Business number of bits that can be
School School borrowed in a
– Class C address?
Library – Class B address?

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

network prefix host number

network prefix subnet number host number

extended network prefix

• Then:

• Subnets can be freely assigned within the organization


• Internally, subnets are treated as separate networks
• Subnet structure is not visible outside the organization
• Steps
– Know how many Different Networks are required
– Borrow bits from the host portion of the IP address
– Find New Subnet Mask.
– Calculate the number of sub-networks and the hosts
available corresponding to borrowed bits
– Find the sub-network boundary
• Network Address
• Find the broadcast address.
• Let’s look at each of these steps in detail

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

One network address, one broadcast address


RD-CSY2001-2009/10 14
• We determine the new subnet mask by adding up the
decimal value of the bits we borrowed.
• In the previous Class C example, we borrowed 3 bits.
Below is the host octet showing the bits we borrowed and
their decimal values.
1 1 1
128 64 32 16 8 4 2 1

We add up the decimal value of these bits and get 224 (128+64+32).

NEW subnet mask is 255.255.255.224 (as against default subnet mask of


255.255.255.0)

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.

• Our magic number is 256 - 224 = 32


– Note: The last bit borrowed was the 32 bit.

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.

• Note: Length of the subnet mask need not be identical at all


subnetworks.
Example 1

What is the subnetwork address if the


destination address is 200.45.34.56 and the
subnet mask is 255.255.240.0?
Solution

11001000 00101101 00100010 00111000


11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.


Short-Cut Method
** If the byte in the mask is 255, copy
the byte in the address.
** If the byte in the mask is 0, replace
the byte in the address with 0.
** If the byte in the mask is neither 255
nor 0, we write the mask and the address
in binary and apply the AND operation.
Example 2

What is the subnetwork address if the


destination address is 19.30.84.5 and the
mask is 255.255.192.0?
Solution
Figure 5-6
Example 2
Figure 5-7

Comparison of a default mask and


a subnet mask
The number of subnets must be
a power of 2.
Subnetting – Example
• Host IP Address: 138.101.114.250
• Network Mask: 255.255.0.0 (or /16)
• Subnet Mask: 255.255.255.192 (or /26)

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

• Major Network Address: 138.101.0.0


• Major Network Broadcast Address: 138.101.255.255
• Range of Hosts if not Subnetted: 138.101.0.1 to 138.101.255.254
Step 1: Convert to Binary
128 64 32 16 8 4 2 1

138. 101. 114. 250


IP Address 10001010 01100101 01110010 11111010
Mask 11111111 11111111 11111111 11000000
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.

IP Address 10001010 01100101 01110010 11 111010


Mask 11111111 11111111 11111111 11 000000
Network 10001010 01100101 01110010 11 000000
 subnet   host 
counting range counting
range
Step 3:
Determine which bits in the address contain Network (subnet) information and
which contain Host information:
• Use the Network Mask: 255.255.0.0 and divide (Great Divide) the from the
rest of the address.
• Use Subnet Mask: 255.255.255.192 and divide (Small Divide) the subnet
from the hosts between the last “1” and the first “0” in the subnet mask.
Step 4: First Host / G.D.
Last Host S.D.
IP Address 10001010 01100101 01110010 11 111010
Mask 11111111 11111111 11111111 11 000000
Network 10001010 01100101 01110010 11 000000
 subnet   host 
counting range counting
range

First Host 10001010 01100101 01110010 11 000001


138 101 114 193

Last Host 10001010 01100101 01110010 11 111110


138 101 114 254

Broadcast 10001010 01100101 01110010 11 111111


138 101 114 255

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.

IP Address 10001010 01100101 01110010 11 111010


Mask 11111111 11111111 11111111 11 000000
Network 10001010 01100101 01110010 11 000000
 subnet   host 
counting range counting
range

• 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

Broadcast 10001010 01100101 01110010 11 111111


– 1,024 total subnets
138 101 114 255

• Subtract one “if” all-zeros subnet cannot be used


• Subtract one “if” all-ones subnet cannot be used
Step 6: Total Number of Hosts per
Subnet G.D. S.D.

IP Address 10001010 01100101 01110010 11 111010


Mask 11111111 11111111 11111111 11 000000
Network 10001010 01100101 01110010 11 000000
 subnet   host 
counting range counting
range

• 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

• Subtract one for the broadcast address


– 62 hosts per subnet
• VLSM Subnets a subnet
– VLSM divides a network into subnets of various sizes to
prevent wasting IP addresses
• Uses up wasted addresses
• Conserves address space on WAN links
• Point-to-point link only needs 2 addresses
• With VLSM point-to-point links can use a /30 mask

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

• A site using subnet addressing must choose a


32-bit subnet mask for each network.
• Bits in the subnet mask are set to 1 if
machines on the network treat the
corresponding bit in the IP address as part of
the subnet prefix, and 0 if they treat the bit as
part of the host identifier
Subnet Mask Representation
• Most IP software uses dotted decimal
representation for subnet masks.
• It works best when sites choose to align sub
netting on octet boundaries.
• Normally subnet addresses and subnet masks
are represented in braces as a 3-tuple:
– { <network number> ,<subnet number>, <host
number> }
• The chief disadvantage of the 3-tuple
representation is that it does not accurately
specify how many bits are used for each part
of the address.
• The advantage is that it abstracts away from
the details of bit fields and emphasizes the
values of the three parts of the address.
• Address values are sometimes more
important than bit fields
• consider the 3-tuple:

• Expressing the same address value using other


representations requires a 32-bit subnet mask
as well as a 32-bit IP address, and forces
readers to decode bit fields before they can
deduce the values of individual fields.
Subnetting

• Subnetting is a process of breaking large


network in small networks known as subnets.
• Subnetting happens when we extend default
boundary of subnet mask.
• Basically we borrow host bits to create
networks.
• you are asked to create two networks, each
will host 30 systems.
• Single class C IP range can fulfill this
requirement, still you have to purchase 2 class
C IP range, one for each.
• we need only 30 addresses, this will waste 226
addresses.
• With subnetting you only need to purchase single
range of class C.
• You can configure router to take first 26 bits
instead of default 24 bits as network bits.
• In this case we would extend default boundary of
subnet mask and borrow 2 host bits to create
networks.
• By taking two bits from the host range and
counting them as network bits, we can create two
new subnets, and assign hosts them.
Advantage of Subnetting

• Subnetting breaks large network in smaller


networks and smaller networks are easier to
manage.
• Subnetting reduces network traffic by removing
collision and broadcast traffic, that overall
improve performance.
• Subnetting allows you to apply network security
polices at the interconnection between subnets.
• Subnetting allows you to save money by reducing
requirement for IP range.
Example 1

What is the subnetwork address if the


destination address is 200.45.34.56 and the
subnet mask is 255.255.240.0?
• Subnetting process involves binary math
calculation.
• Subnetting needs two type of calculation,
convert decimal to binary and convert binary
to decimal.
Base
positi 27 26 25 24 23 22 21 20
on

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.

– For example, convert decimal number 117 in


binary.
• Target decimal number 117
• Move direction From
• Left ==========================> to Right
Base
positio 27 26 25 24 23 22 21 20
n

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

128 is greater than 117 off the bit

0+64 = 64 is less than 117 on the bit

0+64+32 = 96 is less than 117 on the bit

0+64+32+16 = 112 is less than 117 on the bit

0+64+32+16+8 = 120 is greater than 117 off the bit

0+64+32+16+0+4 = 116 is less than 117 on the bit

0+64+32+16+0+4+2 = 118 is greater than


off the bit
117

0+64+32+16+0+4+0+1 = 117 is equivalent


on the bit
to 117
• Convert binary in decimal
– To convert a binary in decimal we will follow
above method in reverse mode. We will find the
decimal value of on binary bit position and add
them. For example convert 10101010 binary
number in decimal.
• Target binary number 10101010
• Move direction From
• Left ==========================> to Right

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)

• subnet addressing is also called as classless


addressing, supernet addressing, or
supernetting.
• Why classless addressing was adopted?
– First, the classful scheme did not divide network
addresses into classes equally.
– Second, class C numbers were being requested
slowly; only a small percentage of them had been
assigned.
– Third, studies showed that at the rate class B
numbers were being assigned, class B prefixes
would be exhausted quickly.
• How supernetting works?
• Consider a medium-sized organization which
prefer to use a single class B address for
joining the internet because, : a class C
address cannot accommodate more than 254
hosts and a class B address has sufficient bits
to make subnetting convenient.
• Instead of a single class B number,
supernetting assigns the organization a block
of 256 contiguous class C numbers that the
organization can then assign to physical
networks.
• To connect its networks to the Internet, an
organization contracts with an ISP; the service
provider handles the details of assigning IP
addresses to the organization as well as
installing physical connections.
• The designers of supernetting propose that an
Internet Service Provider be assigned a large
part of the address space .
• The ISP can then allocate one or more
addresses from the set to each of its
subscribers.
CIDR Notation

• 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

• CIDR specifies an IP address range using a


combination of an IP address and its
associated network mask.
• CIDR notation uses the following format -
– xxx.xxx.xxx.xxx/n
• where n is the number of (leftmost) '1' bits in
the mask. For example,
– 192.168.12.0/23
• applies the network mask 255.255.254.0 to
the 192.168 network, starting at 192.168.12.0.
This notation represents the address range
192.168.12.0 - 192.168.13.255. Compared to
traditional class-based networking,
192.168.12.0/23 represents an aggregation of
the two Class C subnets 192.168.12.0 and
192.168.13.0 each having a subnet mask of
255.255.255.0.
• In other words, 192.168.12.0/23 =
192.168.12.0/24 + 192.168.13.0/24

Anda mungkin juga menyukai