Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets...
Transcript of Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets...
![Page 1: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/1.jpg)
1
Network layer: Overview
Network layer functions
Routing
IP
Forwarding
![Page 2: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/2.jpg)
2
Transport packet from sending to receiving hosts (processes)
Network layer protocols in every host, router
Network Layer Functions
Three important functions:
Addressing
Path determination: route taken by packets from source to dest. Routing algorithms
Switching/forwarding: move packets from router’s input to appropriate router output
network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
network data link physical
application transport network data link physical
application transport network data link physical
![Page 3: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/3.jpg)
3
u
y x
w v
z 2
2 1
3
1
1
2
5 3
5
Graph: G = (N,E)
N = set of routers = { u, v, w, x, y, z }
E = set of links ={ (u,v), (u,x), (v,x), (v,w),
(x,w), (x,y), (w,y), (w,z), (y,z) }
Path: Sequence of meeting edges (routers)
Graph abstraction for routing
Remark: Graph abstr. is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections
![Page 4: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/4.jpg)
4
Graph abstraction: Costs
u
y x
w v
z 2
2 1
3
1
1
2
5 3
5 • c(x,x’) = cost of link (x,x’)
- e.g., c(w,z) = 5
• Cost can be always 1, or inversely related to bandwidth, or inversely related to congestion
Cost of path (x1,x2,x3,…,xp) = c(x1,x2)+c(x2,x3)+…+c(xp−1,xp)
Question: What’s the least-cost path between u and z?
Routing algorithm: Alg. that finds “good” path (typically: least cost path)
![Page 5: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/5.jpg)
5
Routing algorithm classification
Global or decentralized information?
Global:
All routers have complete topology, link cost info
“Link state” algorithms
Decentralized:
Router knows physically-connected neighbors, link costs to neighbors
Iterative process of computation, exchange of info with neighbors
“Distance vector” algorithms
Static or dynamic?
Static:
Routes change slowly over time
Dynamic:
Routes change more quickly
periodic update
in response to link cost changes
![Page 6: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/6.jpg)
6
A link-state routing algorithm
Dijkstra’s algorithm Net topology, link costs known to all nodes
Accomplished via “link state broadcast”
All nodes have same info
Computes least cost paths from one node (‘source”) to all other nodes
Gives routing table for that node
Iterative: after k iterations, know least cost paths to k
destinations
Notation:
c(i,j): Link cost from node i to j (infinite if not direct neighbors)
D(v): Current value of cost of path from source to v
p(v): Current predecessor of v along path from source to v
N’: Set of nodes whose least cost path known
![Page 7: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/7.jpg)
7
Dijsktra’s algorithm
1 Initialization for A:
2 N’ = {A}
3 for all nodes v
4 if v adjacent to A
5 then D(v) = c(A,v)
6 else D(v) = 1
7
8 Loop
9 find w not in N’ such that D(w) is a minimum
10 add w to N’
11 update D(v) for all v adjacent to w and not in N’:
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N’
![Page 8: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/8.jpg)
8
Dijkstra’s algorithm: Example
Step
0
1
2
3
4
5
start N’
A
AD
ADE
ADEB
ADEBC
ADEBCF
D(B),p(B)
2,A
2,A
2,A
D(C),p(C)
5,A
4,D
3,E
3,E
D(D),p(D)
1,A
D(E),p(E)
infinity
2,D
D(F),p(F)
infinity
infinity
4,E
4,E
4,E
A
E D
C B
F 2
2 1
3
1
1
2
5 3
5
![Page 9: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/9.jpg)
9
Dijkstra’s algorithm: Example (2)
A
E D
C B
F
Resulting shortest-path tree from A:
B
D
E
C
F
(A,B)
(A,D)
(A,D)
(A,D)
(A,D)
destination link
Resulting forwarding table in A:
![Page 10: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/10.jpg)
10
Dijkstra’s algorithm: Discussion
Algorithm complexity: n nodes
Each iteration: need to check all nodes, w, not in N’
Depending on data structure: O(n2), O(n log n), …
Oscillations possible:
E.g., link cost = amount of carried traffic
Fix: randomized update times
A
D
C
B 1 1+e
e 0
e
1 1
0 0
initially
A
D
C
B 2+e 0
0 0 1+e 1
… recompute routing
A
D
C
B 0 2+e
1+e 1 0 0
… recompute
A
D
C
B 2+e 0
e 0 1+e 1
… recompute
![Page 11: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/11.jpg)
11
Distance vector algorithm
Bellman-Ford Equation (dynamic programming)
Define
dx(y) := cost of least-cost path from x to y
Then
dx(y) = minv{c(x,v) + dv(y) }
where min is taken over all neighbors v of x
![Page 12: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/12.jpg)
12
Bellman-Ford: Example
u
y x
w v
z 2
2 1
3
1
1
2
5 3
5 Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
du(z) = minv{ c(u,v) + dv(z),
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min{2 + 5,
1 + 3,
5 + 3} = 4
Node that yields minimum is next hop in shortest path ➜ forwarding table
Bellman-Ford equation says:
![Page 13: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/13.jpg)
13
Distance vector algorithm (2)
Dx(y) = estimate of least cost from x to y
Node x knows cost to each neighbor v: c(x,v)
Node x maintains its distance vector
Dx = [Dx(y): y є N ]
Node x also maintains its neighbors’ distance vectors
For each neighbor v, x maintains Dv = [Dv(y): y є N ]
![Page 14: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/14.jpg)
14
Distance vector algorithm (3)
Basic idea:
Each node periodically sends its own distance vector estimate to neighbors
When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation:
Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
Under “natural” conditions the estimates of Dx(y) converge to the actual least cost dx(y)
![Page 15: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/15.jpg)
15
cost to
x y z
x
y
z
0 2 7
from
2 0 1
3 1 0
x y z
x
y
z
0 2 3
from
cost to
2 0 1
7 1 0
x y z
x
y
z
0 2 7
from
cost to
2 0 1
7 1 0
cost to
x y z
x
y
z
0 2 3 fr
om
3 1 0
2 0 1
x y z
x
y
z
0 2 3
from
cost to
2 0 1
3 1 0
x y z
x
y
z
0 2 3
from
cost to
2 0 1 3 1 0
time
x z 1 2
7
y
x y z
x
y
z
0 2 7
∞ ∞ ∞
∞ ∞ ∞
from
cost to node x
∞ ∞
from
x y z
x
y
z ∞ ∞ ∞
cost to
∞ 2 0 1
node y
from
x y z
x
y
z ∞ ∞ ∞
7 1 0
cost to
∞ ∞ ∞
node z
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
![Page 16: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/16.jpg)
16
Distance vector algorithm (4)
Iterative, asynchronous:
Each local iteration caused by:
Local link cost change
DV update message from neighbor
Distributed:
Each node notifies neighbors only when its Distance Vector changes
Neighbors then notify their neighbors if necessary
wait for (change in local link
cost of msg from neighbor)
recompute estimates
if Distance Vector to any
dest has changed, notify
neighbors
Each node:
![Page 17: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/17.jpg)
19
Distance vector (DV): Link cost changes
Link cost changes: Node detects local link cost change
Updates routing info, recalculates distance vector
If DV changes, notify neighbors
“Good news travels fast”
x z 1 4
50
y 1
At time t0, y detects the link-cost change, updates its DV,
and informs its neighbors. At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV.
At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z.
![Page 18: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/18.jpg)
20
x y z
x
from
cost to
y 4 0 1
z 5 1 0
time
node y table
node z table
x z 1 4
50
y 1
x y z
x
from
cost to
y 4 0 1
z 5 1 0
x y z
x
from
cost to
y 1 0 1
z 5 1 0
1
x y z
x
from
cost to
y 1 0 1
z 5 1 0 2
x y z
x
from
cost to
y 1 0 1
z 2 1 0
x y z
x
from
cost to
y 1 0 1
z 2 1 0
![Page 19: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/19.jpg)
21
Distance vector: Link cost changes (2.)
Link cost changes: Good news travels fast
Bad news travels slow x z 1 4
50
y 60
![Page 20: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/20.jpg)
22
x y z
x
from
cost to
y 4 0 1
z 5 1 0
time
node y table
node z table
x z 1 4
50
y 60
x y z
x
from
cost to
y 4 0 1
z 5 1 0
x y z
x
from
cost to
y 6 0 1
z 5 1 0
6
x y z
x
from
cost to
y 6 0 1
z 5 1 0 7
x y z
x
from
cost to
y 6 0 1
z 7 1 0
x y z
x
from
cost to
y 6 0 1
z 7 1 0
Dy(x) = min{c(y,x) + Dx(x), c(y,z) + Dz(x)}
= min{60 + 0 , 1 + 5} = 6
8
Dy(x) = min{c(y,x) + Dx(x),
c(y,z) + Dz(x)}
= min{60 + 0 , 1 + 7} = 8
![Page 21: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/21.jpg)
23
Distance vector: Link cost changes (3.)
Link cost changes: Good news travels fast
Bad news travels slow - “count to infinity” problem!
44 iterations before algorithm stabilizes: see text
What happens here?
Poisoned reverse: If Z routes through Y to get to X :
Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z)
Will this completely solve count to infinity problem?
x z 1 4
50
y 60
x z 1 1
1
y
a
![Page 22: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/22.jpg)
24
Comparison of LS and DV algorithms
Message complexity
Speed of Convergence
Robustness: What happens if router malfunctions?
LS:
DV:
![Page 23: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/23.jpg)
Internet Routing
IP addressing scheme
Internet hierarchies
Intra-AS and Inter-AS routing
RIP, OSPF
BGP
25
![Page 24: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/24.jpg)
26
IP addressing
IP address: 32-bit identifier for host, router interface
Interface: Connection between host, router and physical link
routers typically have multiple interfaces
host may have multiple interfaces
IP addresses associated with interface, not host, router
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.3
223.1.2.1
223.1.3.2 223.1.3.1
223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 1 1
![Page 25: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/25.jpg)
27
IP addressing (2)
IP address:
Network part (high order bits)
Host part (low order bits)
What’s a network? (from IP address perspective)
Device interfaces with same network part of IP address
Can physically reach each other without intervening router
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2 223.1.3.1
223.1.3.27
Network consisting of 3 IP networks (for IP addresses starting with 223.1, first 24 bits are network address)
LAN
![Page 26: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/26.jpg)
28
IP addressing (3)
How to find the networks?
Detach each interface from router, host
Create “islands” of isolated networks
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.2 223.1.2.1
223.1.2.6
223.1.3.2 223.1.3.1
223.1.3.27
223.1.1.2
223.1.7.0
223.1.7.1 223.1.8.0 223.1.8.1
223.1.9.1
223.1.9.2
Interconnected system consisting
of six networks
![Page 27: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/27.jpg)
29
IP networks: Subnets
Sub divide address space
network part
host address
Address format: a.b.c.d/x, where x is # bits in subnet portion of address
11001000 00010111 00010000 00000000
subnet part
200.23.16.0/24
host part
![Page 28: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/28.jpg)
30
Fixed subnetting (classful)
0 network host
10 network host
110 network host
1110 multicast address
A
B
C
D
class
0.0.0.0 to 127.255.255.255
128.0.0.0 to 191.255.255.255
192.0.0.0 to 223.255.255.255
224.0.0.0 to 239.255.255.255
32 bits
![Page 29: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/29.jpg)
31
Address management
Problem: We are running out of networks
Solution (a):
Subnetting: E.g., Class B Host field (16 bits) is
subdivided into <subnet;host> fields
Solution (b):
CIDR (Classless Inter Domain Routing)
![Page 30: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/30.jpg)
32
CIDR
CIDR: Classless InterDomain Routing
Motivation
Class A is too large, Class C is too small
Everyone had a Class B address!!!
Solution:
Sites are given contiguous blocks of class-C addresses (256 addresses each) and a mask or parts of former class A/B networks.
![Page 31: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/31.jpg)
33
CIDR (2.)
CIDR: Classless InterDomain Routing
Subnet portion of address of arbitrary length
Address format: a.b.c.d/x, where x is # bits in subnet portion of address
11001000 00010111 00010000 00000000
subnet part
host part
200.23.16.0/23
![Page 32: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/32.jpg)
34
IP addresses: How to get one?
Q: How does host get IP address?
Hard-coded by system admin in a file
Wintel: Control Panel Network Configuration TCP/IP Properties
UNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server
“Plug-and-play” IP / Subnets allocated by provider (RIPE/ARIN/…)
![Page 33: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/33.jpg)
35
Recall: CIDR
128.119.48.12/18 = 10000000 01110111 00110000 00001100
High order bits form the prefix
Once inside the network, can subnet: divide remaining bits
Subnet example:
Forwarding decision: Longest prefix match
Hierarchical address structure
129.128.0.0/10
18 relevant bits
129.176.0.0/14
Note: picture shows prefix masks, not interface addrs!
![Page 34: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/34.jpg)
36
Forwarding vs. routing
Forwarding: the process of moving packets from input to output
The forwarding table
Information in the packet
Routing: process by which the forwarding table is built and maintained
One or more routing protocols
Procedures (algorithms) to convert routing info to forwarding table.
(More later …)
![Page 35: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/35.jpg)
37
Forwarding with CIDR
Packet should be sent toward the interface with the longest matching prefix
1000 110
1000 1101 00
1000 0110
1000 1101
1000 1101 001
1000 1101 0011
1000 1100 1101
1000 1101 0110
Advertised address
A
B
C
![Page 36: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/36.jpg)
38
Lookup: Longest prefix match
Forwarding table:
<Network>/<mask> <next-hop>
IP Packets: destination IP address
Find next-hop via longest prefix match
Example:
Forwarding table Packets
134.96.252.0/24 A 134.96.252.200
134.96.0.0/16 C 134.96.254.2
134.96.240.0/20 B 134.96.239.200
134.96.252.192/28 B 134.97.239.200
134.96.252.128/28 A 134.96.252.191
![Page 37: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/37.jpg)
39
IP addressing: The last word …
Q: How does an ISP get block of addresses?
A: ICANN: Internet Corporation for Assigned
Names and Numbers
allocates addresses
manages DNS
assigns domain names, resolves disputes
Q: What do I do if I don’t have a public address?
A: Private IP addresses (RFC 1918) 10/8
172.16/12
192.168/16
Private use only – not routable in the Internet
![Page 38: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/38.jpg)
40
NAT: Network address translation
Motivation: Local network uses just one IP address as far as outside world is concerned:
Just one IP address for all devices
Not needed range of addresses from ISP
![Page 39: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/39.jpg)
41
NAT: Network address translation (2.)
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
138.76.29.7
local network (e.g., home network)
10.0.0/24
rest of Internet
Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
All datagrams leaving local network have same single source NAT
IP address: 138.76.29.7, different source port numbers
![Page 40: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/40.jpg)
42
Motivation: Local network uses just one IP address as far as outside world is concerned:
Range of addresses not needed from ISP: just one IP address for all devices
Can change addresses of devices in local network without notifying outside world
Can change ISP without changing addresses of devices in local network
Devices inside local net not explicitly addressable, visible by outside world (a security plus).
NAT: Network address translation (3.)
![Page 41: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/41.jpg)
43
NAT: Network address translation (4.) Implementation: NAT router must:
Outgoing datagrams: Replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #) . . . remote clients/servers will respond using (NAT IP
address, new port #) as destination addr.
Remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair Incoming datagrams: Replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
![Page 42: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/42.jpg)
44
NAT: Network address translation (5.)
10.0.0.1
10.0.0.2
10.0.0.3
S: 10.0.0.1, 3345 D: 128.119.40.186, 80
1
10.0.0.4
138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
NAT translation table WAN side addr LAN side addr
138.76.29.7, 5001 10.0.0.1, 3345 …… ……
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
4
S: 138.76.29.7, 5001 D: 128.119.40.186, 80 2
2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table
S: 128.119.40.186, 80 D: 138.76.29.7, 5001
3
3: Reply arrives dest. address: 138.76.29.7, 5001
4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
![Page 43: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/43.jpg)
45
NAT: Network address translation (6.)
16-bit port-number field:
60,000 simultaneous connections with a single LAN-side address!
NAT is controversial:
Routers should only process up to layer 3
Violates end-to-end argument
• NAT possibility must be taken into account by app designers, e.g., P2P applications
Address shortage should instead be solved by IPv6
![Page 44: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/44.jpg)
46
Internet routing
Scale: With 850 million destinations: Can’t store all dest’s in routing tables!
Routing table exchange would
swamp links!
Administrative autonomy
Internet = network of networks
Each network admin may want to control routing in its own network
Aggregate routers into regions, “autonomous systems” (AS)
Routers in same AS run same routing protocol
“Intra-AS” routing protocol
Routers in different AS can run different intra-AS routing protocol
So far – idealization
All routers identical
Network “flat”
… not true in practice
![Page 45: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/45.jpg)
47
3b
1d
3a
1c 2a
AS3
AS1
AS2 1a
2c
2b
1b
Intra-AS Routing algorithm
Inter-AS Routing algorithm
Forwarding table
3c
Interconnected ASes
Forwarding table is configured by both intra- and inter-AS routing algorithm
Intra-AS sets entries for internal dests
Inter-AS & Intra-AS set entries for external dests
![Page 46: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/46.jpg)
48
3b
1d
3a
1c 2a AS3
AS1
AS2 1a
2c
2b
1b
3c
Inter-AS Tasks Suppose router in AS1 receives datagram for dest outside of AS1
Router should forward packet towards an AS-border router, but which one?
AS1 needs …
1. … to learn which dests are reachable through AS2 and which through AS3
2. … to propagate this reachability info to all routers in AS1
Job of inter-AS routing!
![Page 47: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/47.jpg)
49
Intra-AS routing
Also known as Interior Gateway Protocols (IGP)
Most common Intra-AS routing protocols:
RIP: Routing Information Protocol
• Distance vector protocol (based on Bellman-Ford)
• Routers periodically exchange reachability info with their
neighbors
• Distance metric: hop count
• Advantage: Simple, minimal communication overhead
• Disadvantage: Long convergence times, loop detection
![Page 48: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/48.jpg)
50
Intra-AS routing protocols OSPF: Open Shortest Path First
• Link state protocol (based on Dijkstra)
• Routers periodically flood immediate reachability information to all
other routers
• Distance metric: administrative weight
• Advantage: fast convergence
• Disadvantage: complexity and communication overhead
ISIS: Intermediate-System-to-Intermediate-System (ISO 10589)
(link state)
IGRP: Interior Gateway Routing Protocol (Cisco proprietary)
(distance vector)
EIGRP: Enhanced Interior Gateway Routing Protocol (Cisco
proprietary) (enhanced distance vector)
![Page 49: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/49.jpg)
51
1
2 3
0111
value in arriving
packet’s header
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
Interplay between routing and forwarding
![Page 50: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/50.jpg)
52
Internet Inter-AS routing: BGP
The de facto standard: Border Gateway Protocol (BGP)
BGP provides each AS a means to:
1. Obtain subnet reachability information from neighboring ASs
2. Propagate reachability information to all routers in the AS
3. Determine “good” routes to subnets based on reachability information and routing policy.
Allows a subnet to advertise its existence to rest of the Internet: “I am here”
Issues:
Which routing algorithm?
How are routes advertised?
How to implement routing policies?
![Page 51: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/51.jpg)
53
BGP Basics Pairs of routers (BGP peers) exchange routing info over semi-permanent TCP connections: BGP sessions
Note that BGP sessions do not correspond to physical links.
When AS2 advertises a prefix to AS1, AS2 is promising it will forward any datagrams destined to that prefix towards the prefix.
AS2 can aggregate prefixes in its advertisement
3b
1d
3a
1c 2a
AS3
AS1
AS2 1a
2c
2b
1b
3c
eBGP session
iBGP session
![Page 52: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/52.jpg)
54
BGP is a path vector protocol
Distance vector algorithm with extra information
Two important attributes:
• AS-PATH: contains all ASs along the way: AS 67 AS 17
• NEXT-HOP: Indicates the specific internal-AS router to next-hop AS.
Path can be used to make routing decisions, e.g., to avoid loops
Pure distance vector does not enable policies
Link state does not scale and exposes policies
When advertising a prefix, advert includes BGP attributes
Prefix + other attributes = “route”
When gateway router receives route advertisement, it uses ingress filters to accept/decline
Can make decision based on ASes on path, e.g., to avoid loops
![Page 53: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/53.jpg)
55
BGP messages
Peers exchange BGP messages using TCP OPEN:
• Opens TCP conn. to peer
• Authenticates sender
UPDATE:
• Advertises new routes (or withdraws old)
KEEPALIVE:
• Keeps conn alive in absence of UPDATES, ACKs OPEN request
NOTIFICATION:
• Reports errors in previous msg; closes a connection
Process: Initialization: Open Updates for all routes
Ongoing: Updates for changed routes
![Page 54: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/54.jpg)
56
BGP route processing
Apply Import Policies (ingress filter)
Apply Export Policies (egress filter)
Best Route Selection
BGP Route Table
Install Best Routes
Receive BGP Updates
Best and Alternate Routes
Apply policies to Best Routes!
Transmit BGP Updates
Apply Policy = filter routes & tweak attributes
Based on Attribute Values
IP Forwarding Table
![Page 55: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/55.jpg)
57
Routing policy
Reflects goals of network provider Which routes to accept from other ASes
How to manipulate the accepted routes
How to propagate routes through network
How to manipulate routes
before they leave the AS
Which routes to send to another AS
![Page 56: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/56.jpg)
58
Routing policy: Examples
Honor business relationships (E.g., customers get full-table; peers only customer prefixes) (E.g., prefer customer routes over peer routes over upstream routes)
Allow customers a choice of route (E.g., on customer request do not export prefix to AS x, etc.)
Enable customer traffic engineering (E.g., prepend x times to all peers or to specified AS)
Enable DDoS defense for customers (E.g., blackholing by rewriting the next hop)
…
![Page 57: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/57.jpg)
59
BGP routing policy
A
B
C
W X
Y
legend:
customer network:
provider network
A,B,C are provider networks
X,W,Y are customer (of provider networks)
X is dual-homed: attached to two networks
X does not want to route from B via X to C
.. so X will not advertise to B a route to C
![Page 58: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/58.jpg)
60
BGP routing policy (2.)
A
B
C
W X
Y
legend:
customer network:
provider network
A advertises to B the path AW
B advertises to X the path BAW
Should B advertise to C the path BAW?
No way! B gets no “revenue” for routing CBAW since neither W nor C are B’s customers
B wants to force C to route to w via A
B wants to route only to/from its customers!
![Page 59: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/59.jpg)
Local preference attribute
AS 400
AS 200
160.10.0.0/16
AS 100
AS 300
A B
C
D E
160.10.0.0/16 500
> 160.10.0.0/16 800
500 800
Path with highest local preference wins
Allows providers to prefer routes
![Page 60: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/60.jpg)
62
BGP route selection
Router learns > 1 route to some prefix
Router must select best route.
Elimination rules:
1. Local preference value attribute: policy decision
2. Shortest AS-PATH
3. Best MED (multi-exit-discriminator)
4. Closest NEXT-HOP router: hot potato routing
5. Additional criteria
6. IP address of peer
![Page 61: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/61.jpg)
63
Different types of ASs
Providers: Offer connectivity to direct customer offer transit to other ISPs
Customers: Buy connectivity from providers
Peers: Exchange customers traffic at no cost
Siblings: others Own
Routes
Customer’s
Routes
Sibling’s
Route
Provider’s
Route
Peer’s
Route
Exporting to
a Provider
Exporting to
a Customer
Exporting to
a Peer
× × ×
× × × × ×
× × ×
![Page 62: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/62.jpg)
64
OSPF (Open Shortest Path First)
“Open”: Specification publicly available
Uses the Link State algorithm
State: per router info about itself and attached networks
OSPF advertisements: propagates state
Link state database: state of all routers
Topology map: derived from link state database
![Page 63: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/63.jpg)
65
OSPFv2: Components
Who is my neighbor? Hello Protocol
With whom I want to talk? (LAN!!!) Designated router/Backup designated router concept
What info am I missing? Database synchronization
How do I distribute info? Advertisements disseminated to entire Autonomous System (via reliable flooding)
OSPF messages directly over IP (rather than TCP or UDP)
Route computation From link state database with Dijkstra’s algorithm
Supports equal-cost path routing
![Page 64: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/64.jpg)
66
OSPF “advanced” features
Security: All OSPF messages are authenticated (to prevent malicious intrusion)
Multiple same-cost paths allowed
For each link, multiple cost metrics for different TOS (type of service): e.g., satellite link cost set “low” for best-effort; high for real-time
Integrated uni- and multicast support:
Multicast OSPF (MOSPF) uses same topology data base as OSPF
Hierarchical OSPF in large domains
![Page 65: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/65.jpg)
67
Hierarchical OSPF
![Page 66: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/66.jpg)
68
Hierarchical OSPF (2.)
Two-level hierarchy: Local area and backbone.
Link-state advertisements only in respective areas.
Nodes in each area have detailed area topology; only know direction (shortest path) to networks in other areas.
Area Border routers “summarize” distances to networks in the area and advertise them to other Area Border routers.
Backbone routers: Run an OSPF routing algorithm limited to the backbone.
Boundary routers: Connect to other ASs.
![Page 67: Network layer functions Routing IP Forwarding€¦ · Path determination: route taken by packets from source to dest. Routing algorithms Switching/forwarding: move packets from router’s](https://reader034.fdocuments.in/reader034/viewer/2022042209/5ead1ed68bb56055c10d45b8/html5/thumbnails/67.jpg)
69
Why different Intra- and Inter-AS routing?
Policy: Inter-AS: Admin wants control how its traffic routed, who routes through its network
Intra-AS: Single admin, so no policy decisions needed
Scale: Hierarchical routing saves table size, reduced update traffic
Performance: Intra-AS: Can focus on performance
Inter-AS: Policy may dominate over performance
We need BOTH!