CN Merged May 2024 For Print
CN Merged May 2024 For Print
• Education
• PhD -- IIIT-Delhi (2015-2020)
Computer Networks (WILP) • Employment
• Postdoctoral researcher at Max Planck Institute for Informatics (Germany), hosted by Prof. Anja Feldman
Jan to May 2024 (2020-2022)
• Postdoctoral researcher at COSIC, KU Leuven (Belgium), hosted by Prof. Claudia Diaz (2022-2023)
• On August 1, 2023 I joined BITS Goa as Assistant Prof.
• Research Interests
Devashish Gosain • Networks Security and Privacy
Chapter 1: introduction
Chapter 1 our goal: overview:
Introduction • get “feel” and • what’s the Internet?
terminology • what’s a protocol?
• more depth, detail • network edge; hosts, access net,
A note on the use of these ppt slides: later in course physical media
We’re making these slides freely available to all (faculty, students, readers). Computer •
They’re in PowerPoint form so you see the animations; and can add, modify,
Networking: A Top • approach: network core: packet/circuit
and delete slides (including this one) and slide content to suit your needs.
switching, Internet structure
• use Internet as
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Down Approach
If you use these slides (e.g., in a class) that you mention their source
6th edition • performance: loss, delay, throughput
(after all, we’d like people to use our book!)
Jim Kurose, Keith Ross
example
If you post any slides on a www site, that you note that they are adapted
• security
from (or perhaps identical to) our slides, and note our copyright of this
material.
Addison-Wesley
March 2012 • protocol layers, service models
Thanks and enjoy! JFK/KWR
What’s the Internet: “nuts and bolts” view “Fun” internet appliances
PC • millions of connected mobile network
server computing devices:
• hosts = end systems Web-enabled toaster +
wireless global ISP
laptop • running network apps weather forecaster
smartphone
IP picture frame
home
network http://www.ceiva.com/
communication links regional ISP
wireless fiber, copper, radio,
links satellite Tweet-a-watt:
wired
links transmission rate: monitor energy use
bandwidth
… specific actions taken protocols define format, order of time? Get http://www.awl.com/kurose-ross
when msgs received, or msgs sent and received among 2:00
other events <file>
network entities, and actions
time
taken on msg transmission,
receipt
Q: other human protocols?
Introduction 1-15 Introduction 1-16
A closer look at network structure:
Chapter 1: roadmap
• network edge: mobile network
• hosts: clients and servers
• servers often in data centers global ISP
1.1 what is the Internet?
1.2 network edge
home
end systems, access networks, links access networks, physical network
regional ISP
1.3 network core media: wired, wireless
packet switching, circuit switching, network structure communication links
network core:
interconnected routers
network of networks institutional
network
Access networks and physical media Access net: digital subscriber line (DSL)
keep in mind:
use existing telephone line to central office DSLAM
• bandwidth (bits per second)
of access network? data over DSL phone line goes to Internet
voice over DSL phone line goes to telephone net
• shared or dedicated?
< 2.5 Mbps upstream transmission rate (typically < 1 Mbps)
< 24 Mbps downstream transmission rate (typically < 10 Mbps)
Introduction 1-19 Introduction 1-20
Access net: cable network Access net: home network
cable headend
wireless
… devices
network of cable, fiber attaches homes to ISP router wireless access router, firewall, NAT
homes share access network to cable headend point (54 Mbps)
wired Ethernet (100 Mbps)
unlike DSL, which has dedicated access to central office
Introduction 1-21 Introduction 1-22
is packet switching a “slam dunk winner?” End systems connect to Internet via access ISPs (Internet
Service Providers)
• great for bursty data
Residential, company and university ISPs
• resource sharing
Access ISPs in turn must be interconnected.
• simpler, no call setup
So that any two hosts can send packets to each other
• excessive congestion possible: packet delay and loss Resulting network of networks is very complex
• protocols needed for reliable data transfer, congestion Evolution was driven by economics and national policies
control
Let’s take a stepwise approach to describe current Internet
• Q: How to provide circuit-like behavior? structure
• bandwidth guarantees needed for audio/video apps
• still an unsolved problem (chapter 7)
Introduction 1-33
access access
net net
access access
net net
access access
net net
access access
net net
access access access access
net access net net access net
net net
Internet structure: network of networks Internet structure: network of networks
Option: connect each access ISP to a global transit ISP? Customer But if one global ISP is viable business, there will be competitors
and provider ISPs have economic agreement. ….
access access access access
net net net net
access access
net net
access access
access net access net
net net
access access
access net access net
net net
ISP A
global
access
net
ISP access
net
access
net ISP B
access
net
access access
ISP C
net net
access access
net net
access access
net net
access access
net net
access access access access
net access net net access net
net net
access
IXP access
net access
IXP access
net
net
ISP A net
ISP A
access
ISP C access
ISP C
net net
access access
net net
access
access
net IXP IXP IXP
net
access
IXP access
net
net
ISP A
Regional ISP Regional ISP
Content provider network
access IXP access
net ISP B net
access
• at center: small # of well-connected large networks
regional net
• “tier-1” commercial ISPs (e.g., Level 3, Sprint, AT&T, NTT), national &
net
access
net
access
net access
access
net
international coverage
• content provider network (e.g, Google): private network that connects it
net
Introduction 1-42
data centers to Internet, often bypassing tier-1, regional ISPs
CH 2: outline
CH 2
Application Layer 2.1 principles of network
applications
2.2 Web and HTTP
What transport service does an app need? Transport service requirements: common apps
www.someschool.edu/someDept/pic.gif
URL method:
header field name value cr lf
uses GET method
cr lf input is uploaded in URL
field of request line:
~
~ entity body ~
~ body
www.somesite.com/animalsearch?monkeys&banana
2.3 FTP
User Agent SMTP
a.k.a. “mail reader”
user
2.4 electronic mail composing, editing, reading mail SMTP
agent
messages mail
SMTP, POP3, IMAP server
e.g., Outlook, Thunderbird, user
2.5 DNS iPhone mail client agent
outgoing, incoming messages user
stored on server agent
additional info (variable # of RRs) additional “helpful” additional info (variable # of RRs)
info that may be used
Application Layer 2-27 Application Layer 2-28
Attacking DNS
DDoS attacks Redirect attacks
Bombard root servers Man-in-middle
with traffic Intercept queries
Not successful to date
Traffic Filtering
DNS poisoning
Send bogus replies to
Socket Programming
Local DNS servers DNS server, which
cache IPs of TLD caches
servers, allowing root Exploit DNS for DDoS
server bypass
Send queries with
Bombard TLD servers
spoofed source
Potentially more
dangerous address: target IP
Requires amplification
Application Layer 2-29
Application Layer Protocols Data exchange between hosts: General
HTTP How do we get two hosts to exchange arbitrary
DNS data?
Without trying to use HTTP or SMTP or IMAP
Email (SMTP/IMAP/POP3)
Your own protocol?
write reply to
connectionSocket read reply from
clientSocket
close
connectionSocket close
clientSocket
Example app: TCP Client Example app: TCP Server
Python TCPClient Python TCPServer
from socket import * from socket import *
serverName = ’servername’ create TCP welcoming
serverPort = 12000
socket serverSocket = socket(AF_INET,SOCK_STREAM)
serverPort = 12000
create TCP socket for server,
remote port 12000
serverSocket.bind((‘’,serverPort))
clientSocket = socket(AF_INET, SOCK_STREAM) server begins listening for incoming
TCP requests
serverSocket.listen(1)
clientSocket.connect((serverName,serverPort)) print ‘The server is ready to receive’
sentence = raw_input(‘Input lowercase sentence:’) loop forever
while True:
clientSocket.send(sentence.encode()) server waits on accept()
No need to attach server name, port connectionSocket, addr = serverSocket.accept()
for incoming requests, new socket
modifiedSentence = clientSocket.recv(1024) created on return
Specifying Address
Sockets in C
struct in_addr {
int sockid = socket(family, type, protocol);
unsigned long s_addr; /* Internet
● sockid: is socket descriptor struct sockaddr { address (32 bits) */
● family: takes integer as input, communication domain }
unsigned short sa_family; /* Address
○ AF_INET, IPv4 protocol
family (e.g. AF_INET) */ struct sockaddr_in {
○ AF_UNIX, File address, Local communication
unsigned short sin_family;/* Internet
● type: communication (SOCK_STREM, SOCK_DGRAM) char sa_data[14]; /* Family-specific protocol (AF_INET) */
● protocol: IPPROTO_TCP, IPPROTO_UDP address information */ unsigned short sin_port;/* Address
port (16 bits) */
Sockets create interface } struct in_addr sin_addr;/* Internet
address (32 bits) */
char sin_zero[8];/* not used*/
}
bind() Example of bind
int sockid;
int status = bind(sockid, &addrport, size); struct sockaddr_in addrport;
sockid = socket(PF_INET, SOCK_STREAM, 0);
addrport.sin_family = AF_INET;
htons and htonl Assigning address to sockets: bind() for TCP listening
htons and htonl takes integer input and we need to convert these integer values to int status = listen(sockid, queueLimit);
network byte order from host byte order.
● sockid: socket descriptor (integer)
● queueLimit: limit the number of active participants can wait for connection
addrport.sin_port = htons(5100); ● Not used for sending and receiving
● Only used by server to get new sockets
Establishing connection Accepting incoming connections
delivery (TCP)
network
data link 3.1 transport-layer 3.5 connection-oriented
physical
network services transport: TCP
congestion control network data link
data link physical
physical 3.2 multiplexing and segment structure
flow control network
data link
demultiplexing reliable data transfer
connection setup physical
network
3.3 connectionless flow control
unreliable, unordered data link
physical
connection management
delivery: UDP network
data link
transport: UDP
no-frills extension of network
physical
3.4 principles of reliable 3.6 principles of congestion
“best-effort” IP
data link
physical
network
application
transport data transfer control
data link network
Multiplexing De-Multiplexing
How does the message reach the How does the message reach the
correct application? correct application?
HTTP server HTTP server
client client
application application application application
HTTP HTTP
msg msg
transport
Ht HTTP transport
Ht HTTP
msg msg
network transport Hnnetwork
Ht HTTP transport
transport transport
msg
network link network network link network
link physical link link physical link
physical physical physical physical
Hn Ht HTTP
msg
How does the message reach the How does the message reach the
correct application? correct application?
HTTP server
Q: how did transport layer know to deliver message to Firefox
client browser process rather then Netflix process or Skype process?
application application
HTTP
msg
client
transport
Ht HTTP
msg application application
transport
H t HTTP
network transport HTTP
msg msg
network link network HTTP transport
Ht HTTP
msg msg
link physical link transport network transport
physical physical network link network
link physical link
physical physical
Characteristics of unreliable channel will determine Characteristics of unreliable channel will determine
complexity of reliable data transfer protocol (rdt) complexity of reliable data transfer protocol (rdt)
Transport Layer 3-21 Transport Layer 3-22
Reliable data transfer: getting started Reliable data transfer: getting started
We will:
rdt_send(): called from above, deliver_data(): called by
(e.g., by app.). Passed data to rdt to deliver data to upper Incrementally develop sender, receiver sides of
deliver to receiver upper layer reliable data transfer protocol (rdt)
Consider only unidirectional data transfer
but control info will flow on both directions!
send receive Use finite state machines (FSM) to specify sender,
side side receiver
event causing state transition
actions taken on state transition
state: when in this
“state” next state state state
uniquely determined 1 event
udt_send(): called by rdt, rdt_rcv(): called when packet by next event 2
actions
to transfer packet over arrives on rcv-side of channel
unreliable channel to receiver
Underlying channel perfectly reliable Underlying channel may flip bits in packet
no bit errors checksum to detect bit errors
no loss of packets The question: how to detect and recover from
Separate FSMs for sender, receiver: errors:
acknowledgements (ACKs): receiver explicitly tells sender
sender sends data into underlying channel that pkt received OK
receiver reads data from underlying channel negative acknowledgements (NAKs): receiver explicitly tells
sender
Howthatdopkthumans recover from “errors”
had errors
sender retransmits pkt on receipt of NAK
Wait for rdt_send(data) Wait for rdt_rcv(packet)
new mechanisms during conversation?
in rdt2.0 (beyond rdt1.0):
call from call from extract (packet,data)
above packet = make_pkt(data) below deliver_data(data) error detection
udt_send(packet)
receiver feedback: control msgs (ACK,NAK) rcvr-
>sender
sender receiver
feedback: control msgs (ACK,NAK) from receiver to then waits for receiver extract(rcvpkt,data)
GBN in action
Selective repeat
sender window (N=4) sender receiver
012345678 send pkt0 ❖ receiver individually acknowledges all correctly
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0 received pkts
012345678 send pkt3 Xloss receive pkt1, send ack1
▪ buffers pkts, as needed, for eventual in-order delivery
(wait) to upper layer
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1 ❖ sender only resends pkts for which ACK not
012345678 rcv ack1, send pkt5 receive pkt4, discard, received
ignore duplicate ACK
(re)send ack1
receive pkt5, discard,
▪ sender timer for each unACKed pkt
(re)send ack1 ❖ sender window
pkt 2 timeout
012345678 send pkt2 ▪ N consecutive seq #’s
012345678
012345678
send
send
pkt3
pkt4 rcv pkt2, deliver, send ack2 ▪ limits seq #s of sent, unACKed pkts
012345678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5
❖ ❖
URG: urgent data
point-to-point: full duplex data: (generally not used) source port # dest port # counting
by bytes
▪ one sender, one receiver ▪ bi-directional data flow sequence number of data
ACK: ACK #
❖ reliable, in-order byte in same connection valid acknowledgement number (not segments!)
steam: ▪ MSS: maximum segment head not
UAP R S F receive window
PSH: push data now len used
size # bytes
❖ pipelined: (generally not used) checksum Urg data pointer
❖
rcvr willing
connection-oriented:
▪ TCP congestion and RST, SYN, FIN: to accept
flow control set window ▪ handshaking (exchange connection estab
options (variable length)
(milliseconds)
retransmissions estimated RTT “smoother”
RTT
▪ average several recent
❖ too long: slow measurements, not just
reaction to segment current SampleRTT
loss sampleRTT
EstimatedRTT
SendBase=92
Seq=92, 8 bytes of Seq=92, 8 bytes of Seq=92, 8 bytes of
data data data
Seq=100, 20 bytes of data Seq=100, 20 bytes of data
timeo
timeo
ACK=100
ut
ut
X ACK=100
timeo
X
ut
ACK=100
ACK=120 ACK=120
SendBase=120
ACK=100
Computer
Networking: A
timeo
ACK=100
Top Down
ut
ACK=100
ACK=100 Approach
Seq=100, 20 bytes of data 6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
All material copyright 1996-2013
fast retransmit after sender J.F Kurose and K.W. Ross, All Rights Reserved
receipt of triple duplicate ACK
Transport Layer 3-32 Transport Layer 3-1
Chapter 3: Transport Layer Chapter 3 outline
our goals: 3.1 transport-layer 3.5 connection-oriented
❖ understand ❖ learn about Internet services transport: TCP
principles behind transport layer protocols: 3.2 multiplexing and ▪ segment structure
transport layer ▪ UDP: connectionless demultiplexing ▪ reliable data transfer
services: transport
3.3 connectionless ▪ flow control
▪ multiplexing, ▪ TCP: connection-oriented ▪ connection management
demultiplexing reliable transport transport: UDP
▪ TCP congestion control 3.4 principles of reliable 3.6 principles of congestion
▪ reliable data transfer
data transfer control
▪ flow control
▪ congestion control 3.7 TCP congestion control
❖ ❖
transport
provide logical network
network layer:
communication between
data link
household
physical
logical
app processes running on
communication 12 kidsanalogy:
in Ann’s house sending
different hosts letters to 12 kids in Bill’s
❖ transport protocols run in
between hosts house:
end systems ❖ transport layer: ❖ hosts = houses
logical ❖ processes = kids
▪ sender side: breaks app
communication ❖ app messages = letters in
messages into segments, envelopes
passes to network layer between processes ❖ transport protocol = Ann
▪ rcvr side: reassembles
application
transport ▪ relies on, enhances, and Bill who demux to in-
segments into messages,
network
data link network layer house siblings
services ❖ network-layer protocol =
physical
passes to app layer
postal service
❖ more than one transport
protocol available to apps
▪ Internet: TCP and UDP
Transport Layer 3-4 Transport Layer 3-5
Internet transport-layer protocols Chapter 3 outline
❖
application
reliable, in-order transport
delivery (TCP)
network
data link 3.1 transport-layer 3.5 connection-oriented
physical
network services transport: TCP
▪ congestion control network data link
data link physical
3.2 multiplexing and ▪ segment structure
▪ flow control
physical
network
data link
demultiplexing ▪ reliable data transfer
▪ connection setup physical
A
client
A
Application A A
1 2 application application
1 2 HTTP
msg
transport
Transpor
transport network transport
t link
network network
Network link physical link
physical physical
Multiplexing De-Multiplexing
How does the message reach the How does the message reach the
correct application? correct application?
HTTP server HTTP server
client client
application application application application
HTTP
msg
transport transport
Ht HTTP
msg
transport network transport transport network transport
network link network Hn H
network
t HTTP
link network
physical msg physical
link link link link
physical physical physical physical
Hn Ht HTTP
msg
host: IP source IP,port: B,80 host: IP host: IP source IP,port: B,80 host: IP
address A dest IP,port: A,9157 source IP,port: C,5775 address C address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80 dest IP,port: B,80
source IP,port: A,9157 source IP,port: A,9157
dest IP, port: B,80 dest IP, port: B,80
source IP,port: source IP,port:
C,9157 C,9157
dest IP,port: B,80 dest IP,port: B,80
three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets Transport Layer 3-22 Transport Layer 3-23
Transmitted: 5 6 11
application length, in bytes of
data UDP segment,
(payload) including header
Received: 4 6 11
❖ At receiver:
▪ Do the whole checksum.
▪ If sum is FFFF, there is no error
❖ Characteristics of unreliable channel will determine ❖ Characteristics of unreliable channel will determine
complexity of reliable data transfer protocol (rdt) complexity of reliable data transfer protocol (rdt)
Transport Layer 3-36 Transport Layer 3-37
Reliable data transfer: getting started Reliable data transfer: getting started
We will:
rdt_send(): called from above, deliver_data(): called by
(e.g., by app.). Passed data to rdt to deliver data to upper ❖ Incrementally develop sender, receiver sides of
deliver to receiver upper layer reliable data transfer protocol (rdt)
❖ Consider only unidirectional data transfer
▪ but control info will flow on both directions!
❖
send receive Use finite state machines (FSM) to specify sender,
side side receiver
event causing state transition
actions taken on state transition
state: when in this
“state” next state state state
uniquely determined 1 event
udt_send(): called by rdt, rdt_rcv(): called when packet by next event 2
actions
to transfer packet over arrives on rcv-side of channel
unreliable channel to receiver
rdt1.0: reliable transfer over a reliable channel rdt2.0: channel with bit errors
❖ Underlying channel perfectly reliable ❖ Underlying channel may flip bits in packet
▪ no bit errors ▪ checksum to detect bit errors
▪ no loss of packets ❖ The question: how to detect and recover from
❖ Separate FSMs for sender, receiver: errors:
▪ acknowledgements (ACKs): receiver explicitly tells
▪ sender sends data into underlying channel sender that pkt received OK
▪ receiver reads data from underlying channel ▪ negative acknowledgements (NAKs): receiver explicitly
tells sender that pkt had errors
How do humans recover from
▪ sender retransmits pkt on receipt of NAK
Wait for rdt_send(data) Wait for rdt_rcv(packet)
❖ new mechanisms in rdt2.0 “errors”(beyond rdt1.0):
call from call from
▪ error detection
extract (packet,data)
above packet = make_pkt(data) below deliver_data(data) during conversation?
udt_send(packet)
▪ receiver feedback: control msgs (ACK,NAK) rcvr-
>sender
sender receiver
❖ new mechanisms in rdt2.0 (beyond rdt1.0): stop and wait rdt_rcv(rcvpkt) &&
▪ error detection sender sends one packet, notcorrupt(rcvpkt)
▪ feedback: control msgs (ACK,NAK) from receiver to then waits for receiver extract(rcvpkt,data)
sender deliver_data(data)
response udt_send(ACK)
▪ retransmission
Transport Layer 3-42 Transport Layer 3-43
❖
sndpkt = make_pkt(0, data, checksum)
same functionality as rdt2.1, using ACKs only udt_send(sndpkt) rdt_rcv(rcvpkt) &&
❖ instead of NAK, receiver sends ACK for last pkt ( corrupt(rcvpkt) ||
Wait for Wait for
received OK call 0 from ACK isACK(rcvpkt,1) )
0 udt_send(sndpkt)
▪ receiver must explicitly include seq # of pkt being ACKed above
sender FSM
❖ duplicate ACK at sender results in same action as fragment rdt_rcv(rcvpkt)
NAK: retransmit current pkt && notcorrupt(rcvpkt)
&& isACK(rcvpkt,0)
rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) || Λ
has_seq1(rcvpkt)) Wait for receiver FSM
0 from
udt_send(sndpkt) below fragment
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK1, chksum)
Transport Layer 3-50 udt_send(sndpkt) Transport Layer 3-51
GBN in action
Selective repeat
sender window (N=4) sender receiver
012345678 send pkt0 ❖ receiver individually acknowledges all correctly
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0 received pkts
012345678 send pkt3 Xloss receive pkt1, send ack1
▪ buffers pkts, as needed, for eventual in-order delivery
(wait) to upper layer
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1 ❖ sender only resends pkts for which ACK not
012345678 rcv ack1, send pkt5 receive pkt4, discard, received
ignore duplicate ACK
(re)send ack1
receive pkt5, discard,
▪ sender timer for each unACKed pkt
(re)send ack1 ❖ sender window
pkt 2 timeout
012345678 send pkt2 ▪ N consecutive seq #’s
012345678
012345678
send
send
pkt3
pkt4 rcv pkt2, deliver, send ack2 ▪ limits seq #s of sent, unACKed pkts
012345678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5
❖ ❖
URG: urgent data
point-to-point: full duplex data: (generally not used) source port # dest port # counting
by bytes
▪ one sender, one receiver ▪ bi-directional data flow sequence number of data
ACK: ACK #
❖ reliable, in-order byte in same connection valid acknowledgement number (not segments!)
steam: ▪ MSS: maximum segment head not
UAP R S F receive window
PSH: push data now len used
size # bytes
❖ pipelined: (generally not used) checksum Urg data pointer
❖
rcvr willing
connection-oriented:
▪ TCP congestion and RST, SYN, FIN: to accept
flow control set window ▪ handshaking (exchange connection estab
options (variable length)
(milliseconds)
retransmissions estimated RTT “smoother”
RTT
▪ average several recent
❖ too long: slow measurements, not just
reaction to segment current SampleRTT
loss sampleRTT
EstimatedRTT
SendBase=92
Seq=92, 8 bytes of Seq=92, 8 bytes of Seq=92, 8 bytes of
data data data
Seq=100, 20 bytes of data Seq=100, 20 bytes of data
timeo
timeo
ACK=100
ut
ut
X ACK=100
timeo
X
ut
ACK=100
ACK=120 ACK=120
SendBase=120
ACK=100
3.6 principles of congestion
ut
TCP socket OS
receiver buffers
❖ Please explain if the following statements are … slower than TCP
receiver is delivering
True/False. (sender is sending) TCP
A) Cookies are a piece of code that has the potential code
LAST_ACK
FINbit=1,
TIMED_WAIT seq=y can no longer
send data
ACKbit=1;
timed wait ACKnum=y+1
for 2*max CLOSED
segment lifetime
CLOSED
delay
λout
time
Transport Layer 3-102 Transport Layer 3-103
TCP Congestion Control: details TCP Slow Start
Host A Host B
sender sequence number space
cwnd TCP sending rate: ❖ when connection begins,
❖ roughly: send cwnd
increase rate
bytes, wait RTT for exponentially until first
RTT
ACKS, then send loss event:
last byte
ACKed sent, not-
last byte
sent more bytes ▪ initially cwnd = 1 MSS
▪ double cwnd every RTT
yet ACKed
(“in-flight”)
cwnd ▪ done by incrementing
❖ sender limits transmission: rate ~
~ bytes/sec
RTT cwnd for every ACK
LastByteSent- < cwnd received
❖
LastByteAcked
summary: initial rate is
❖ cwnd is dynamic, function slow but ramps up
of perceived network exponentially fast time
congestion
Transport Layer 3-104 Transport Layer 3-105
❖ Assuming TCP Reno is the protocol ❖ Assuming TCP Reno is the protocol
experiencing the behavior shown. experiencing the behavior shown.
c. After the 15th transmission round, is segment loss detected by a triple e. What is the initial value of ssthresh at the first transmission round?
duplicate ACK or by a timeout? f. What is the value of ssthresh at the 18th transmission round?
d. After the 22nd transmission round, is segment loss detected by a triple g. What is the value of ssthresh at the 24th transmission round?
Transport Layer 3-110 Transport Layer 3-111
duplicate ACK or by a timeout?
❖ Assuming TCP Reno is the protocol Fairness (more)
experiencing the behavior shown.
Fairness and UDP Fairness, parallel TCP
❖ multimedia apps often connections
do not use TCP ❖ An application can open
▪ do not want rate multiple parallel
throttled by congestion connections between two
control
hosts
❖ instead use UDP:
❖ web browsers do this
▪ send audio/video at
constant rate, tolerate ❖ e.g., link of rate R with 9
packet loss existing connections:
❖ there is no “Internet ▪ new app asks for 1 TCP, gets rate
police” policing use of R/10
h. During what transmission round is the 70th segment sent? ▪ new app asks for 11 TCPs, gets R/2
congestion control
i. Assuming a packet loss is detected after the 26th round by the receipt of a
triple duplicate ACK, what will be the values of the congestion window size
Transport Layer 3-112 Transport Layer 3-113
and of ssthresh ?
▪ layer physical
ICMP application
▪ 4.7 broadcast and multicast
❖
network
IPv6 transport
3 2
a VC consists of: 1
2
3
system bus
link layer
physical layer
Len= 4000 ; ID= X; fragflag=0; offset=0 4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and ▪ link state
MTU = 1500 datagram networks ▪ distance vector
4.3 what’s inside a router ▪ hierarchical routing
Len= 1500 ; ID= X; Len= 1500 ; ID= X; Len= 1040 ; ID= X; 4.4 IP: Internet Protocol 4.6 routing in the Internet
▪ RIP
fragflag=1; offset=0 fragflag=1; offset=185 fragflag=0; offset=370 ▪ datagram format
▪ OSPF
▪ IPv4 addressing
MTU = 900 ▪ BGP
▪ ICMP
▪ IPv6 4.7 broadcast and multicast
Len= 900 ; Len= 620 ; Len= 900 ; Len= 620 ; Len= 900 ; Len= 160 ; routing
ID= X; FF=1; ID= X; FF=1; ID= X; FF=1; ID= X; FF=1; ID= X; FF=1; ID= X; FF=0;
offset=0 offset=110 offset=185 offset=295 offset=370 offset=480
Receiver
0 880 1480 2360 2960 3840
physically reach each other 223.1.1.2 223.1.2.1 ❖ to determine the 223.1.1.2 223.1.2.1
without passing through an 223.1.1.4 223.1.2.9 subnets, detach each 223.1.1.4 223.1.2.9
intervening router interface from its host
223.1.2.2 223.1.2.2
223.1.1.3 223.1.3.27 or router, creating 223.1.1.3 223.1.3.27
223.1.2.6
11001000 00010111 00010000 00000000
223.1.3.27
223.1.3.1 223.1.3.2
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
223.1.3.0/24
lifetime: 3600 secs
“Send me anything
with addresses ▪ manages DNS
Organization 2
200.23.20.0/23 . Fly-By-Night-ISP
beginning
200.23.16.0/20” ▪ assigns domain names, resolves disputes
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
Organization 1 beginning 199.31.0.0/16
or 200.23.18.0/23”
200.23.18.0/23
• Dijkstra’s algorithm
• Bellman-Ford algorithm
v 3 w v 3 w
2 5 2 5
u 2 1 z u 2 1 z
3 3
1 2 1 2
x y x y
1 1
v 3 w v 3 w
2 5 2 5
Question
Cost can be always 1, or inversely related u 2 1 z Cost can be always 1, or inversely related u 2 1 z
3 What is the least cost path between u and z? 3
to bandwidth, or inversely related to 1 2
to bandwidth, or inversely related to 1 2
Routing algorithm: Algorithm that finds a “good” path (typically,
x y x y
congestion. 1 congestion. 1
the least cost path)
v 3 w
2 5
Question
Cost can be always 1, or inversely related u 2 1 z
What is the least cost path between u and z? 3
to bandwidth, or inversely related to 1 2
Routing algorithm: Algorithm that finds a “good” path (typically,
x y
congestion. 1
the least cost path)
Global:
• All routers have complete topology and link
cost information
• “Link state” algorithms
Global: Global:
• All routers have complete topology and link • All routers have complete topology and link
cost information cost information
• “Link state” algorithms • “Link state” algorithms
Decentralized: Decentralized:
• Router knows physically-connected neighbors • Router knows physically-connected neighbors
and link costs to neighbors and link costs to neighbors
• Iterative process of computation, exchange of • Iterative process of computation, exchange of
information with neighbors information with neighbors
• “Distance vector” algorithms • “Distance vector” algorithms
Dynamic:
Decentralized: Decentralized: • Routes change more quickly
• Router knows physically-connected neighbors • Router knows physically-connected neighbors • Periodic update
and link costs to neighbors and link costs to neighbors • In response to link cost changes
• Iterative process of computation, exchange of • Iterative process of computation, exchange of
information with neighbors information with neighbors
• “Distance vector” algorithms • “Distance vector” algorithms
• Computes least cost paths from one • Computes least cost paths from one
node (“source”) to all other nodes node (“source”) to all other nodes
• Gives routing table for that node • Gives routing table for that node
• Accomplished via “link state broadcast” • D(v): Current value of cost of path 5 then D(v) = c(A, v)
6 else D(v) = ∞
from source to v
• All nodes have same information 7
• p(v): Current predecessor of v along 8 Loop
• Computes least cost paths from one path from source to v 9 find w not in N’ such that D(w) is a minimum
node (“source”) to all other nodes
• N’: Set of nodes whose least cost 10 add w to N’
• Gives routing table for that node path are known 11 update D(v) for all v adjacent to w and not in N’:
12 D(v) = min( D(v), D(w) + c(w,v) )
• Iterative: After k iterations, know 13 /* new cost to v is either old cost to v or known
least cost paths to k destinations 14 * shortest path cost to w plus cost from w to v */
15 until all nodes in N’
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
Next node?
B instead of C?
5 5
Cost of A-B is smaller (2) than cost of A-C (3)
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
5 5
B 3 C B 3 C
2 5 2 5
A 2 F A 2 F
1 1
3 3
1 2 1 2
D E D E
1 1
A F
D E
D E D E
Destination Link
B (A, B)
D (A, D)
E (A, D)
C (A, D)
F (A, D)
D E
Destination Link
B (A, B)
A A A A
D (A, D) 1 1+e 2+e 0 0 2+e 2+e 0
D 0 B D 1+e 1 B D B D 1+e 1 B
E (A, D) Forwarding table in A 0 0 0
0 e 0 0 1 e
C (A, D) 1
C C C 1+e 0
C
1
F (A, D)
e
initially … recompute … recompute
Data Networks Routing Algorithms 21 Data Networks Routing Algorithms 22
Dijkstra’s Algorithm: Discussion Dijkstra’s Algorithm: Discussion
Algorithm complexity: n nodes Algorithm complexity: n nodes
• Each iteration: need to check all nodes, w, not in N’ • Each iteration: need to check all nodes, w, not in N’
• Depending on data structure: O(n2), O(n log n), … • Depending on data structure: O(n2), O(n log n), …
Oscillations possible:
e.g., link cost = amount of carried traffic
Fix? Randomized update times
A A A A A A A A
1 1+e 2+e 0 0 2+e 2+e 1 1+e 2+e 0 0 2+e 2+e
0 0
D 0 B D 1+e 1 B D B D 1+e 1 B D 0 B D 1+e 1 B D B D 1+e 1 B
0 0 0 0 0 0
0 e 0 0 1 1+e 0 e 0 e 0 0 1 1+e 0 e
C C C C C C C C
1 1 1 1
e e
initially … recompute … recompute initially … recompute … recompute
Data Networks Routing Algorithms 22 Data Networks Routing Algorithms 22
v 3 w
2 5
Define u 2
3
1 z
Then
• dx(y) = minv{ c(x, v) + dv(y) }
where min is taken over all neighbors v of x
v 3 w v 3 w
2 5 2 5 Bellman-Ford equation says:
u 2 1 z u 2 1 z
3 3 du(z) = minv{ c(u, v) + dv(z),
1 2 1 2 c(u, x) + dx(z),
x y x y
1 1 c(u, w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
x x
y y
2 1 2 1
y x z y x z
7 7
z z
time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to
x y z x y z
x 0 2 7 x 0 2 7
from
from
x x
y ∞ ∞ ∞ y ∞ ∞ ∞
z ∞ ∞ ∞ z ∞ ∞ ∞
y x y z y
2 1 2 1
x ∞ ∞ ∞
z z
from
y x y x
7 y 2 0 1 7
z ∞ ∞ ∞
z z
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to
x y z x y z
x 0 2 7 x 0 2 7
from
from
x x
y ∞ ∞ ∞ y ∞ ∞ ∞
z ∞ ∞ ∞ z ∞ ∞ ∞
x y z y x y z y
2 1 2 1
x ∞ ∞ ∞ x ∞ ∞ ∞
z z
from
from
y x y x
y 2 0 1 7 y 2 0 1 7
z ∞ ∞ ∞ z ∞ ∞ ∞
x y z x y z
x ∞ ∞ ∞ x ∞ ∞ ∞
from
from
z z
y ∞ ∞ ∞ y ∞ ∞ ∞
z 7 1 0 z 7 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to to to
x y z x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 7 x 0 2 3
from
from
x x
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0
x y z y x y z y
2 1 2 1
x ∞ ∞ ∞ x ∞ ∞ ∞
z z
from
from
y x y x
y 2 0 1 7 y 2 0 1 7
z ∞ ∞ ∞ z ∞ ∞ ∞
x y z x y z
x ∞ ∞ ∞ x ∞ ∞ ∞
from
from
z z
y ∞ ∞ ∞ y ∞ ∞ ∞
z 7 1 0 z 7 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
Dx(y) = min {c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(y) = min {c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min {c(x,y) + Dy(z), c(x,z) + Dz(z)}
= min {2+0 , 7+1} = 2 = min {2+0 , 7+1} = 2 = min {2+1 , 7+0} = 3
to to to to
x y z x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 7 x 0 2 3
from
from
x x
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0
x y z y x y z y
2 1 2 1
x ∞ ∞ ∞ x ∞ ∞ ∞
z z
from
from
y x y x
y 2 0 1 7 y 2 0 1 7
z ∞ ∞ ∞ z ∞ ∞ ∞
x y z x y z
x ∞ ∞ ∞ x ∞ ∞ ∞
from
from
z z
y ∞ ∞ ∞ y ∞ ∞ ∞
z 7 1 0 z 7 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to to to
x y z x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 7 x 0 2 3
from
from
x x
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0
x y z x y z y x y z x y z y
2 1 2 1
x ∞ ∞ ∞ x 0 2 7 x ∞ ∞ ∞ x 0 2 7
z z
from
from
y x y x
y 2 0 1 y 2 0 1 7 y 2 0 1 y 2 0 1 7
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0
x y z x y z
x ∞ ∞ ∞ x ∞ ∞ ∞
from
from
z z
y ∞ ∞ ∞ y ∞ ∞ ∞
z 7 1 0 z 7 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to to to
x y z x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 7 x 0 2 3
from
from
x x
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0
x y z x y z y x y z x y z y
2 1 2 1
x ∞ ∞ ∞ x 0 2 7 x ∞ ∞ ∞ x 0 2 7
z z
from
from
y x y x
y 2 0 1 y 2 0 1 7 y 2 0 1 y 2 0 1 7
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0
x y z x y z x y z x y z
x ∞ ∞ ∞ x 0 2 7 x ∞ ∞ ∞ x 0 2 7
from
from
z z
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ y 2 0 1
z 7 1 0 z 3 1 0 z 7 1 0 z 3 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to to to to to
x y z x y z x y z x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3 x 0 2 7 x 0 2 3 x 0 2 3
from
from
x x
y ∞ ∞ ∞ y 2 0 1 y 2 0 1 y ∞ ∞ ∞ y 2 0 1 y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0 z ∞ ∞ ∞ z 7 1 0 z 3 1 0
x y z x y z y x y z x y z x y z y
2 1 2 1
x ∞ ∞ ∞ x 0 2 7 x ∞ ∞ ∞ x 0 2 7 x 0 2 3
z z
from
from
y x y x
y 2 0 1 y 2 0 1 7 y 2 0 1 y 2 0 1 y 2 0 1 7
z ∞ ∞ ∞ z 7 1 0 z ∞ ∞ ∞ z 7 1 0 z 3 1 0
x y z x y z x y z x y z
x ∞ ∞ ∞ x 0 2 7 x ∞ ∞ ∞ x 0 2 7
from
from
z z
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ y 2 0 1
z 7 1 0 z 3 1 0 z 7 1 0 z 3 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
to to to to to to
x y z x y z x y z x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3 x 0 2 7 x 0 2 3 x 0 2 3
from
from
x x
y ∞ ∞ ∞ y 2 0 1 y 2 0 1 y ∞ ∞ ∞ y 2 0 1 y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0 z ∞ ∞ ∞ z 7 1 0 z 3 1 0
x y z x y z x y z y x y z x y z x y z y
2 1 2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x ∞ ∞ ∞ x 0 2 7 x 0 2 3
z z
from
from
y x y x
y 2 0 1 y 2 0 1 y 2 0 1 7 y 2 0 1 y 2 0 1 y 2 0 1 7
z ∞ ∞ ∞ z 7 1 0 z 3 1 0 z ∞ ∞ ∞ z 7 1 0 z 3 1 0
x y z x y z x y z x y z x y z x y z
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x ∞ ∞ ∞ x 0 2 7 x 0 2 3
from
from
z z
y ∞ ∞ ∞ y 2 0 1 y 2 0 1 y ∞ ∞ ∞ y 2 0 1 y 2 0 1
z 7 1 0 z 3 1 0 z 3 1 0 z 7 1 0 z 3 1 0 z 3 1 0
time time
Data Networks Routing Algorithms 27 Data Networks Routing Algorithms 27
Distance Vector Algorithm Distance Vector Algorithm
Iterative, asynchronous:
• Each local iteration caused by:
• Local link cost change
• DV update message from neighbor
recompute estimates
Distributed: Distributed:
• Each node notifies neighbors only when • Each node notifies neighbors only when If Distance Vector to any dst. has
its Distance Vector changes its Distance Vector changes changed, notify neighbors
• Neighbors then notify their neighbors if • Neighbors then notify their neighbors if
necessary necessary
Distance Vector: Link Cost Changes Distance Vector: Link Cost Changes
Link cost changes Link cost changes 1
y
4 1
• Node detects local link cost change • Node detects local link cost change
x z
• Updates routing info, recalculates distance vector • Updates routing info, recalculates distance vector 50
• At time t0: y detects the link-cost change, updates its DV, and informs its neighbors. • At time t0: y detects the link-cost change, updates its DV, and informs its neighbors.
• At time t1: z receives the update from y and updates its table. It computes a new least
cost to x and sends its DV to neighbors.
Distance Vector: Link Cost Changes Distance Vector: Link Cost Changes
Link cost changes 1 Link cost changes 1
y y
4 1 4 1
• Node detects local link cost change • Node detects local link cost change
x z x z
• Updates routing info, recalculates distance vector 50 • Updates routing info, recalculates distance vector 50
to to
x y z x y z
x x
from
from
y y
y 4 0 1 y 4 0 1
z 5 1 0 z 5 1 0
x y z x y z
x x
from
from
z z
y 4 0 1 y 4 0 1
z 5 1 0 z 5 1 0
DV Algorithm: Good News Travels Fast! DV Algorithm: Good News Travels Fast!
1 1
y y
4 1 4 1
x z x z
50 50
to to to
x y z x y z x y z
x x x
from
from
y y
y 14 0 1 y 14 0 1 y 1 0 1
z 5 1 0 z 5 1 0 z 5 1 0
x y z x y z
x x
from
from
z z
y 4 0 1 y 4 0 1
z 5 1 0 z 5 1 0
to to to to to
x y z x y z x y z x y z x y z
x x x x x
from
from
y y
y 14 0 1 y 1 0 1 y 14 0 1 y 1 0 1 y 1 0 1
z 5 1 0 z 5 1 0 z 5 1 0 z 5 1 0 z 2 1 0
x y z x y z x y z x y z x y z
x x x x x
from
from
z z
y 4 0 1 y 1 0 1 y 4 0 1 y 1 0 1 y 1 0 1
z 5 1 0 z 2 1 0 z 5 1 0 z 2 1 0 z 2 1 0
Distance Vector: Link Cost Changes DV Algorithm: Bad News Travels Slowly!
Link cost changes: y
• Good news travels fast 4 1
60
• Bad news travels… y
x
50
z
4 1
x z to
50
x y z
x
from
y
y 4 0 1
z 5 1 0
x y z
x
from
z
y 4 0 1
z 5 1 0
to to
x y z x y z
x x
from
from
y y
y 4 0 1 y 64 0 1
z 5 1 0 z 5 1 0
x y z x y z
x x
from
from
z z
y 4 0 1 y 4 0 1
z 5 1 0 z 5 1 0
DV Algorithm: Bad News Travels Slowly! DV Algorithm: Bad News Travels Slowly!
60 60
y y
Dy(x) = min {c(y,x) + Dx(x), c(y,z) + Dz(x)} 4 1 4 1
= min {60+0 , 1+5} = 6 x z x z
50 50
to to to
x y z x y z x y z
x x x
from
from
y y
y 64 0 1 y 64 0 1 y 6 0 1
z 5 1 0 z 5 1 0 z 5 1 0
x y z x y z
x x
from
from
z z
y 4 0 1 y 4 0 1
z 5 1 0 z 5 1 0
to to to to to
x y z x y z x y z x y z x y z
x x x x x
from
from
y y
y 64 0 1 y 6 0 1 y 64 0 1 y 6 0 1 y 68 0 1
z 5 1 0 z 5 1 0 z 5 1 0 z 5 1 0 z 7 1 0
x y z x y z x y z x y z
x x x x
from
from
z z
y 4 0 1 y 6 0 1 y 4 0 1 y 6 0 1
z 5 1 0 z 57 1 0 z 5 1 0 z 57 1 0
DV Algorithm: Bad News Travels Slowly! DV Algorithm: Bad News Travels Slowly!
60 60
y y
Dy(x) = min {c(y,x) + Dx(x), c(y,z) + Dz(x)} 4 1 4 1
= min {60+0 , 1+7} = 8 x z x z
50 50
to to to to to to
x y z x y z x y z x y z x y z x y z
x x x x x x
from
from
y y
y 64 0 1 y 6 0 1 y 68 0 1 y 64 0 1 y 6 0 1 y 68 0 1
z 5 1 0 z 5 1 0 z 7 1 0 z 5 1 0 z 5 1 0 z 7 1 0
x y z x y z x y z x y z x y z
x x x x x
from
from
z z
y 4 0 1 y 6 0 1 y 4 0 1 y 6 0 1 y 6 0 1
z 5 1 0 z 57 1 0 z 5 1 0 z 57 1 0 z 7 1 0
Distance Vector: Link Cost Changes Distance Vector: Link Cost Changes
Link cost changes: 60 Link cost changes: 60
y y
• Good news travels fast 4 1 • Good news travels fast 4 1
• Bad news travels slowly x z • Bad news travels slowly x z
50 50
Bad news travels slowly: “count to infinity” problem! Bad news travels slowly: “count to infinity” problem!
• 44 iterations before algorithm stabilizes! • 44 iterations before algorithm stabilizes!
• Speed of convergence?
• LS: O(n2), O(E + n log n) depending on data structure; may oscillate • Link-state algorithm
• DV: varies; routing loops and “count to infinity” problem • Dijkstra’s algorithm
▪ layer physical
ICMP application
▪ 4.7 broadcast and multicast
❖
network
IPv6 transport
3 2
a VC consists of: 1
2
3
system bus
link layer
physical layer
IP datagram format
IP protocol version 32 bits
number total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset Reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at Flgs: 3 bits
32 bit source IP address Rsvd, DF, MF
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead? data taken, specify
❖ 20 bytes of TCP
(variable length, list of routers
typically a TCP to visit.
❖ 20 bytes of IP
or UDP segment)
❖ = 40 bytes + app
layer overhead
…
frame in: one large datagram ❖ MTU = 1500 bytes
one large datagram becomes
▪ different link types, out: 3 smaller datagrams several smaller datagrams
different MTUs
1480 bytes in length ID fragflag offset
❖ large IP datagram divided data field =1500 =x =1 =0
(“fragmented”) within net reassembly
▪ one datagram becomes offset = length ID fragflag offset
several datagrams 1480/8 =1500 =x =1 =185
▪ “reassembled” only at
…
length ID fragflag offset
final destination =1040 =x =0 =370
▪ IP header bits used to
identify, order related
fragments
Network Layer 4-36 Network Layer 4-37
Len= 4000 ; ID= X; fragflag=0; offset=0 4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and ▪ link state
MTU = 1500 datagram networks ▪ distance vector
4.3 what’s inside a router ▪ hierarchical routing
Len= 1500 ; ID= X; Len= 1500 ; ID= X; Len= 1040 ; ID= X; 4.4 IP: Internet Protocol 4.6 routing in the Internet
▪ RIP
fragflag=1; offset=0 fragflag=1; offset=185 fragflag=0; offset=370 ▪ datagram format
▪ OSPF
▪ IPv4 addressing
MTU = 900 ▪ BGP
▪ ICMP
▪ IPv6 4.7 broadcast and multicast
Len= 900 ; Len= 620 ; Len= 900 ; Len= 620 ; Len= 900 ; Len= 160 ; routing
ID= X; FF=1; ID= X; FF=1; ID= X; FF=1; ID= X; FF=1; ID= X; FF=1; ID= X; FF=0;
offset=0 offset=110 offset=185 offset=295 offset=370 offset=480
Receiver
0 880 1480 2360 2960 3840
Subnets Subnets
223.1.1.0/24
223.1.2.0/24
❖ What’s a subnet ?
▪ device interfaces that can
223.1.1.1
recipe 223.1.1.1
physically reach each other 223.1.1.2 223.1.2.1 ❖ to determine the 223.1.1.2 223.1.2.1
without passing through an 223.1.1.4 223.1.2.9 subnets, detach each 223.1.1.4 223.1.2.9
intervening router 223.1.2.2
interface from its host 223.1.2.2
223.1.1.3 223.1.3.27 or router, creating 223.1.1.3 223.1.3.27
223.1.2.6
11001000 00010111 00010000 00000000
223.1.3.27
223.1.3.1 223.1.3.2
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
223.1.3.0/24
lifetime: 3600 secs
Organization 0 Organization 0
200.23.16.0/23 200.23.16.0/23
Organization 1
“Send me anything “Send me anything
200.23.18.0/23 with addresses with addresses
Organization 2 beginning Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20” 200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
. .
. . Internet . . Internet
. .
Organization 7 . Organization 7 .
200.23.30.0/23 200.23.30.0/23
“Send me anything “Send me anything
ISPs-R-Us ISPs-R-Us
with addresses with addresses
beginning Organization 1 beginning 199.31.0.0/16
199.31.0.0/16” or 200.23.18.0/23”
200.23.18.0/23
1
10.0.0.1
▪ routers should only process up to layer 3
2
S: 138.76.29.7, 5001
D: 128.119.40.186, 80 10.0.0.4 ▪ violates end-to-end argument
10.0.0.2
138.76.29.7
• NAT possibility must be taken into account by app
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4 designers, e.g., P2P applications
S: 128.119.40.186, 80
3
D: 138.76.29.7, 5001
3: reply arrives
4: NAT router 10.0.0.3
▪ address shortage should instead be solved by
changes datagram
dest. address: dest addr from IPv6
138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345
3 probes 3 probes
3 probes
Network Layer 4-68 Network Layer 4-69
IPv6 datagram format Other changes from IPv4
priority: identify priority among datagrams in
❖ checksum: removed entirely to reduce processing
flow time at each hop
flow Label: identify datagrams in same “flow.” ❖ options: allowed, but outside of header, indicated
(concept of“flow” not well defined). by “Next Header” field
next header: identify upper layer protocol for ❖ ICMPv6: new version of ICMP
ver pri flow label
data payload len next hdr hop limit ▪ additional message types, e.g. “Packet Too Big”
source address
(128 bits)
▪ multicast group management functions
destination address
(128 bits)
data
32 bits
Network Layer 4-70 Network Layer 4-71
❖ tunneling: IPv6 datagram carried as payload in IPv4 IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
IPv6 datagram
IPv4 datagram
Network Layer 4-74 Network Layer 4-75
data
Src: A
Dest: F
Src: A
Dest: F data
• think of application-level changes in last 25
years: WWW, social media, streaming media,
data data gaming, telepresence, …
A-to-B: E-to-F:
• Why?
IPv6 B-to-C: B-to-C: IPv6
IPv6 inside IPv6 inside 1
IPv4 IPv4 https://www.google.com/intl/en/ipv6/statistics.html
Network Layer 4-76 Network Layer 4-77
Chapter 4: outline Interplay between routing, forwarding
routing algorithm determines
4.1 introduction 4.5 routing algorithms routing algorithm
end-end-path through network
4.2 virtual circuit and ▪ link state
▪ distance vector forwarding table determines
datagram networks local forwarding table
local forwarding at this router
4.3 what’s inside a router ▪ hierarchical routing dest address output link
address-range 1 3
4.4 IP: Internet Protocol 4.6 routing in the Internet address-range 2 2
▪ RIP address-range 3 2
▪ datagram format address-range 4 1
▪ OSPF
▪ IPv4 addressing
▪ BGP
▪ ICMP IP destination address in
▪ IPv6 4.7 broadcast and multicast arriving packet’s header
routing
1
3 2
N = set of routers = { u, v, w, x, y, z }
cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
aside: graph abstraction is useful in other network contexts, e.g., key question: what is the least-cost path between u and z
P2P, where N is set of peers and E is set of TCP connections ?
routing algorithm: algorithm that finds that least cost
Network Layer 4-82
path Network Layer 4-83
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
Distance vector algorithm = min{2+1 , 7+0} = 3
node x cost to cost to
table x y z x y z
iterative, asynchronous: each
x 0 2 7 x 0 2 3
each local iteration node:
from
from
y ∞∞ ∞ y 2 0 1
caused by:
wait for (change in local link z ∞∞ ∞ z 7 1 0
❖ local link cost change
cost or msg from neighbor)
❖ DV update message from node y cost to
neighbor table x y z y
2 1
x ∞ ∞ ∞
distributed: recompute estimates x z
from
y 2 0 1 7
❖ each node notifies z ∞∞ ∞
neighbors only when its
DV changes if DV to any dest has
node z cost to
▪ neighbors then notify their changed, notify neighbors table x y z
neighbors if necessary x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
Network Layer 4-98 Network Layer 4-99
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
Distance vector: link cost changes
node x cost to cost to cost to
table x y z x y z x y z link cost changes: 1
x 0 2 7 x 0 2 3 x 0 2 3 ❖ node detects local link cost change y
from
from
y ∞∞ ∞ y 2 0 1 4 1
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 ❖ updates routing info, recalculates
z 3 1 0 x z
distance vector 50
node y cost to cost to cost to ❖ if DV changes, notify neighbors
table x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z “good t0 : y detects link-cost change, updates its DV, informs its
from
from
y 2 0 1 y 2 0 1 7
from
y 2 0 1 neighbors.
z ∞∞ ∞ z 7 1 0 z 3 1 0
news
travels t1 : z receives update from y, updates its table, computes new
node z cost to cost to cost to fast” least cost to x , sends its neighbors its DV.
table x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3 t2 : y receives z’s update, updates its distance table. y’s least costs
from
y 2 0 1 from
y 2 0 1 do not change, so y does not send a message to z.
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Network Layer 4-100 Network Layer 4-103
3c 3c
x
3a 3a
3b 3b
AS3 2c other AS3 2c other
1c 2a networks 1c 2a networks
other 1a 2b other 1a 2b
networks 1b AS2 networks 1b AS2
AS1 1d AS1 1d
Example: choosing among multiple ASes Example: choosing among multiple ASes
❖ now suppose AS1 learns from inter-AS protocol that subnet
❖ now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2.
x is reachable from AS3 and from AS2. ❖ to configure forwarding table, router 1d must determine
❖ to configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x
which gateway it should forward packets towards for dest x ▪ this is also job of inter-AS routing protocol!
▪ this is also job of inter-AS routing protocol! ❖ hot potato routing: send packet towards closest of two
routers.
3c
x
use routing info determine from
learn from inter-AS hot potato routing:
3a protocol that subnet
from intra-AS
choose the gateway
forwarding table the
3b protocol to determine interface I that leads
AS3 2c other x is reachable via
costs of least-cost
that has the to least-cost gateway.
1c 2a networks multiple gateways
paths to each
smallest least cost Enter (x,I) in
other 1a 2b of the gateways forwarding table
networks 1b AS2
AS1 1d
?
Network Layer 4-112 Network Layer 4-113
Chapter 4: outline Intra-AS Routing
4.1 introduction 4.5 routing algorithms ❖ also known as interior gateway protocols (IGP)
▪ link state
4.2 virtual circuit and ❖ most common intra-AS routing protocols:
datagram networks ▪ distance vector
4.3 what’s inside a router ▪ hierarchical routing ▪ RIP: Routing Information Protocol
4.4 IP: Internet Protocol 4.6 routing in the Internet ▪ OSPF: Open Shortest Path First
▪ RIP
▪ datagram format
▪ OSPF
▪ IGRP: Interior Gateway Routing Protocol
▪ IPv4 addressing (Cisco proprietary)
▪ BGP
▪ ICMP
▪ IPv6 4.7 broadcast and multicast
routing
3c eBGP session
BGP
3a message 3a iBGP session
3b 3b
AS3 2c other AS3 2c other
1c 2a networks 1c 2a networks
other 1a 2b other 1a 2b
networks 1b AS2 networks 1b AS2
AS1 1d AS1 1d
How does entry get in forwarding table? How does entry get in forwarding table?
routing algorithms
High-level overview
Assume prefix 1. Router becomes aware of prefix
entr
local forwarding table is 2. Router determines output port for prefix
prefix output port
y 138.16.64/22 3
in another AS. 3. Router enters prefix-port in forwarding table
124.12/16 2
212/8 4
………….. …
Dest IP
1
3 2
Router becomes aware of prefix Router may receive multiple routes
3c 3c
BGP BGP
3a message 3a message
3b 3b
AS3 2c other AS3 2c other
1c 2a networks 1c 2a networks
other 1a 2b other 1a 2b
networks 1b AS2 networks 1b AS2
AS1 1d AS1 1d
Select best BGP route to prefix Find best intra-route to BGP route
❖ Use selected route’s NEXT-HOP attribute
❖ Router selects route based on shortest AS-PATH ▪ Route’s NEXT-HOP attribute is the IP address of the
router interface that begins the AS PATH.
❖ Example:
❖ AS-PATH: AS2 AS17 ; NEXT-HOP: 111.99.86.55
❖ Example: selec ❖ Router uses OSPF to find shortest path from 1c to
❖ AS2 AS17 to 138.16.64/22 t 111.99.86.55
❖ AS3 AS131 AS201 to 138.16.64/22
3c
❖
3a
What if there is a tie? We’ll come back to that! 3b 111.99.86.
AS3 55 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Router identifies port for route Hot Potato Routing
❖ Suppose there two or more best inter-routes.
❖ Identifies port along the OSPF shortest path
❖ Then choose route with closest NEXT-HOP
❖ Adds prefix-port entry to its forwarding table:
▪ (138.16.64/22 , port 4) ▪ Use OSPF to determine which gateway is closest
▪ Q: From 1c, chose AS3 AS131 or AS2 AS17?
▪ A: route AS3 AS201 since it is closer
3c router 3c
3a port 3a
3b 3b
AS3 1 2c other 2c
1c 4 AS3 1c
other
2 3 2a networks 2a networks
other 1a 2b other 1a 2b
networks 1b AS2 networks 1b
AS1 1d 1d AS2
AS1
Chapter 4: done!
Chapter 5
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and ▪ link state, distance vector, Link Layer
datagram networks hierarchical routing
4.3 what’s inside a router 4.6 routing in the Internet
▪ RIP, OSPF, BGP
4.4 IP: Internet Protocol
▪ datagram format, IPv4 Computer
addressing, ICMP, IPv6 Networking: A
❖ understand principles behind network layer services:
Top Down
Approach
▪ network layer service models, forwarding versus routing 6th edition
how a router works, routing (path selection), broadcast, Jim Kurose, Keith Ross
multicast Addison-Wesley
❖ instantiation, implementation in the Internet March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Channel partitioning MAC protocols: TDMA Channel partitioning MAC protocols: FDMA
TDMA: time division multiple access FDMA: frequency division multiple access
❖ access to channel in "rounds" ❖ channel spectrum divided into frequency bands
❖ each station gets fixed length slot (length = pkt ❖ each station assigned fixed frequency band
trans time) in each round ❖ unused transmission time in frequency bands go idle
❖ unused slots go idle ❖ example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6
❖ example: 6-station LAN, 1,3,4 have pkt, slots idle
2,5,6 idle
frequency bands
6-slot 6-slot
frame frame
1 3 4 1 3 4
FDM cable
Efficient? Fair? Distributed?
Link Layer 5-24 Link Layer 5-25
Random access protocols Random Access
Slotted ALOHA
Protocols:
• Collisions are OK
• Randomize to
❖ when node has packet to send recover assumptions: operation:
▪ transmit at full channel data rate R. from collisions
❖ all frames same size ❖ when node obtains fresh
▪ no a priori coordination among nodes ❖ frame, transmits in next slot
two or more transmitting nodes ➜ “collision”,
time divided into equal size
❖ slots (time to transmit 1 ▪ if no collision: node can
❖ random access MAC protocol specifies: frame) send new frame in next
▪ how to detect collisions ❖ nodes are synchronized slot
▪ how to recover from collisions (e.g., via delayed ❖ nodes start to transmit ▪ if collision: node
retransmissions) only slot beginning retransmits frame in each
❖ examples of random access MAC protocols: ❖ if 2 or more nodes transmit subsequent slot with prob.
▪ slotted ALOHA in slot, all nodes detect p until success
▪ ALOHA collision
▪ CSMA, CSMA/CD, CSMA/CA Why?
= 1/(2e) = .18
CSMA (carrier sense multiple access) CSMA collisions spatial layout of nodes
data
Link Layer 5-39 Link Layer 5-40
IP IP IP
Eth Eth Eth
Phy Phy Phy
A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
switch
star
Metcalfe’s Ethernet sketch bus: coaxial cable
Link Layer 5-55 Link Layer 5-56
5.1 introduction, services 5.5 link virtualization: ▪ store, forward Ethernet frames • Self-learning
❖ switching: ❖ switching:
▪ A-to-A’ and B-to-B’ can transmit A ▪ A-to-A’ and B-to-B’ can transmit A
simultaneously, without collisions ’ simultaneously, without collisions ’
switch with six interfaces switch with six interfaces
▪ BUT!!! A-to-A’ and C to A’ can
(1,2,3,4,5,6) (1,2,3,4,5,6)
not happen simultaneously
FORWARD
Link Layer 5-68 Link Layer 5-69
2 8 10 16
EE, but wants connect to
CS switch? switch(es) supporting
VLAN capabilities can … …
be configured to Electrical Engineering Computer Science
define multiple virtual (VLAN ports 1-8) (VLAN ports 9-15)
… …
2 8 10 16
Electrical Engineering Computer Science Ports 2,3,5 belong to EE VLAN
❖ dynamic membership: ports (VLAN ports 1-8) (VLAN ports 9-15) Ports 4,6,7,8 belong to CS VLAN
20 3 1 5
Link Layer 5-82 Link Layer 5-83
Border router
Load Load
Access router Tier-1 switches
balancer balancer
Tier-1 switches
B
Tier-2 switches
A C Tier-2 switches
TOR TOR
switches switches
Server racks Server racks
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
A day in the life: scenario A day in the life… connecting to the Internet
DHCP DHCP ❖ connecting laptop needs to
UDP
browser DNS server DHCP
DHCP IP
get its own IP address, addr
Jio/Airtel network DHCP Eth of first-hop router, addr of
68.80.0.0/13 Phy DNS server: use DHCP
DHCP
A day in the life… using DNS DNS A day in the life…TCP connection carrying HTTP
DNS UDP DNS server
DNS IP HTTP
DNS DNS DNS Eth HTTP
DNS UDP DNS Phy
SYNACK
SYN TCP
DNS IP SYNACK
SYN IP
DNS Eth SYNACK
SYN Eth
Phy Phy
DNS
Jio/Airtel network
68.80.0.0/13
❖ to send HTTP request,
client first opens TCP
socket to web server
❖ IP datagram forwarded from
router router ❖ TCP SYN segment (step 1 in 3-
(runs DHCP) campus network into Jio/Airtel (runs DHCP)
way handshake) inter-domain
SYNACK
SYN TCP
❖ IP datagram containing DNS network, routed (tables created routed to web server
SYNACK
SYN IP
query forwarded via LAN by RIP, OSPF, IS-IS and/or BGP SYNACK
SYN Eth
switch from client to 1st hop routing protocols) to DNS server Phy ❖ web server responds with TCP
router ❖ demux’ed to DNS server SYNACK (step 2 in 3-way
handshake)
❖
web server
DNS server replies to client
with IP address of
64.233.169.105 ❖ TCP connection established!
www.google.com
Link Layer 5-98 Link Layer 5-99
A day in the life… HTTP request/reply
Chapter 5: Summary
HTTP
HTTP HTTP ❖ web page finally (!!!) displayed
❖
TCP
HTTP
HTTP
HTTP
HTTP IP
principles behind data link layer services:
HTTP
HTTP Eth ▪ error detection, correction
Phy
▪ sharing a broadcast channel: multiple access
▪ link layer addressing
❖ HTTP request sent into ❖ instantiation and implementation of various link
TCP socket layer technologies
router ❖ IP datagram containing HTTP ▪ Ethernet
▪ switched LANS, VLANs
HTTP HTTP (runs DHCP) request routed to
HTTP TCP
www.google.com
HTTP IP ▪ virtualized networks as a link layer: MPLS
Eth ❖ web server responds with
❖
HTTP
Phy HTTP reply (containing web synthesis: a day in the life of a web request
page)
web server
❖ IP datagram containing HTTP
64.233.169.105
reply routed back to client
Link Layer5-100 Link Layer5-101
Link Layer5-102