Subnetting_and_supernetting

Download Report

Transcript Subnetting_and_supernetting

Subnetting and Supernetting
Spring 2003
CS 332
1
How to Make Routing Scale
• Flat versus Hierarchical Addresses
• Inefficient use of Hierarchical Address Space
– class C with 2 hosts (2/255 = 0.78% efficient)
– class B with 256 hosts (256/65535 = 0.39% efficient)
• Demand for Class B the problem. So why not just assign 2
class C’s for a 50% efficiency rate?
• Still Too Many Networks
– routing tables do not scale
– route propagation protocols do not scale
Spring 2003
CS 332
2
Internet Structure
• Autonomous system (AS)
– Administered Independently of other ASs
– Want to be able to control various ways in which
network is configured, used, etc.
• Select their own intradomain routing protocol
• Perhaps select own link metrics, etc.
• Advantageous because it provides finer hierarchy
– Good for scalability
Spring 2003
CS 332
3
Subnetting
• Add another level to address/routing hierarchy: subnet
• Subnet masks define variable partition of host part
• Subnets visible only within site
Network number
Host number
Class B address
111111111111111111111111
00000000
Subnet mask (255.255.255.0)
Network number
Subnet ID
Host ID
Subnetted address
Spring 2003
CS 332
4
Subnet Mask
• Written in dotted quad notation (like IP addresses)
• Exactly one mask per subnet (all hosts on given
subnet have same subnet mask)
• Subnet number of host (or of subnet) = bitwise
AND of subnet mask and IP address
11111111 11111111 11111111 10000000
10000000 01100000 00100010 00001111
10000000 01100000 00100010 00000000
Spring 2003
CS 332
5
Subnetting (cont)
• To send IP packet:
– Host performs bitwise AND of its subnet mask with
destination IP address
– If result is same subnet number as sending host, then
destination is on same subnet, so forward directly
(Note: Arp unaffected)
– Else send packet to a router to be forwarded to another
subnet
• New routing table entries:
<SubnetNumber, SubnetMask, NextHop> replaces
<NetworkNumber, NextHop>
Spring 2003
CS 332
6
Subnet Example
Subnet mask: 255.255.255.128
Subnet number: 128.96.34.0
128.96.34.15
128.96.34.1
H1
R1
Subnet mask: 255.255.255.128
Subnet number: 128.96.34.128
128.96.34.130
128.96.34.139
128.96.34.129
H2
R2
H3
128.96.33.14
128.96.33.1
Subnet mask: 255.255.255.0
Subnet number: 128.96.33.0
Spring 2003
Forwarding table at router R1
Subnet Number
128.96.34.0
128.96.34.128
128.96.33.0
CS 332
Subnet Mask
255.255.255.128
255.255.255.128
255.255.255.0
Next Hop
interface 0
interface 1
R2
7
Forwarding Algorithm
D = destination IP address
for each entry (SubnetNum, SubnetMask, NextHop)
D1 = SubnetMask & D
if D1 = SubnetNum
if NextHop is an interface
deliver datagram directly to D
else
deliver datagram to NextHop
•
•
•
•
Use a default router if nothing matches
Not necessary for all 1s in subnet mask to be contiguous
Can put multiple subnets on one physical network(?!)
Subnets not visible from the rest of the Internet
Spring 2003
CS 332
8
The Key
• It’s important to remember that both subnetting
and supernetting are attempts to help make routing
scale
– Even for an AS like U of R, subnetting can help shrink
routing tables, though this isn’t really a serious issue
here
– Supernetting is really intended to make Internet routing
scale – it benefits primarily the internet service
providers and backbone routers, where the real scale
problems exist.
Spring 2003
CS 332
9
Supernetting (CIDR)
• What we’re shooting for:
3185*
319*
52*
31*
51*
5*
backbone
317*
534*
3172*
7*
3174*
73*
748*
Spring 2003
76*
CS 332
317482*
317483*
10
Supernetting (CIDR)
• Called CIDR: Classless Inter-Domain Routing
• Assign block of contiguous network numbers to
nearby networks (in same AS or using same ISP)
– Aggregates routes: single entry for many networks
– E.g. Class B addresses 192.4.16-192.4.31 have same
top 20 bits, so a single 20 bit network address gets
packets to correct AS.
• Restrict block sizes to powers of 2
• Represent network numbers with(length,
value)pair
• All routers must understand CIDR addressing
Spring 2003
CS 332
11
A Caveat
• There is a serious issue regarding the efficiency of
CIDR. Can you determine what it is?
• Do you know what a Trie is?
• I’m putting together a handout that will explain
this, (And I may have you read the original
paper…)
Spring 2003
CS 332
12