Upload
morgan-russell
View
227
Download
1
Embed Size (px)
Citation preview
IT 347 Midterm 2 Review
Vocab Review
bull ATMbull CBRbull ABRbull VBRbull UBRbull MSSbull MTUbull AIMD
Transport Layer 3-3
TCP retransmission scenarios
Host A
Seq=100 20 bytes data
ACK=100
timepremature timeout
Host B
Seq=92 8 bytes data
ACK=120
Seq=92 8 bytes data
Seq=
92 ti
meo
ut
ACK=120
Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
lost ACK scenario
Host B
X
Seq=92 8 bytes data
ACK=100
time
Seq=
92 ti
meo
utSendBase= 100
SendBase= 120
SendBase= 120
Sendbase= 100
Transport Layer 3-4
TCP retransmission scenarios (more)Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
Cumulative ACK scenario
Host B
X
Seq=100 20 bytes data
ACK=120
time
SendBase= 120
Transport Layer 3-5
TCP ACK generation [RFC 1122 RFC 2581]
Event at Receiver
Arrival of in-order segment withexpected seq All data up toexpected seq already ACKed
Arrival of in-order segment withexpected seq One other segment has ACK pending
Arrival of out-of-order segmenthigher-than-expect seq Gap detected
Arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
Immediately send single cumulative ACK ACKing both in-order segments
Immediately send duplicate ACK indicating seq of next expected byte
Immediate send ACK provided thatsegment starts at lower end of gap
Transport Layer 3-6
Fast Retransmit
bull time-out period often relatively longndash long delay before resending lost packet
bull detect lost segments via duplicate ACKsndash sender often sends many segments back-to-backndash if segment is lost there will likely be many duplicate ACKs for that
segment
bull If sender receives 3 ACKs for same data it assumes that segment after ACKed data was lostndash fast retransmit resend
segment before timer expires
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Vocab Review
bull ATMbull CBRbull ABRbull VBRbull UBRbull MSSbull MTUbull AIMD
Transport Layer 3-3
TCP retransmission scenarios
Host A
Seq=100 20 bytes data
ACK=100
timepremature timeout
Host B
Seq=92 8 bytes data
ACK=120
Seq=92 8 bytes data
Seq=
92 ti
meo
ut
ACK=120
Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
lost ACK scenario
Host B
X
Seq=92 8 bytes data
ACK=100
time
Seq=
92 ti
meo
utSendBase= 100
SendBase= 120
SendBase= 120
Sendbase= 100
Transport Layer 3-4
TCP retransmission scenarios (more)Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
Cumulative ACK scenario
Host B
X
Seq=100 20 bytes data
ACK=120
time
SendBase= 120
Transport Layer 3-5
TCP ACK generation [RFC 1122 RFC 2581]
Event at Receiver
Arrival of in-order segment withexpected seq All data up toexpected seq already ACKed
Arrival of in-order segment withexpected seq One other segment has ACK pending
Arrival of out-of-order segmenthigher-than-expect seq Gap detected
Arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
Immediately send single cumulative ACK ACKing both in-order segments
Immediately send duplicate ACK indicating seq of next expected byte
Immediate send ACK provided thatsegment starts at lower end of gap
Transport Layer 3-6
Fast Retransmit
bull time-out period often relatively longndash long delay before resending lost packet
bull detect lost segments via duplicate ACKsndash sender often sends many segments back-to-backndash if segment is lost there will likely be many duplicate ACKs for that
segment
bull If sender receives 3 ACKs for same data it assumes that segment after ACKed data was lostndash fast retransmit resend
segment before timer expires
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-3
TCP retransmission scenarios
Host A
Seq=100 20 bytes data
ACK=100
timepremature timeout
Host B
Seq=92 8 bytes data
ACK=120
Seq=92 8 bytes data
Seq=
92 ti
meo
ut
ACK=120
Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
lost ACK scenario
Host B
X
Seq=92 8 bytes data
ACK=100
time
Seq=
92 ti
meo
utSendBase= 100
SendBase= 120
SendBase= 120
Sendbase= 100
Transport Layer 3-4
TCP retransmission scenarios (more)Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
Cumulative ACK scenario
Host B
X
Seq=100 20 bytes data
ACK=120
time
SendBase= 120
Transport Layer 3-5
TCP ACK generation [RFC 1122 RFC 2581]
Event at Receiver
Arrival of in-order segment withexpected seq All data up toexpected seq already ACKed
Arrival of in-order segment withexpected seq One other segment has ACK pending
Arrival of out-of-order segmenthigher-than-expect seq Gap detected
Arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
Immediately send single cumulative ACK ACKing both in-order segments
Immediately send duplicate ACK indicating seq of next expected byte
Immediate send ACK provided thatsegment starts at lower end of gap
Transport Layer 3-6
Fast Retransmit
bull time-out period often relatively longndash long delay before resending lost packet
bull detect lost segments via duplicate ACKsndash sender often sends many segments back-to-backndash if segment is lost there will likely be many duplicate ACKs for that
segment
bull If sender receives 3 ACKs for same data it assumes that segment after ACKed data was lostndash fast retransmit resend
segment before timer expires
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-4
TCP retransmission scenarios (more)Host A
Seq=92 8 bytes data
ACK=100
loss
timeo
ut
Cumulative ACK scenario
Host B
X
Seq=100 20 bytes data
ACK=120
time
SendBase= 120
Transport Layer 3-5
TCP ACK generation [RFC 1122 RFC 2581]
Event at Receiver
Arrival of in-order segment withexpected seq All data up toexpected seq already ACKed
Arrival of in-order segment withexpected seq One other segment has ACK pending
Arrival of out-of-order segmenthigher-than-expect seq Gap detected
Arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
Immediately send single cumulative ACK ACKing both in-order segments
Immediately send duplicate ACK indicating seq of next expected byte
Immediate send ACK provided thatsegment starts at lower end of gap
Transport Layer 3-6
Fast Retransmit
bull time-out period often relatively longndash long delay before resending lost packet
bull detect lost segments via duplicate ACKsndash sender often sends many segments back-to-backndash if segment is lost there will likely be many duplicate ACKs for that
segment
bull If sender receives 3 ACKs for same data it assumes that segment after ACKed data was lostndash fast retransmit resend
segment before timer expires
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-5
TCP ACK generation [RFC 1122 RFC 2581]
Event at Receiver
Arrival of in-order segment withexpected seq All data up toexpected seq already ACKed
Arrival of in-order segment withexpected seq One other segment has ACK pending
Arrival of out-of-order segmenthigher-than-expect seq Gap detected
Arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
Immediately send single cumulative ACK ACKing both in-order segments
Immediately send duplicate ACK indicating seq of next expected byte
Immediate send ACK provided thatsegment starts at lower end of gap
Transport Layer 3-6
Fast Retransmit
bull time-out period often relatively longndash long delay before resending lost packet
bull detect lost segments via duplicate ACKsndash sender often sends many segments back-to-backndash if segment is lost there will likely be many duplicate ACKs for that
segment
bull If sender receives 3 ACKs for same data it assumes that segment after ACKed data was lostndash fast retransmit resend
segment before timer expires
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-6
Fast Retransmit
bull time-out period often relatively longndash long delay before resending lost packet
bull detect lost segments via duplicate ACKsndash sender often sends many segments back-to-backndash if segment is lost there will likely be many duplicate ACKs for that
segment
bull If sender receives 3 ACKs for same data it assumes that segment after ACKed data was lostndash fast retransmit resend
segment before timer expires
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-7
Host A
timeo
ut
Host B
time
X
resend seq X2
seq x1seq x2seq x3seq x4seq x5
ACK x1
ACK x1ACK x1ACK x1
tripleduplicate
ACKs
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-8
event ACK received with ACK field value of y if (y gt SendBase) SendBase = y if (there are currently not-yet-acknowledged segments) start timer else increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) resend segment with sequence number y
Fast retransmit algorithm
a duplicate ACK for already ACKed segment
fast retransmit
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-9
TCP Flow Control
bull receive side of TCP connection has a receive buffer
bull speed-matching service matching send rate to receiving applicationrsquos drain rate
app process may be slow at reading from buffer
sender wonrsquot overflowreceiverrsquos buffer bytransmitting too much too fast
flow control
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-10
TCP Flow control how it works
(suppose TCP receiver discards out-of-order segments)
bull unused buffer space= rwnd= RcvBuffer-[LastByteRcvd -
LastByteRead]
bull receiver advertises unused buffer space by including rwnd value in segment header
bull sender limits of unACKed bytes to rwndndash guarantees receiverrsquos buffer
doesnrsquot overflow
IPdatagrams
TCP data(in buffer)
(currently)unused bufferspace
applicationprocess
rwndRcvBuffer
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-11
TCP congestion control bandwidth probing
ldquoprobing for bandwidthrdquo increase transmission rate on receipt of ACK until eventually loss occurs then decrease transmission rate continue to increase on ACK decrease on loss (since available
bandwidth is changing depending on other connections in network)
ACKs being received so increase rate
X
X
XX
X loss so decrease rate
send
ing
rate
time
Q how fast to increasedecrease details to follow
TCPrsquosldquosawtoothrdquobehavior
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-12
TCP Congestion Control details
bull sender limits rate by limiting number of unACKed bytes ldquoin pipelinerdquo
ndash cwnd differs from rwnd (how why)ndash sender limited by min(cwndrwnd)
bull roughly
bull cwnd is dynamic function of perceived network congestion
rate = cwnd
RTT bytessec
LastByteSent-LastByteAcked cwnd
cwndbytes
RTT
ACK(s)
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-13
TCP Congestion Control more details
segment loss event reducing cwnd
bull timeout no response from receiverndash cut cwnd to 1
bull 3 duplicate ACKs at least some segments getting through (recall fast retransmit)ndash cut cwnd in half less
aggressively than on timeout
ACK received increase cwnd slowstart phase
increase exponentially fast (despite name) at connection start or following timeout
congestion avoidance increase linearly
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-14
TCP Slow Startbull when connection begins cwnd = 1
MSSndash example MSS = 500 bytes amp RTT
= 200 msecndash initial rate = 20 kbps
bull available bandwidth may be gtgt MSSRTTndash desirable to quickly ramp up to
respectable ratebull increase rate exponentially until first
loss event or when threshold reachedndash double cwnd every RTTndash done by incrementing cwnd by 1
for every ACK received
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-15
Transitioning intoout of slowstartssthresh cwnd threshold maintained by TCPbull on loss event set ssthresh to cwnd2
ndash remember (half of) TCP rate when congestion last occurred bull when cwnd gt= ssthresh transition from slowstart to congestion avoidance
phase
slow start timeout
ssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKdupACKcount++
duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0 congestion
avoidance
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-16
TCP congestion avoidancebull when cwnd gt ssthresh
grow cwnd linearly
ndash increase cwnd by 1 MSS per RTT
ndash approach possible congestion slower than in slowstart
ndash implementation cwnd = cwnd + MSScwnd for each ACK received
ACKs increase cwnd by 1 MSS per RTT additive increase
loss cut cwnd in half (non-timeout-detected loss ) multiplicative decrease
AIMD
AIMD Additive IncreaseMultiplicative Decrease
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-17
TCP congestion control FSM overview
slow start
congestionavoidance
fastrecovery
cwnd gt ssthresh
losstimeout
losstimeout
new ACK loss3dupACK
loss3dupACK
losstimeout
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-18
TCP congestion control FSM details
slow start
congestionavoidance
fastrecovery
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s)as allowed
new ACKcwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s)as allowed
new ACK
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3
dupACKcount++
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
cwnd = ssthreshdupACKcount = 0
New ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-19
Popular ldquoflavorsrdquo of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
en
ts)
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-20
Summary TCP Congestion Control
bull when cwnd lt ssthresh sender in slow-start phase window grows exponentially
bull when cwnd gt= ssthresh sender is in congestion-avoidance phase window grows linearly
bull when triple duplicate ACK occurs ssthresh set to cwnd2 cwnd set to ~ ssthresh
bull when timeout occurs ssthresh set to cwnd2 cwnd set to 1 MSS
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-21
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires window size W = 83333 in-flight segmentsbull throughput in terms of loss rate
bull L = 210-10 Wowbull new versions of TCP for high-speed
LRTT
MSS221
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-22
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP connection 2
TCP Fairness
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-23
Why is TCP fairTwo competing sessionsbull Additive increase gives slope of 1 as throughout increasesbull multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughputConn
ectio
n 2
t hr o
u gh p
u t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-24
Fairness (more)Fairness and UDPbull multimedia apps often do
not use TCPndash do not want rate throttled
by congestion controlbull instead use UDP
ndash pump audiovideo at constant rate tolerate packet loss
Fairness and parallel TCP connections
bull nothing prevents app from opening parallel connections between 2 hosts
bull web browsers do this bull example link of rate R
supporting 9 connections ndash new app asks for 1 TCP gets rate
R10ndash new app asks for 11 TCPs gets
R2
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Transport Layer 3-25
Chapter 3 Summarybull principles behind transport layer
services
ndash multiplexing demultiplexingndash reliable data transferndash flow controlndash congestion control
bull instantiation and implementation in the Internet
ndash UDPndash TCP
Nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-26
1
23
0111
value in arrivingpacketrsquos header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-27
Connection setup
bull 3rd important function in some network architectures
ndash ATM frame relay X25bull before datagrams flow two end hosts and intervening routers
establish virtual connection
ndash routers get involvedbull network vs transport layer connection service
ndash network between two hosts (may also involve intervening routers in case of VCs)
ndash transport between two processes
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-28
Network service modelQ What service model for ldquochannelrdquo transporting datagrams from sender to receiver
example services for individual datagrams
bull guaranteed deliverybull guaranteed delivery with
less than 40 msec delay
example services for a flow of datagrams
bull in-order datagram delivery
bull guaranteed minimum bandwidth to flow
bull restrictions on changes in inter-packet spacing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-29
Network layer service models
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-30
VC implementation
a VC consists of1 path from source to destination2 VC numbers one number for each link along
path3 entries in forwarding tables in routers along path
bull packet belonging to VC carries VC number (rather than dest address)
bull VC number can be changed on each linkndash New VC number comes from forwarding table
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-31
VC Forwarding table
12 22 32
1 23
VC number
interfacenumber
Incoming interface Incoming VC Outgoing interface Outgoing VC
1 12 3 222 63 1 18 3 7 2 171 97 3 87hellip hellip hellip hellip
Forwarding table innorthwest router
Routers maintain connection state information
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-32
Virtual circuits signaling protocols
bull used to setup maintain teardown VCbull used in ATM frame-relay X25bull not used in todayrsquos Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Initiate call 2 incoming call3 Accept call4 Call connected
5 Data flow begins 6 Receive data
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-33
Datagram networksbull no call setup at network layerbull routers no state about end-to-end connections
ndash no network-level concept of ldquoconnectionrdquo
bull packets forwarded using destination host addressndash packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1 Send data 2 Receive data
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-34
Datagram Forwarding table
1
23
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
4 billion IP addresses so rather than list individual destination addresslist range of addresses(aggregate table entries)
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-35
Datagram Forwarding tableDestination Address Range
11001000 00010111 00010000 00000000through 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000through11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000through11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q but what happens if ranges donrsquot divide up so nicely
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-36
Longest prefix matching
Destination Address Range
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
DA 11001000 00010111 00011000 10101010
ExamplesDA 11001000 00010111 00010110 10100001 Which interface
Which interface
when looking for forwarding table entry for given destination address use longest address prefix that matches destination address
Longest prefix matching
Link interface
0
1
2
3
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-37
Datagram or VC network whyInternet (datagram)bull data exchange among computers
ndash ldquoelasticrdquo service no strict timing req
bull ldquosmartrdquo end systems (computers)ndash can adapt perform control
error recoveryndash simple inside network
complexity at ldquoedgerdquobull many link types
ndash different characteristicsndash uniform service difficult
ATM (VC)bull evolved from telephonybull human conversation
ndash strict timing reliability requirements
ndash need for guaranteed service
bull ldquodumbrdquo end systemsndash telephonesndash complexity inside network
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-38
IP Fragmentation and Reassembly
ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example 4000 byte datagram MTU = 1500 bytes
1480 bytes in data field
offset =14808
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-39
SubnetsHow many 223111
223113
223114
223122223121
223126
223132223131
2231327
223112
223170
223171223180223181
223191
223192
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-40
IP addressing CIDRCIDR Classless InterDomain Routing
ndash subnet portion of address of arbitrary lengthndash address format abcdx where x is bits in
subnet portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
2002316023
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-41
DHCP client-server scenario
223111
223112
223113
223114 223129
223122
223121
223132223131
2231327
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-42
DHCP example
bull connecting laptop needs its IP address addr of first-hop router addr of DNS server use DHCP
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8021 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
168111
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-43
bull DCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
router(runs DHCP)
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation of DHCP server frame forwarded to client demuxing up to DHCP at client
client now knows its IP address name and IP address of DSN server IP address of its first-hop router
DHCP example
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-44
Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to Organization 1
ldquoSend me anythingwith addresses beginning 2002316020rdquo
2002316023
2002318023
2002330023
Fly-By-Night-ISP
Organization 0
Organization 7Internet
Organization 1
ISPs-R-Us ldquoSend me anythingwith addresses beginning 199310016or 2002318023rdquo
2002320023Organization 2
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-45
NAT Network Address Translation
10001
10002
10003
S 10001 3345D 12811940186 80
1
10004
13876297
1 host 10001 sends datagram to 12811940186 80
NAT translation tableWAN side addr LAN side addr
13876297 5001 10001 3345helliphellip helliphellip
S 12811940186 80 D 10001 3345 4
S 13876297 5001D 12811940186 802
2 NAT routerchanges datagramsource addr from10001 3345 to13876297 5001updates table
S 12811940186 80 D 13876297 5001 3
3 Reply arrives dest address 13876297 5001
4 NAT routerchanges datagramdest addr from13876297 5001 to 10001 3345
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-46
Comparison of LS and DV algorithms
Message complexitybull LS with n nodes E links O(nE)
msgs sent bull DV exchange between neighbors
onlyndash convergence time varies
Speed of Convergencebull LS O(n2) algorithm requires O(nE)
msgsndash may have oscillations
bull DV convergence time variesndash may be routing loopsndash count-to-infinity problem
Robustness what happens if router malfunctions
LS ndash node can advertise incorrect
link costndash each node computes only its
own table
DVndash DV node can advertise
incorrect path costndash each nodersquos table used by
others bull error propagate thru network
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-47
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
bull forwarding table configured by both intra- and inter-AS routing algorithmndash intra-AS sets entries for
internal destsndash inter-AS amp intra-As sets
entries for external dests
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-48
Inter-AS tasksbull suppose router in AS1
receives datagram destined outside of AS1ndash router should
forward packet to gateway router but which one
AS1 must1 learn which dests are
reachable through AS2 which through AS3
2 propagate this reachability info to all routers in AS1
job of inter-AS routing
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-49
Example Setting forwarding table in router 1d
bull suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2ndash inter-AS protocol propagates reachability info to all internal routers
bull router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1cndash installs forwarding table entry (xI)
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
xhellip
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-50
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine which gateway it should forward packets towards for dest x ndash this is also job of inter-AS routing protocol
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
x helliphellip
hellip
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-51
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routingChoose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway Enter (xI) in
forwarding table
Example Choosing among multiple ASes
bull now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2
bull to configure forwarding table router 1d must determine towards which gateway it should forward packets for dest x ndash this is also job of inter-AS routing protocol
bull hot potato routing send packet towards closest of two routers
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-52
Intra-AS Routing
bull also known as Interior Gateway Protocols (IGP)bull most common Intra-AS routing protocols
ndash RIP Routing Information Protocol (DV)
ndash OSPF Open Shortest Path First (LS)
ndash IGRP Interior Gateway Routing Protocol (Cisco proprietary)(LS)
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-53
BGP basics distributing path information
AS3
AS2
3b3a
AS1
1c1a
1d1b
2a2c
2b
othernetworks
othernetworks
bull using eBGP session between 3a and 1c AS3 sends prefix reachability info to AS1ndash 1c can then use iBGP do distribute new prefix info to all routers in AS1ndash 1b can then re-advertise new reachability info to AS2 over 1b-to-2a
eBGP sessionbull when router learns of new prefix it creates entry for prefix in
its forwarding table
eBGP session
iBGP session
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-54
Path attributes amp BGP routesbull advertised prefix includes BGP attributes
ndash prefix + attributes = ldquorouterdquo
bull two important attributesndash AS-PATH contains ASs through which prefix advertisement has passed
eg AS 67 AS 17 ndash NEXT-HOP indicates specific internal-AS router to next-hop AS (may
be multiple links from current AS to next-hop-AS)
bull gateway router receiving route advertisement uses import policy to acceptdeclinendash eg never route through AS xndash policy-based routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-55
BGP route selectionbull router may learn about more than 1 route
to destination AS selects route based on1 local preference value attribute policy
decision2 shortest AS-PATH 3 closest NEXT-HOP router hot potato routing4 additional criteria
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-56
BGP messages
bull BGP messages exchanged between peers over TCP connectionbull BGP messages
ndash OPEN opens TCP connection to peer and authenticates sender
ndash UPDATE advertises new path (or withdraws old)ndash KEEPALIVE keeps connection alive in absence of
UPDATES also ACKs OPEN requestndash NOTIFICATION reports errors in previous msg
also used to close connection
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-57
BGP routing policy
ABC are provider networks XWY 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
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-58
BGP routing policy (2)
A advertises path AW to B B advertises path BAW to X Should B advertise path BAW to C
No way B gets no ldquorevenuerdquo for routing CBAW since neither W nor C are Brsquos customers
B wants to force C to route to w via A B wants to route only tofrom its customers
A
B
C
W X
Y
legend
customer network
provider network
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-59
Why different Intra- and Inter-AS routing Policy bull Inter-AS admin wants control over how its traffic routed who
routes through its net bull Intra-AS single admin so no policy decisions needed
Scalebull hierarchical routing saves table size reduced update trafficPerformance bull Intra-AS can focus on performancebull Inter-AS policy may dominate over performance
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing
Network Layer 4-60
Chapter 4 summary
4 1 Introduction42 Virtual circuit and datagram networks43 Whatrsquos inside a router44 IP Internet Protocol
ndash Datagram formatndash IPv4 addressingndash ICMPndash IPv6
45 Routing algorithmsndash Link statendash Distance Vectorndash Hierarchical routing
46 Routing in the Internetndash RIPndash OSPFndash BGP
47 Broadcast and multicast routing