Sunteți pe pagina 1din 27

Subnet Addressing

• Second technique allows a single network


address to span multiple physical network
is called subnet addressing, subnet
forwarding or subnetting
• Widely used of the three address extention
techniques
• Sites have freedom to modify addresses
and routes as long as the modification
remains invisible
Network 128.10.1.0

128.10.1.1 128.10.1.2

H1 H2
Rest of the R
Internet

Network 128.10.2.0
128.10.2.1 128.10.2.2

All traffic to 128.10.0.0


H3 H4
• Site using single class B network address
128.10.0.0 for two networks
• All routers forward traffic as if there were a
single physical net at the site
• Third octet of the address is used to
distinguish 2 networks
• Subnetting divides the address into a
network portion and a local portion
Internet
part Local part

Internet Part Physical Host


Network
Flexibility in Subnet Address
Assignment
• Not every site will have the same needs
for an address hierarchy
• Allows sites flexibility in choosing how to
assign them
To rest of Internet

R1

Network 1

R2 R3

Network 2 Network 3

R4 R5
Network 4 Network 5
Subnet Bits Number of Subnets Host Per Subnet
0 1 65534
2 2 16382
3 6 8190
4 14 4094
5 30 2046
6 62 1022
…..
14 16382 2
Variable Length Subnets
• Most sites that implement subnetting use
fixed – length assignment
• Designers did not choose the specific
division for subnetting
• To allow maximum autonomy – TCP/IP
provides more flexibility
• Organization may select subnet partition
on per network basis
• Variable – does not mean varying, but once
selected it cannot change
• All host and routers attached to that
network – follows the decision
• If not datagrams are lost or misrouted
Advantage
• Mixture of large and small networks –
achieves higher utilization of address space
Disadvantages
• Values for subnet must be assigned
carefully to avoid address ambiguity
Solution
• Routers cannot resolve the ambiguity
• Invalid assignment can only be repaired by
renumbering
Implementation of Subnets with
Masks
• Subnet technology makes configuration of
either fixed or variable length easy
• Standard specifies that 32 – bit mask is
used to specify the division
• 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 a
part of the subnet prefix
• 0 – treat bits as a part of host identifier
• Subnet mask
11111111 11111111 11111111 00000000
• First 3 octets identify network
• Fourth octet – host on the network
• Network might be assigned the mask
11111111 11111111 00011000 01000000
Recommended – use contiguous subnet
mask and use same mask through out an
entire set of physical nets
Subnet Mask Representation
• Specifying subnet mask in binary are prone
to errors
• Most software allows alternate representation
• Follows the convention the local operating
system uses for representation of binary
quantities
• Most IP software uses dotted decimal
representation for subnet mask
• {<network number>, <subnet number>, < host number>}
• Subnet mask for class B network is
255.255.255.0 can be written {-1,-1,0}
Disadvantage
• Does not accurately specify how many bits are
used for each part of the address
Advantage
• Abstracts away from the details of bit fields
• Emphasizes the value of the three part address
Forwarding in the Presence of
Subnets

• Standard IP forwarding algorithm modified


to work with subnet addresses
• All host and routers attached to a network
that uses subnet addressing – use
modified algorithm – subnet forwarding or
subnet routing
Net 1 ( not a subnet address)

R1 H R2

Net 2 Net 3
Subnet Rule
To achieve optimal forwarding, a machine
M must use subnet forwarding for an IP
network address N, unless there is a
single path P such that shortest path
between M and every physical network
that is a subnet of N
• Shortest path – change if hardware fails or
if routing protocols redirect traffic around
congestion
• Subnet rule fails to consider the
boundaries of sites or the difficulties
involved in propagating subnet mask
The Subnet Forwarding
Algorithm
• Standard IP forwarding algorithm – searches a
table of routes
• Conventional routing table contains entries of
the form
(network address, next hop address)
• network address – specifies IP address of a
destination network N
• next hop address – address of a router to
which datagram destined for N should be sent
• Standard algorithm knows how the
address portion is partitioned into network
portion and local portion
• Subnet not possible to decide which bits
correspond to the network and the host
• Modified algorithm used with subnets
maintains additional information in the
routing table
• Table entry contains one additional field
(address mask, network address, next hop address)
• To choose routes – modified algorithm
uses the address mask to extract bits of
destination address
• Performs a bitwise Boolean and of the full
32 bit destination IP address and address
mask from an entry
• Checks if the results equals value in the
network address field of that entry
• Forwards the datagram to the address
specified in the next hop address field of
that entry
A Unified Forwarding Algorithm
Forward_IP_Datagram(datagram, routing_table)
Extract destination IP address, ID, from datagram;
If prefix of ID matches address of any directly connected network
send datagram to destination over that network
( This involves resolving ID to a physical address, encapsulating
the datagram, and sending the frame)
else
for each entry in routing table do
Let N be the bitwise – and of ID and the subnet mask
If N equals the network address field of the entry then
forward the datagram to the specified next hop address
endforloop
If no matchs were found, declare a forwarding error;
Maintenance Of Subnet Masks
• Each site is free to chose subnet masks
for its networks
• When making assignment – managers
balance sizes of networks, numbers of
physical networks, expected growth and
ease of maintenance
Disadvantages
• Nonuniform masks give most flexibility,
makes possible assignment that lead to
ambiguous routes
• They allow valid assignments that become
invalid if more hosts are added to the
networks
Broadcasting To Subnets
• Broadcasting is difficult in subnet
environment
• Router cannot propagate a broadcast
packet that arrives at one interface to all
interface that share the subnet prefix
• To prevent loops – routers use reverse
path forwarding (RPF)

S-ar putea să vă placă și