Chapter 4: Network Layer
Chapter goals:
r understand principles behind network layer
services:
m
m
m m
routing (path selection) dealing with scale how a router works advanced topics: IPv6, mobility
r instantiation and implementation in the
Internet
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Network layer
r transport segment from r
r r
sending to receiving host on sending side encapsulates segments into datagrams on rcving side, delivers segments to transport layer network layer protocols in every host, router Router examines header fields in all IP datagrams passing through it
application transport 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
network data link physical application transport network data link physical
Key Network-Layer Functions
r
forwarding: move
packets from routers input to appropriate router output
analogy:
r routing: process of
routing: determine
planning trip from source to dest
route taken by packets from source to dest.
m
r forwarding: process
of getting through single interchange
Routing algorithms
Interplay between routing and forwarding
routing algorithm
local forwarding table header value output link
0100 0101 0111 1001 3 2 2 1
value in arriving packets header
0111
1
3 2
Connection setup
r 3rd important function in
architectures:
m
some network
ATM, frame relay, X.25
r Before datagrams flow, two hosts and
intervening routers establish virtual connection
m
Routers get involved
r Network and transport layer connection
service:
m m
Network: between two hosts Transport: between two processes
Network service model
Q: What service model for channel transporting datagrams from sender to rcvr? Example services for individual datagrams: r guaranteed delivery r Guaranteed delivery with less than 40 msec delay Example services for a flow of datagrams: r In-order datagram delivery r Guaranteed minimum bandwidth to flow r Restrictions on changes in interpacket spacing
Network layer service models:
Network Architecture Service Model Congestion Bandwidth Loss Order Timing feedback no yes yes
Guarantees ?
Internet
ATM ATM ATM ATM
best effort none
CBR VBR ABR UBR constant rate guaranteed rate guaranteed minimum none
no
yes yes yes yes
no
yes yes no no
no
no
no (inferred via loss) no congestion no congestion yes no
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Network layer connection and connection-less service
r Datagram network provides network-layer
connectionless service r VC network provides network-layer connection service
Virtual circuits
source-to-dest path behaves much like telephone circuit
m m
performance-wise network actions along source-to-dest path
r
r r
call setup, teardown for each call before data can flow each packet carries VC identifier (not destination host address) every router on source-dest path maintains state for each passing connection link, router resources (bandwidth, buffers) may be allocated to VC
VC implementation
A VC consists of:
1.
2. 3.
Path from source to destination VC numbers, one number for each link along path Entries in forwarding tables in routers along path
r r
Packet belonging to VC carries a VC number. VC number must be changed on each link.
m
New VC number comes from forwarding table
Forwarding table
VC number
12 22 32
Forwarding table in northwest router:
Incoming interface Incoming VC #
interface number Outgoing interface Outgoing VC #
1 2 3 1
12 63 7 97
2 1 2 3
22 18 17 87
Routers maintain connection state information!
Virtual circuits: signaling protocols
r used to setup, maintain teardown VC
r used in ATM, frame-relay, X.25 r not used in todays Internet
application transport 5. Data flow begins network 4. Call connected data link 1. Initiate call physical
6. Receive data application 3. Accept call 2. incoming call
transport network data link physical
Datagram networks
r no call setup at network layer r routers: no state about end-to-end connections m no network-level concept of connection r packets forwarded using destination host address m packets between same source-dest pair may take different paths
application transport network data link 1. Send data physical
application transport network 2. Receive data data link physical
Forwarding table
Destination Address Range 11001000 00010111 00010000 00000000 through 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 11001000 00010111 00011111 11111111 otherwise
4 billion possible entries
Link Interface
Longest prefix matching
Prefix Match 11001000 00010111 00010 11001000 00010111 00011000 11001000 00010111 00011 otherwise Examples DA: 11001000 00010111 00010110 10100001 DA: 11001000 00010111 00011000 10101010 Which interface? Which interface? Link Interface 0 1 2 3
Datagram or VC network: why?
Internet
r
data exchange among r computers r m elastic service, no strict timing req. smart end systems (computers) m can adapt, perform r control, error recovery m simple inside network, complexity at edge many link types m different characteristics m uniform service difficult
ATM
evolved from telephony human conversation: m strict timing, reliability requirements m need for guaranteed service dumb end systems m telephones m complexity inside network
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Router Architecture Overview
Two key router functions:
r run routing algorithms/protocol (RIP, OSPF, BGP) r
forwarding datagrams from incoming to outgoing link
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
The Internet Network layer
Host, router network layer functions:
Transport layer: TCP, UDP
Routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling conventions
Network layer
forwarding table
ICMP protocol error reporting router signaling
Link layer physical layer
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
IP datagram format
IP protocol version number header length (bytes) type of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to 32 bits head. type of length ver len service fragment 16-bit identifier flgs offset upper time to Internet layer live checksum 32 bit source IP address 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. total datagram length (bytes) for fragmentation/ reassembly
how much overhead with TCP? r 20 bytes of TCP r 20 bytes of IP r = 40 bytes + app layer overhead
data (variable length, typically a TCP or UDP segment)
IP Fragmentation & Reassembly
r
network links have MTU ([Link] size) - largest possible link-level frame. m different link types, different MTUs large IP datagram divided (fragmented) within net m one datagram becomes several datagrams m reassembled only at final destination m IP header bits used to identify, order related fragments
fragmentation: in: one large datagram out: 3 smaller datagrams
reassembly
IP Fragmentation and Reassembly
Example r 4000 byte datagram r MTU = 1500 bytes
1480 bytes in data field offset = 1480/8 length ID fragflag offset =4000 =x =0 =0 One large datagram becomes several smaller datagrams length ID fragflag offset =1500 =x =1 =0 length ID fragflag offset =1500 =x =1 =185 length ID fragflag offset =1040 =x =0 =370
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
IP Addressing: introduction
r IP address: 32-bit
[Link] [Link] [Link] [Link] [Link] [Link]
identifier for host, router interface r interface: connection between host/router and physical link
m
[Link]
[Link]
routers typically have multiple interfaces host may have multiple interfaces IP addresses associated with each interface
[Link]
[Link]
[Link] = 11011111 00000001 00000001 00000001 223 1 1 1
Subnets
r IP address: m subnet part (high order bits) m host part (low order bits) r
[Link] [Link] [Link] [Link] [Link] [Link] [Link]
Whats a subnet ?
m
[Link]
device interfaces with same subnet part of IP address can physically reach each other without intervening router
LAN
[Link] [Link]
network consisting of 3 subnets
Subnets
Recipe r To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.
[Link]/24
[Link]/24
[Link]/24
Subnet mask: /24
Subnets
How many?
[Link]
[Link]
[Link] [Link]
[Link]
[Link]
[Link] [Link] [Link] [Link]
[Link]
[Link] [Link] [Link] [Link]
[Link]
IP addressing: CIDR
CIDR: Classless InterDomain Routing
m m
subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in subnet portion of address
subnet part
host part
11001000 00010111 00010000 00000000
[Link]/23
IP addresses: how to get one?
Q: How does host get IP address?
r hard-coded by system admin in a file
Wintel: control-panel->network->configuration>tcp/ip->properties m UNIX: /etc/[Link] r DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server m plug-and-play
m
IP addresses: how to get one?
Q: How does network get subnet part of IP addr? A: gets allocated portion of its provider ISPs address space
ISP's block Organization 0 Organization 1 Organization 2 ... Organization 7 11001000 00010111 00010000 00000000 11001000 00010111 00010000 00000000 11001000 00010111 00010010 00000000 11001000 00010111 00010100 00000000 .. . 11001000 00010111 00011110 00000000 [Link]/20 [Link]/23 [Link]/23 [Link]/23 . [Link]/23
Hierarchical addressing: route aggregation
Hierarchical addressing allows efficient advertisement of routing information:
Organization 0
[Link]/23
Organization 1
[Link]/23 [Link]/23
Organization 2
Organization 7
. . .
. . .
Fly-By-Night-ISP
Send me anything with addresses beginning [Link]/20 Internet
[Link]/23
ISPs-R-Us Send me anything with addresses beginning [Link]/16
Hierarchical addressing: more specific routes
ISPs-R-Us has a more specific route to Organization 1
Organization 0
[Link]/23
Send me anything with addresses beginning [Link]/20 Internet
Organization 2
[Link]/23
Organization 7
. . .
. . .
Fly-By-Night-ISP
[Link]/23
ISPs-R-Us Organization 1 Send me anything with addresses beginning [Link]/16 or [Link]/23
[Link]/23
IP addressing: the last word...
Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned
Names and Numbers m allocates addresses m manages DNS m assigns domain names, resolves disputes
NAT: Network Address Translation
rest of Internet local network (e.g., home network) 10.0.0/24
[Link] [Link] [Link] [Link] [Link]
network have same single source NAT IP address: [Link], different source port numbers
All datagrams leaving local
Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
NAT: Network Address Translation
r Motivation: local network uses just one IP address as
far as outside word is concerned: m no need to be allocated range of addresses from ISP: - just one IP address is used for all devices m can change addresses of devices in local network without notifying outside world m can change ISP without changing addresses of devices in local network m devices inside local net not explicitly addressable, visible by outside world (a security plus).
NAT: Network Address Translation
Implementation: NAT router must:
m
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 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
IP address, port #) to (NAT IP address, new port #) translation pair
NAT: Network Address Translation
2: NAT router changes datagram source addr from [Link], 3345 to [Link], 5001, updates table NAT translation table WAN side addr LAN side addr
[Link], 5001 [Link], 3345
1: host [Link] sends datagram to 128.119.40, 80
S: [Link], 3345 D: [Link], 80
S: [Link], 5001 D: [Link], 80
1
[Link]
S: [Link], 80 D: [Link], 3345
[Link]
[Link]
[Link]
3: Reply arrives dest. address: [Link], 5001
S: [Link], 80 D: [Link], 5001
[Link] 4: NAT router changes datagram dest addr from [Link], 5001 to [Link], 3345
NAT: Network Address Translation
r 16-bit port-number field:
m
60,000 simultaneous connections with a single LAN-side address! routers should only process up to layer 3 violates end-to-end argument
NAT possibility must be taken into account by app designers, eg, P2P applications
r NAT is controversial:
m m
address shortage should instead be solved by IPv6
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
ICMP: Internet Control Message Protocol
r
used by hosts & routers to communicate network-level information m error reporting: unreachable host, network, port, protocol m echo request/reply (used by ping) network-layer above IP: m ICMP msgs carried in IP datagrams ICMP message: type, code plus first 8 bytes of IP datagram causing error
Type 0 3 3 3 3 3 3 4 8 9 10 11 12
Code 0 0 1 2 3 6 7 0 0 0 0 0 0
description echo reply (ping) dest. network unreachable dest host unreachable dest protocol unreachable dest port unreachable dest network unknown dest host unknown source quench (congestion control - not used) echo request (ping) route advertisement router discovery TTL expired bad IP header
Traceroute and ICMP
r
Source sends series of UDP segments to dest
m m m
First has TTL =1 Second has TTL=2, etc. Unlikely port number
When nth datagram arrives to nth router:
m m
Router discards datagram And sends to source an ICMP message (type 11, code 0) Message includes name of router& IP address
When ICMP message arrives, source calculates RTT r Traceroute does this 3 times Stopping criterion r UDP segment eventually arrives at destination host r Destination returns ICMP host unreachable packet (type 3, code 3) r When source gets this ICMP, stops.
r
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
IPv6
r Initial motivation: 32-bit address space soon
to be completely allocated. r Additional motivation:
m
header format helps speed processing/forwarding m header changes to facilitate QoS IPv6 datagram format: m fixed-length 40 byte header m no fragmentation allowed
IPv6 Header (Cont)
Priority: identify priority among datagrams in flow Flow Label: identify datagrams in same flow.
(concept offlow not well defined). Next header: identify upper layer protocol for data
Other Changes from IPv4
r
processing time at each hop r Options: allowed, but outside of header, indicated by Next Header field r ICMPv6: new version of ICMP
m m
Checksum: removed entirely to reduce
additional message types, e.g. Packet Too Big multicast group management functions
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Graph abstraction
5
2 1 Graph: G = (N,E)
v
2
3 3 1
w
1
5 2
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) }
Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections
Graph abstraction: costs
5 2 1 c(x,x) = cost of link (x,x) 3
v
2
w
3
1
5 2
- e.g., c(w,z) = 5
cost could always be 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: Whats the least-cost path between u and z ?
Routing algorithm: algorithm that finds least-cost path
Routing Algorithm classification
Global or decentralized information?
Global: r all routers have complete topology, link cost info r link state algorithms Decentralized: r router knows physicallyconnected neighbors, link costs to neighbors r iterative process of computation, exchange of info with neighbors r distance vector algorithms
Static or dynamic?
Static: r routes change slowly over time Dynamic: r routes change more quickly m periodic update m in response to link cost changes
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
A Link-State Routing Algorithm
Dijkstras algorithm
r
net topology, link costs known to all nodes m accomplished via link state broadcast m all nodes have same info computes least cost paths from one node (source) to all other nodes m gives forwarding table for that node iterative: after k iterations, know least cost path to k dest.s
Notation: r c(x,y): link cost from node
x to y; = if not direct neighbors
r D(v): current value of cost of path from source to dest. v r p(v): predecessor node along path from source to v r N': set of nodes whose least cost path definitively known
Dijsktras Algorithm
1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = 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'
Dijkstras algorithm: example
Step 0 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz D(v),p(v) D(w),p(w) 2,u 5,u 2,u 4,x 2,u 3,y 3,y D(x),p(x) 1,u D(y),p(y) 2,x D(z),p(z)
4,y 4,y 4,y
5 2 1
v
2
3 3 1
w
1
5 2
Dijkstras algorithm, discussion
Algorithm complexity: n nodes r each iteration: need to check all nodes, w, not in N r n(n+1)/2 comparisons: O(n2) r more efficient implementations possible: O(nlogn) Oscillations possible: r e.g., link cost = amount of carried traffic
D
1 1 0
A
0 0
1+e e
B
1
2+e
A
1+e 1
0 0
0 1
A
0 0
2+e
2+e
A
1+e 1
0 e
C 1+e
initially
recompute routing
recompute
recompute
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Distance Vector Algorithm (1)
Bellman-Ford Equation (dynamic programming) Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } where min is taken over all neighbors of x
Bellman-Ford example (2)
5 2 1
v
2
3 3 1
w
1
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
5 2
B-F equation says:
du(z) = min { 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 achieves minimum is next hop in shortest path forwarding table
Distance Vector Algorithm (3)
r Dx(y) = estimate of least cost from x to y
r Distance vector: Dx = [Dx(y): y N ]
r Node x knows cost to each neighbor v:
c(x,v) r Node x maintains Dx = [Dx(y): y N ] r Node x also maintains its neighbors distance vectors
m
For each neighbor v, x maintains Dv = [Dv(y): y N ]
Distance vector algorithm (4)
Basic idea: r Each node periodically sends its own distance vector estimate to neighbors r When node 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
r Under minor, natural conditions, the estimate Dx(y)
converge the actual least cost dx(y)
Distance Vector Algorithm (5)
Iterative, asynchronous:
r
r
each local iteration caused by: local link cost change DV update message from neighbor
Each node: wait for (change in local link
cost of msg from neighbor)
Distributed:
r
each node notifies neighbors only when its DV changes
m
recompute estimates
if DV to any dest has changed, notify neighbors
neighbors then notify their neighbors if necessary
node x table cost to x y z from
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 cost to x y z x 0 2 3 y 2 0 1 z 7 1 0 cost to x y z from from cost to x y z x 0 2 3 y 2 0 1 z 3 1 0 cost to x y z
Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
x 0 2 7 y z node y table cost to x y z
x y 2 0 1 z node z table cost to x y z
from x y z 71 0 from
x 0 2 7 y 2 0 1 z 7 1 0
cost to x y z x 0 2 7 y 2 0 1 z 3 1 0
x 0 2 3 y 2 0 1 z 3 1 0
cost to x y z x 0 2 3 y 2 0 1 z 3 1 0 time
from
from
y
7
from
from
Distance Vector: link cost changes
Link cost changes:
r r r
node detects local link cost change updates routing info, recalculates distance vector if DV changes, notify neighbors
y
50
good news travels fast
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 zs update and updates its distance table. ys least costs do not change and hence y does not send any message to z.
Distance Vector: link cost changes
Link cost changes:
r r r
good news travels fast bad news travels slow count to infinity problem! 44 iterations before algorithm stabilizes: see text If Z routes through Y to get to X :
m
60
y
50
Poissoned reverse:
r
Z tells Y its (Zs) distance to X is infinite (so Y wont route to X via Z)
will this completely solve count to infinity problem?
Comparison of LS and DV algorithms
Message complexity
r r
LS: with n nodes, E links, O(nE) msgs sent DV: exchange between neighbors only m convergence time varies LS: O(n2) algorithm requires O(nE) msgs m may have oscillations DV: convergence time varies m may be routing loops m count-to-infinity problem
Robustness: what happens if router malfunctions? LS:
m
Speed of Convergence
r
node can advertise incorrect link cost each node computes only its own table DV node can advertise incorrect path cost each nodes table used by others
error propagate thru network
DV:
m
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Hierarchical Routing
Our routing study thus far - idealization r all routers identical r network flat not true in practice
scale: with 200 million destinations:
r
administrative autonomy
r r
cant store all dests in routing tables! routing table exchange would swamp links!
internet = network of networks each network admin may want to control routing in its own network
Hierarchical Routing
r aggregate routers into
regions, autonomous systems (AS) r routers in same AS run same routing protocol
m
Gateway router r Direct link to router in another AS
intra-AS routing protocol routers in different AS can run different intraAS routing protocol
Interconnected ASes
3a 3b AS3 1a 3c 2a 1b AS1 2c
AS2
1c 1d
2b
r Forwarding table is
Intra-AS Routing algorithm
Inter-AS Routing algorithm
configured by both intra- and inter-AS routing algorithm
m
Forwarding table
Intra-AS sets entries for internal dests Inter-AS & Intra-As sets entries for external dests
Inter-AS tasks
r Suppose router in AS1
receives datagram for which dest is outside of AS1
m
Router should forward packet towards on of the gateway routers, 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!
3c
3b
3a AS3 1a
1c 1d 1b
2a
2c
AS2
2b
AS1
Example: Setting forwarding table in router 1d
r Suppose AS1 learns from the inter-AS
protocol that subnet x is reachable from AS3 (gateway 1c) but not from AS2. r Inter-AS protocol propagates reachability info to all internal routers. r Router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c. r Puts in forwarding table entry (x,I).
Example: Choosing among multiple ASes
r Now suppose AS1 learns from the inter-AS protocol
that subnet x is reachable from AS3 and from AS2. r To configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x. r This is also the job on inter-AS routing protocol! r Hot potato routing: send packet towards closest of two routers.
Learn from inter-AS protocol that subnet x is reachable via multiple gateways Use routing info from intra-AS protocol to determine costs of least-cost paths to each of the gateways Hot potato routing: Choose the gateway that has the smallest least cost
Determine from forwarding table the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Intra-AS Routing
r Also known as Interior Gateway Protocols (IGP)
r Most common Intra-AS routing protocols:
m m m
RIP: Routing Information Protocol OSPF: Open Shortest Path First IGRP: Interior Gateway Routing Protocol (Cisco proprietary)
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
RIP ( Routing Information Protocol)
r Distance vector algorithm
r Included in BSD-UNIX Distribution in 1982
r Distance metric: # of hops (max = 15 hops)
x y
destination hops u 1 v 2 w 2 x 3 y 3 z 2
RIP advertisements
r Distance vectors: exchanged among
neighbors every 30 sec via Response Message (also called advertisement) r Each advertisement: list of up to 25 destination nets within AS
RIP: Example
z
D
C
Destination Network
w y z x
Next Router
A B B -.
Num. of hops to dest.
2 2 7 1
....
Routing table in D
RIP: Example
Dest w x z . Next C hops 4 ...
Advertisement from A to D
z x
D
Next Router
Destination Network
w y z x
A B B A -.
Num. of hops to dest.
2 2 7 5 1
....
Routing table in D
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link declared dead m routes via neighbor invalidated m new advertisements sent to neighbors m neighbors in turn send out new advertisements (if tables changed) m link failure info quickly propagates to entire net m poison reverse used to prevent ping-pong loops (infinite distance = 16 hops)
RIP Table processing
r RIP routing tables managed by application-level
process called route-d (daemon) r advertisements sent in UDP packets, periodically repeated
routed
Transprt (UDP) network (IP) link physical forwarding table forwarding table routed Transprt (UDP) network (IP) link physical
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
OSPF (Open Shortest Path First)
r open: publicly available r Uses Link State algorithm m LS packet dissemination m Topology map at each node m Route computation using Dijkstras algorithm r OSPF advertisement carries one entry per neighbor
router r Advertisements disseminated to entire AS (via flooding)
m
Carried in OSPF messages directly over IP (rather than TCP or UDP
OSPF advanced features (not in RIP)
r Security: all OSPF messages authenticated (to r r
prevent malicious intrusion) Multiple same-cost paths allowed (only one path in RIP) For each link, multiple cost metrics for different TOS (e.g., satellite link cost set low for best effort; high for real time) Integrated uni- and multicast support: m Multicast OSPF (MOSPF) uses same topology data base as OSPF Hierarchical OSPF in large domains.
Hierarchical OSPF
Hierarchical OSPF
r Two-level hierarchy: local area, backbone.
Link-state advertisements only in area m each nodes has detailed area topology; only know direction (shortest path) to nets in other areas. r Area border routers: summarize distances to nets in own area, advertise to other Area Border routers. r Backbone routers: run OSPF routing limited to backbone. r Boundary routers: connect to other ASs.
m
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Internet inter-AS routing: BGP
r BGP (Border Gateway Protocol):
facto standard r BGP provides each AS a means to:
1. 2. 3.
the de
r Allows a subnet to advertise its existence
Obtain subnet reachability information from neighboring ASs. Propagate the reachability information to all routers internal to the AS. Determine good routes to subnets based on reachability information and policy.
to rest of the Internet: I am here
BGP basics
r r r
Pairs of routers (BGP peers) exchange routing info over semipermanent TCP conctns: 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.
m
AS2 can aggregate prefixes in its advertisement
3c 3a 3b AS3 1a AS1 1c 1d 1b
2a
2c
AS2
2b
eBGP session iBGP session
Distributing reachability info
r r r r
With eBGP session between 3a and 1c, AS3 sends prefix reachability info to AS1. 1c can then use iBGP do distribute this new prefix reach info to all routers in AS1 1b can then re-advertise the new reach info to AS2 over the 1b-to-2a eBGP session When router learns about a new prefix, it creates an entry for the prefix in its forwarding table. 3c 3a 3b AS3 1a AS1
1c 1d
1b
2a
2c
AS2
2b
eBGP session iBGP session
Path attributes & BGP routes
r When advertising a prefix, advert includes BGP
attributes.
m
prefix + attributes = route
r Two important attributes: m AS-PATH: contains the ASs through which the advert for the prefix passed: AS 67 AS 17 m NEXT-HOP: Indicates the specific internal-AS router to next-hop AS. (There may be multiple links from current AS to next-hop-AS.) r When gateway router receives route advert, uses
import policy to accept/decline.
BGP route selection
r r
Router may learn about more than 1 route to some prefix. Router must select route. Elimination rules:
1. 2. 3. 4.
Local preference value attribute: policy decision Shortest AS-PATH Closest NEXT-HOP router: hot potato routing Additional criteria
BGP messages
r BGP messages exchanged using TCP. r BGP messages:
m
m m
OPEN: opens TCP connection to peer and authenticates sender UPDATE: advertises new path (or withdraws old) KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request NOTIFICATION: reports errors in previous msg; also used to close connection
BGP routing policy
B W A C Y X
legend:
provider network customer network:
r A,B,C are provider networks
Figure 4.5-BGPnew: a simple BGP scenario
r X,W,Y are customer (of provider networks) r X is dual-homed: attached to two networks
m m
X does not want to route from B via X to C .. so X will not advertise to B a route to C
BGP routing policy (2)
B W A C Y X
legend:
provider network customer network:
r A advertises to B the path AW
Figure 4.5-BGPnew: a simple BGP scenario
r B advertises to X the path BAW r Should B advertise to C the path BAW? m No way! B gets no revenue for routing CBAW since neither W nor C are Bs customers m B wants to force C to route to w via A m B wants to route only to/from its customers!
Why different Intra- and Inter-AS routing ?
Policy:
r Inter-AS: admin wants control over how its traffic
routed, who routes through its net. r Intra-AS: single admin, so no policy decisions needed
Scale:
r hierarchical routing saves table size, reduced update
traffic Performance: r Intra-AS: can focus on performance r Inter-AS: policy may dominate over performance
Chapter 4: Network Layer
r 4. 1 Introduction
r 4.2 Virtual circuit and
datagram networks r 4.3 Whats inside a router r 4.4 IP: Internet Protocol
m m m m
r 4.5 Routing algorithms m Link state m Distance Vector m Hierarchical routing r 4.6 Routing in the
Internet
m m m
Datagram format IPv4 addressing ICMP IPv6
RIP OSPF BGP
r 4.7 Broadcast and
multicast routing
Broadcast Routing
r Deliver packets from srce to all other nodes
r Source duplication is inefficient:
duplicate
R1 R2
duplicate creation/transmission
R1
duplicate
R2 R4 R3 R4
R3
source duplication
in-network duplication
r Source duplication: how does source
determine recipient addresses
In-network duplication
r Flooding: when node receives brdcst pckt,
sends copy to all neighbors
m
r Controlled flooding: node only brdcsts pkt
Problems: cycles & broadcast storm
if it hasnt brdcst same packet before
m m
r Spanning tree m No redundant packets received by any node
Node keeps track of pckt ids already brdcsted Or reverse path forwarding (RPF): only forward pckt if it arrived on shortest path between node and source
Shortest Path Tree
r mcast forwarding tree: tree of shortest
path routes from source to all receivers
m
Dijkstras algorithm
R1 1 R2 3
S: source 2 R4 5
LEGEND
router with attached group member R5 6 R7 i router with no attached group member link used for forwarding, i indicates order link added by algorithm
4
R6
R3
Reverse Path Forwarding
rely on routers knowledge of unicast
shortest path from it to sender each router has simple forwarding behavior:
if (mcast datagram received on incoming link
on shortest path back to center) then flood datagram onto all outgoing links else ignore datagram
Reverse Path Forwarding: example
S: source R1 R2 R4 LEGEND
router with attached group member R5
router with no attached group member datagram will be forwarded datagram will not be forwarded
R3
R6
R7
result is a source-specific reverse SPT may be a bad choice with asymmetric links