subnet & supernetincpaper.snu.ac.kr/images/f/f7/4_1_routing_1.pdfsnu scone lab. problems of...
TRANSCRIPT
Subnet & Supernet
Chong-kwon Kim
SNU SCONE lab.
Problems of Addressing
IP addressing scheme is too rigid
– One network ID for each organization
– Only three classes
Problems
1. Large physical network (Large extended LAN)
2. Inefficient use of addresses
• Need to allocate Class B address to a network with 255 hosts
– 255/65535 = 0.39% efficient
SNU SCONE lab.
Subnetting-1
Solution for large organizations
A class A (or B) network may have tens of thousand of hostsProblems?
One solution is to assign many class C addresses Routing complexity increases
One Entry in
Forwarding Table
One
organization
One physical
network
One
organization
Many physical
networks
Many Entries in
Forwarding Table
Subnetting
Subnetting-2
Partition a large network into multiple small physical networks called subnet
Use a part of the host ID space for subnet identification– How do you know What part of
host ID is used for Subnet?
Subnet mask
Routing– Outside, route based on network ID (prefix) only
– Inside, route based on (network+subnet ID)
SNU SCONE lab. 4
SNU SCONE lab.
Subnet Example & Forwarding
ProcedureSubnet Mask: 255.255.255.128
Subnet Number: 128.96.34.0 (00100010 00000000)
Subnet Mask:
255.255.255.128
Subnet number:
128.96.34.128 (00100010 10000000)
Subnet Mask:
255.255.255.0
Subnet number:
128.96.33.0(00100001 00000000)
128.96.34.15 128.96.34.1
128.96.34.130
128.96.34.129 128.96.34.139
128.96.33.14 128.96.33.1
Router R0 Forwarding Table
SubnetNo SubnetMask NextHop
128.96.34.0 255.255.255.128 Interface 0
128.96.34.128 255.255.255.128 Interface 1
128.96.33.0 255.255.255.0 R1
R0
R1
IP Lookup procedure
Let D = Destination IP address
For each forwarding entry
D1 = SubnetMask & D
if D1 = SubnetNumber
Deliver to the NextHop
break
6
CIDR (Supernetting)
Solution to efficient use of address
Allocate multiple (small) network IDs to an organization such that they can be aggregated into one prefix
CIDR(Classless Inter-Domain Routing), Supernetting– Ignore IP address class
– Variable network ID length
– Prefix: Network ID part of IP addresses
1010…..11 00
1010…..11 01
1010…..11 10
1010…..11 11
1010…..11
Prefix (22 bits)
Scenario:
A company with 900 hosts
10 bit host ID
24 bit
CIDR - Example
Network ID allocation & Aggregation– For a network with N hosts, host ID length should be at least n
where 2^n > N
• Use 32 -n bits for network ID
– Example:
• For an organization with 4,000 hosts, host ID part should be 12 bit long
– Network ID part is 20 bit long
– Share a common prefix (network ID part) of desired length
– Example
• 192.4.16.0-192.4.31.0 (11000000 00000100 0001xxxx xxxxxxxx)
SNU SCONE lab. 7
SubnetNumber SubnetMask NextHop
128.96.34.0 255.255.255.128 Interface 0
128.96.34.128 255.255.255.128 Interface 1
128.96.33.0 255.255.255.0 R2
SNU SCONE lab. 8
CIDR Notation
Notation
– IPAddress / length
• Length specifies the prefix used for network ID
• Similar to subnet mask
• 185.21.16.0/20 = 255.255.240.0
Forwarding table entry
– Use prefix length instead of subnet mask
SubnetNumber NextHop
128.96.34.0/25 Interface 0
128.96.34.128/25 Interface 1
128.96.33.0/24 R2
9
CIDR & Routing Route aggregation
Longest matching prefix
Destination NextHop
128.112.128.0/24 Int 0
128.112.128.0/21 Int 1
Forward a packet to 128.112.128.*?
Forward a packet to 128.112.129.*?
ISP2
Router XAdvertise
128.112.128/24
Routing
Chong-kwon Kim
11
Routing & Forwarding
Routing– Collect network information and determine shortest paths
– Path selection criteria
• Hop count, distance, reliability, QoS, …
– As a result, generate forwarding tables
Forwarding– Move packets according to forwarding table
SNU SCONE lab.
SNU SCONE lab. 12
Routing Scalability
Millions of networks in the Internet
Scalability problem
– Control packet overhead
– Processing overhead
Divide and conquer, Abstraction
Partition the Internet into pieces called AS
(Autonomous system) or RD(Routing Domain)
– Single authority unit over
• Address management & Routing inside the domain
– Examples
• ISP, Large University/company, …
AS ID (16 bit 32 bit)
– Each AS has a unique ID
SNU SCONE lab. 13
Intra-/Inter-domain Routing Intradomain routing
– Routing within an AS where the owner has a complete control over the network operation
– Optimality > Reachability
– Collect all information & find shortest paths
– IGP (Interior Gateway Protocol)
– RIP, OSPF
Interdomain routing– Routing across AS boundaries
– AS would not disclose inside information
– Reachability > Optimality
– Exchange reachability info. between ASs
– EGP (Exterior Gateway Protocol)
– EGP, BGP-4
14
Graph Model Represent a network as a graph
– Node: network or router
– Link: network link
• Link cost
Find the shortest paths on the graph– Network conditions change dynamically
– Shortest path algorithms
Point-to-
point
Ethernet
FDDI
A
XY
Z B
x y z2 1 13
C=2
C=1
C=3
C=1
11
Ethernet
FDDI
P2P
Intradomain Routing Algorithm &
Protocol Routing algorithm = Shortest path algorithms
– Bellman-Ford algorithm
– Dijkstra algorithm
Routing protocol– Distributed realization of shortest path algorithms
• What information should be exchanged for distributeimplementation of shortest path algorithms?
– Application layer protocol that exchange
• Routing info.
• Network topology
• Network operating conditions
– Faults, congestion, estimated delay...
– RIP(Routing Information Protocol)
– OSPF(Open Shortest Path First)
SNU SCONE lab.
Shortest Path Algorithm
Graph G = (N,E)– Link (i, j) is incident on node i and j
• Associated cost,
– Path (i, j, k, l, ,m) is a series of links connecting two end nodes i and m
• Cost =
Shortest path algorithm– Find a path between two nodes with minimum cost
c ij
lmkljkij cccc
SNU SCONE lab.
Bellman-Ford Algorithm
Let D(v) be the cost of current shortest path from node v to s
Algorithm
Step 1: D(s) = 0
D(v) = for all v
Step 2: D’(v) = min [D(u) +
u ∈ N(v)
If D’(v) = D(v) for all v , Stop
O.W. D(v) = D’(v) for all v
Repeat
cuv ]
sv
l
m
n
Distributed Implementation?
x
y
SNU SCONE lab.
DV (Distance-Vector) Algorithm
Based on distributed BF Algorithm
Each node sends to neighbor nodes its own optimal path costs as
– Distance vector
• Shortest path cost to each destination
Each node receives distance vector from all of its neighbor nodes and compute best routes
sv
l
m
n 1
5
2
x
y
19
BF - ExampleDistance to network
Router
4 8 12 16
A 0 1 1
B 1 0 4
C 1 4 0 3
D 3 0
Router
4 8 12 16
A ? ? ? ?
B ? ? ? ?
C ? ? ? ?
D ? ? ? ?
192.168.
0.48 12 16
A 0
B 0
C 0
D 0
SNU SCONE lab. 20
RIP
Neighbor routers exchange RIP request/response
messages that contain distance vector
When to send RIP messages?
– Periodic
– Triggered
Command Version 0
Family of Net1 0
Distance to Net1
Subnet Mask
Next hop
IP Address of Net1
Net2
Net3
...
Use UDP Port 520
How to limit the delivery
range to directly connected
routers?
Route Adaptation
(F)
(A)
(D)
(G)
(A)
(G)
Next Hop
Suppose F notices that link (F, G) is broken① F advertises to A that its cost to G is
② A receives from B, C and E with cost = 3, 2, 3,
respectively
③ A updates its route to G via C with cost 3
④ F receives advertisement from A and updates
the route via A with cost 4
RIP Problem – Count-to-Infinity
SNU INC lab. 22
Suppose A notices that link (A, E) is broken① A advertises to B its cost to E is
② C advertises to B that its cost to E is 2
B updates its route to E via C with cost 3
③ A’s link failure message arrives to C
C think E is unreachable
④ B advertises to A that its cost to E is 3
A updates its route to E via B with cost 4
⑤ A advertises to C that its cost to E is 4
SNU SCONE lab. 23
RIP Problem
Slow convergence– Count to infinity
A
D
C
B
10
1
11
1
Routing Table Updates
A B C D
D NH D NH D NH D NH
2 B 1 D 2 B 0 dd
2 B ∞ ur 2 B 0 dd
3 C 3 C 3 A 0 dd
4 C 4 C 4 A 0 dd
Before Break
24
Split Horizon & Poison Reverse Horizon
– Directions where to advertise distance-vector
Split horizon
– Do not advertise a route to an interface from where the best
trigger (next hop) arrives
Split horizon with Poison reverse
– Advertise a route with ∞ to an interface from where the best
trigger arrives
A
D
C
B
101
11
1
Routing Table Updates
A B C D
D NH D NH D NH D NH
2 B 1 D 2 B 0 dd
2 B ∞ ur 2 B 0 dd
Read: http://technet.microsoft.com/library/Cc940478
SNU SCONE lab.
Dijkstra Algorithm
Find shortest paths from node s
d
3
s
a b
c
e
1
2
22
1
13
55
Algorithm
Step 1: F = {s}
D(s) = 0
D(v) = 𝐶𝑠𝑣
Step 2: If F = N, Stop
O.W. Find u s.t. D(u) = min { D(x) }
x ∈ N-F
F = F + {u}
D(v) = min [D(v), D(u) + 𝐶𝑢𝑣], ∀ v ∈ N(u)
Repeat
SNU SCONE lab. 26
Link State Routing Protocol - 1 Problem of distance-vector routing protocol
– Large overhead
– Slow convergence
– Not scalable
• No hierarchy
Search for a new intra-domain routing protocol
– Starts in 1987
– Multiple paths between a source-destination pair
– Descriptive metric
– Hierarchy
Distributed database model
– Each router maintains complete network information
SNU SCONE lab. 27
Link State Routing Protocol - 2 Dijkstra (or any SP algorithms)
Procedure– Each router monitors the status of directly connected links
– Announce the link state (& network) information to all routers
• LSA (Link State Advertisement)
• Use flooding
– Collect LSAs into the local link state database and compute the shortest path tree rooted at the router
LSA contains– ID of the node that creates the LSA
– Directly connected neighbor (router or network) and its cost(state)
SNU SCONE lab. 28
OSPF - Area
OSPF is very complex protocol
– Hierarchy
• A large AS/RD is partitioned
into several areas
– Load balancing
A large AS has thousands of routers
- Hierarchical structure
Area: a set of routers that exchange LSA
Area 0 : Backbone area
ABR(Area Border Router)
- Router that is both the member of
backbone area and non-backbone area
Use R4-R5 link?
Optimality vs. Scalability
SNU SCONE lab. 29
OSPF PDU – 1/2
Authentication
Version Type Message length
Checksum Authentication type
SourceAddr
AreaId
0 8 16 31
OSPF common header format
Incorrect routing may cause
large security problems
Make sure LSP is generated by
legitimate routers
Lowest IP address among the
IP addresses assigned to a router
Network
A
Network
B
IP Common Hdr LSA1 … LSAn
OSPF PDU – 2/2
30
Network
A
Network
B
Type 1 LSA
Type 2 LSA
Link-state ID = Advertising router
Smallest IP address
Router ID
IP Common Hdr LSA1 … LSAn
Hdr Body
SNU SCONE lab.
LSA Transmission Directly on IP
– Raw socket
Reliable flooding– Make sure LSA reaches to all routers
• While maintaining the efficiency of forwarding
– Use seqno to detect duplicate
Procedure– Compose a new LSP (Packet) with LSAs periodically
• Increment SEQNOs
– Flood to all links
– When a router receives an LSP
• Check each LSA is new one (SEQNO)
• If new, flood to all interfaces except the one from which the LSP was received
• If not, ignore
Destination IP address?
SNU SCONE lab. 32
Flooding: Example
X
C
A
B D
X
C
A
B D
X
C
A
B
OSPF is a complex protocol
For details, refer to
http://www.csc.kth.se/utbildning/kth/kurser/DD2490
/ipro1-11/lectures/routing_ospf.pdf
46. For the network shown in Figure 3.53, give global distance–vector tables like
those of Tables 3.10 and 3.13 when
(A) Each node knows only the distances to its immediate neighbors.
(B) Each node has reported the information it had in the preceding step to its
immediate neighbors.
(C)Step (b) happens a second time
SNU INC lab. 33
51. A site is shown in Figure 3.55. R1 and R2 are routers; R2 connects to the outside
world. Individual LANs are Ethernets. RB is a bridge-router; it routes traffic
addressed to it and acts as a bridge for other traffic. Subnetting is used inside the
site; ARP is used on each subnet. Unfortunately, host A has been misconfigured and
doesn’t use subnets. Which of B, C, and D can A reach?
SNU INC lab. 34
54. For the network in Figure 3.53, suppose the forwarding tables are all
established as in Exercise 46 and then the C–E link fails. Give:
(A) The tables of A, B, D, and F after C and E have reported the news.
(B) The tables of A and D after their next mutual exchange.
(C) The table of C after A exchanges with it.
SNU INC lab. 35
58. Consider the situation involving the creation of a routing loop in the network of
Figure 3.29 when the A–E link goes down. List all sequences of table updates among
A, B, and C, pertaining to destination E, that lead to the loop. Assume that table
updates are done one at a time, that the split-horizon technique is observed by all
participants, and that A sends its initial report of E’s unreachability to B before C.
You may ignore updates that don’t result in changes.
36
Suppose A notices that link (A, E) is broken① A advertises to B its cost to E is
② C advertises to B that its cost to E is 2
B updates its route to E via C with cost 3
③ A’s link failure message arrives to C
C think E is unreachable
④ B advertises to A that its cost to E is 3
A updates its route to E via B with cost 4
⑤ A advertises to C that its cost to E is 4
59. Suppose a set of routers all use the split-horizon technique; we consider here under
what circumstances it makes a difference if they use poison reverse in addition.
(A) Show that poison reverse makes no difference in the evolution of the routing loop in the
two examples described in Section 3.3.2, given that the hosts involved use split horizon.
(A) Add Poison Reverse to the sequence we have shown in problem 58.
37
Suppose A notices that link (A, E) is broken
① A advertises to B its cost to E is
② C advertises to B that its cost to E is 2
B updates its route to E via C with cost 3
③ A’s link failure message arrives to C
C think E is unreachable
④ B advertises to A that its cost to E is 3
A updates its route to E via B with cost 4
⑤ B also send Poison Reverse to C that its cost to E is ∞ (Poison Reverse) No effect
⑥ A advertises to C that its cost to E is 4
⑦ A also advertise to B that its cost to E is ∞ (Poison Reverse) again with
no effect
(A) Suppose split-horizon routers A and B somehow reach a state in which they forward
traffic for a given destination X toward each other. Describe how this situation will
evolve with and without the use of poison reverse.
(B) Give a sequence of events that leads A and B to a looped state as in (b), even if poison
reverse is used. (Hint: Suppose B and A connect through a very slow link. They each reach
X through a third node, C, and simultaneously advertise their routes to each other.)
(B)
() Similar to (A)
A and B transmit Poison Reverse messages to C
C tra
SNU SCONE lab. 38
A B
Split horizon onlyBoth A and B do not advertise each other
Their route to X will be time out
A B
Split horizon w/ Poison reverseA advertises to B that its cost to X is ∞B advertises to A that its cost to X is ∞Both delete the routes to X immediately
A B
B
B
68. An organization has been assigned the prefix 212.1.1/24 (class C) and wants to
form subnets for four departments, with hosts as follows:
- 75 hosts
- 35 hosts
- 20 hosts
- 18 hosts
There are 148 hosts in all.
(A) Give a possible arrangement of subnet masks to make this possible.
(B) Suggest what the organization might do if department D grows to 32 hosts.
SNU INC lab. 39
72. Table 3.20 is a routing table using CIDR. Address bytes are in hexadecimal. The
notation “/12” in C4.50.0.0/12 denotes a netmask with 12 leading 1 bits: FF.F0.0.0.
Note that the last three entries cover every address and thus serve in lieu of a default
route. State to what next hop the following will be delivered:
(a) C4.5E.13.87
(b) C4.5E.22.09
(c) C3.41.80.02
(d) 5E.43.91.12
(e) C4.6D.31.2E
(f) C4.6B.31.2E
SNU INC lab. 40