Lect-2: BasicsComputer Networks1 371-1-0291 : An Introduction to Computer Networks Handout #2:...
-
date post
19-Dec-2015 -
Category
Documents
-
view
216 -
download
0
Transcript of Lect-2: BasicsComputer Networks1 371-1-0291 : An Introduction to Computer Networks Handout #2:...
Lect-2: Basics Computer Networks 1
371-1-0291: An Introduction to Computer Networks
Handout #2: Foundations and Basic Concepts
Additional Reading Text book: Chaps. 1.2,3.1
Homepagehttp://www.cse.bgu.ac.il/Courses/course.asp?ID=63
Lect-2: Basics Computer Networks 2
Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, “Bandwidth” and “throughput” Propagation delay Packet, header, address Bandwidth-delay product, RTT
Lect-2: Basics Computer Networks 3
Example: FTP over the Internet Using TCP/IP and Ethernet
App
OS
R2R2 R3R3
R4R4
R1R1 R5R5
Ethernet
“A” (BGU) “B” (TECH)
Ethernet
App
OS
1
234
67
20
191817
5
910
81213
11 1516
14
Lect-2: Basics Computer Networks 4
In the sending host
1. Application-Programming Interface (API) Application requests TCP connection with “B”
2. Transmission Control Protocol (TCP) Creates TCP “Connection setup” packet TCP requests IP packet to be sent to “B”
TCPData
TCPHeader
TCP Packet
Type = Connection Setup
Empty
Lect-2: Basics Computer Networks 5
In the sending host (cont.)
3. Internet Protocol (IP) Creates IP packet with correct addresses. IP requests packet to be sent to router.
IPData
TCP Packet
Encapsulation
IPHeader
IP Packet
Destination Address: IP “B”Source Address: IP “A”Protocol = TCP
TCPData
TCPHeader
Lect-2: Basics Computer Networks 6
In the sending host (cont.)
4. Link (“MAC” or Ethernet) Protocol Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
EthernetData
IP Packet
EthernetFCS
EthernetHeader
Ethernet Packet
Destination Address: MAC “R1”Source Address: MAC “A”Protocol = IP
IPData
IPHeader
Encapsulation
Lect-2: Basics Computer Networks 7
In Router R1
5. Link (“MAC” or Ethernet) Protocol Accept MAC frame, check address and Frame Check
Sequence (FCS). Pass data to IP Protocol.
EthernetData
IP Packet
EthernetFCS
EthernetHeader
Ethernet Packet
Destination Address: MAC “R1”Source Address: MAC “A”Protocol = IP
IPData
IPHeader
De-capsulation
Lect-2: Basics Computer Networks 8
In Router R1
6. Internet Protocol (IP) Use IP destination address to decide where to send
packet next (“next-hop routing”). Request Link Protocol to transmit packet.
IPData
IPHeader
IP Packet
Destination Address: IP “B”Source Address: IP “A”Protocol = TCP
Lect-2: Basics Computer Networks 9
In Router R1
7. Link (“MAC” or Ethernet) Protocol Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
EthernetData
IP Packet
EthernetFCS
EthernetHeader
Ethernet Packet
Destination Address: MAC “R2”Source Address: MAC “R1”Protocol = IP
IPData
IPHeader
Encapsulation
Lect-2: Basics Computer Networks 10
In Routers R2, R3, R5 Same operations as Router R1
16. Link (“MAC” or Ethernet) Protocol Creates MAC frame with Frame Check Sequence (FCS). Wait for Access to the line. MAC requests PHY to send each bit of the frame.
EthernetData
IP Packet
EthernetFCS
EthernetHeader
Ethernet Packet
Destination Address: MAC “B”Source Address: MAC “R5”Protocol = IP
IPData
IPHeader
Encapsulation
Lect-2: Basics Computer Networks 11
In the receiving host
17. Link (“MAC” or Ethernet) Protocol Accept MAC frame, check address and Frame Check
Sequence (FCS). Pass data to IP Protocol.
EthernetData
IP Packet
EthernetFCS
EthernetHeader
Ethernet Packet
Destination Address: MAC “B”Source Address: MAC “R5”Protocol = IP
IPData
IPHeader
De-capsulation
Lect-2: Basics Computer Networks 12
In the receiving host (2)
18. Internet Protocol (IP) Verify IP address. Extract/de-capsulate TCP packet from IP packet. Pass TCP packet to TCP Protocol.
IPData
TCP Packet
De-capsulation
IPHeader
IP Packet
Destination Address: IP “B”Source Address: IP “A”Protocol = TCP
TCPData
TCPHeader
Lect-2: Basics Computer Networks 13
In the receiving host (3)
19. Transmission Control Protocol (TCP) Accepts TCP “Connection setup” packet Establishes connection by sending “Ack”.
20. Application-Programming Interface (API)
Application receives request for TCP connection with “A”.
TCPData
TCPHeader
TCP Packet
Type = Connection Setup
Empty
Lect-2: Basics Computer Networks 14
Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, “Bandwidth” and “throughput” Propagation delay Packet, header, address Bandwidth-delay product, RTT
Lect-2: Basics Computer Networks 15
Layering: The OSI Model
Session
Network
Link
PhysicalPhysicalPhysical
Application
Presentation
Transport
Network
Link Link
Network
Transport
Session
Presentation
Application
Network
Link
Physical
Peer-layer communication
layer-to-layer communication
Router Router
1
2
3
4
5
6
7
1
2
3
4
5
6
7
Lect-2: Basics Computer Networks 16
Layering: Our FTP Example
Network
Link
Transport
Application
Presentation
Session
Transport
Network
Link
Physical
The 7-layer OSI Model The 4-layer Internet model
ApplicationFTP
ASCII/Binary
IP
TCP
Ethernet
Lect-2: Basics Computer Networks 17
Outline
A Detailed FTP Example Layering Packet Switching and Circuit Switching Some terms
Data rate, “Bandwidth” and “throughput” Propagation delay Packet, header, address Bandwidth-delay product, RTT
Lect-2: Basics Computer Networks 18
Circuit SwitchingA B
Source Destination
It’s the method used by the telephone network. A call has three phases:
1. Establish circuit from end-to-end (“dialing”),2. Communicate,3. Close circuit (“tear down”).
Originally, a circuit was an end-to-end physical wire. Nowadays, a circuit is like a virtual private wire: each
call has its own private, guaranteed data rate from end-to-end.
Lect-2: Basics Computer Networks 19
Circuit Switching Telephone Network
Source“Caller”
Central Office“C.O.”
Destination“Callee”
Central Office“C.O.”
TrunkExchange
Each phone call is allocated 64kb/s. So, a 2.5Gb/s trunk line can carry about 39,000
calls.
Lect-2: Basics Computer Networks 20
Packet Switching
A
R1
R2
R4
R3
B
Source Destination
It’s the method used by the Internet. Each packet is individually routed packet-by-packet,
using the router’s local routing table. The routers maintain no per-flow state. Different packets may take different paths. Several packets may arrive for the same output link at
the same time, therefore a packet switch has buffers.
Lect-2: Basics Computer Networks 21
Packet SwitchingSimple router model
R1Link 1
Link 2
Link 3
Link 4
Link 1, ingress Link 1, egress
Link 2, ingress Link 2, egress
Link 3, ingress Link 3, egress
Link 4, ingress Link 4, egress
Lect-2: Basics Computer Networks 22
Link rate, RX(t)
Dropped packets
B
Dropped packetsQueue LengthX(t)
Time
Packet buffer
Packets for one output
Packet SwitchingStatistical Multiplexing
Data Hdr
Data Hdr
Data Hdr
RR
R
Because the buffer absorbs temporary bursts, the egress link need not operate at rate N.R. But the buffer has finite size, B, so losses will occur.
1
2
N
Lect-2: Basics Computer Networks 23
Virtual Circuit SwitchingA B
Source Destination
A widely used method for packet switching. Differs from datagram switching:
1. Connection oriented delivery of packets2. A virtual connection is setup from source to destination3. All packets follow the same circuit4. A circuit link can be shared by several virtual circuits
Each Virtual Circuit (VC) has an Identifier (VCI) A session gets a VCI and its packets are routed based on
VCI There are two types: Permanent VC (PVC), Switched VC
(SVC)
Lect-2: Basics Computer Networks 24
Statistical Multiplexing
B
A
time
time
rate
rate
x
x
A x
B x
Lect-2: Basics Computer Networks 25
Statistical Multiplexing Gain
A
B
C
2x
C < 2x
A+B
time
rate
Statistical multiplexing gain = 2x/C
Note: the gain could be defined for a particular loss probability (in this case, x and C were chosen so that there
were no losses).
Lect-2: Basics Computer Networks 26
Why does the Internet usepacket switching?
1. Efficient use of expensive links: The links are assumed to be expensive and scarce. Packet switching allows many, bursty flows to share the
same link efficiently. “Circuit switching is rarely used for data networks, ...
because of very inefficient use of the links” - Gallager
2. Resilience to failure of links & routers: ”For high reliability, ... [the Internet] was to be a
datagram subnet, so if some lines and [routers] were destroyed, messages could be ... rerouted” - Tanenbaum
Source: Networking 101
Lect-2: Basics Computer Networks 27
Some Definitions Packet length, P, is the length of a packet in bits. Link length, L, is the length of a link in meters. Data rate, R, is the rate at which bits can be sent, in
bits/second, or b/s.1
Propagation delay, PROP, is the time for one bit to travel along a link of length, L.
PROP = L/c. Transmission time, TRANSP, is the time to transmit a
packet of length P. TRANSP = P/R.
Latency is the time from when the first bit begins transmission, until the last bit has been received. On a link:
Latency = PROP + TRANSP.1. Note that a kilobit/second, kb/s, is 1000 bits/second, not 1024 bits/second.
Lect-2: Basics Computer Networks 28
Packet Switching
Host A
Host B
R1
R2
R3
A
R1
R2
R4
R3
B
TRANSP1
TRANSP2
TRANSP3
TRANSP4
PROP1
PROP2
PROP3
PROP4
Source Destination
“Store-and-Forward” at each Router
( )i ii
TRANSP PROP Minimum end to end latency
Lect-2: Basics Computer Networks 29
Packet SwitchingWhy not send the entire message in one packet?
Breaking message into packets allows parallel transmission across all links, reducing end to end latency. It also prevents a
link from being “hogged” for a long time by one message.
Host A
Host B
R1
R2
R3
M/R
min/ ii
M R PROP Latency
Host A
Host B
R1
R2
R3
( / )i ii
PROP M R Latency
M/R
Lect-2: Basics Computer Networks 30
Packet SwitchingQueueing Delay
Host A
Host B
R1
R2
R3
TRANSP1
TRANSP2
TRANSP3
TRANSP4
PROP1
PROP2
PROP3
PROP4
( )i i ii
TRANSP PROP Q Actual end to end latency
Q2
Because the egress link is not necessarily free when a packet arrives, it may be queued in a buffer. If the network is busy, packets might have to wait a long time.
Lect-2: Basics Computer Networks 31
Packet Switching
It’s often useful to model a router as a queue per output link
A A
R
A
BC B
C
B
C
Lect-2: Basics Computer Networks 32
Packet SwitchingLittle’s Result
Where:
is the average number of customers in the queue,
is the arrival rate, in customers per second, and
is the average time that a customer
waits in the queue.
Result holds so long as
L
w
L w
no customers are lost/ dropped.
Lect-2: Basics Computer Networks 33
Packet SwitchingA useful, simple fluid model
A(t)
D(t)Cumulative number of
departed bits up until time t.
time
Service process
Cumulativenumber of bits
Cumulative number of bits that arrived up until time t.
R
A(t)
D(t)
X(t)
Properties of A(t), D(t): A(t), D(t) are non-decreasing A(t) >= D(t)
Lect-2: Basics Computer Networks 34
D(t)
A(t)
time
Q(t)
d(t)
Queue occupancy: Q(t) = A(t) - D(t).
Queueing delay, d(t), is the time spent in the queue by a bit that arrived at time t, and if the queue is served first-come-first-served (FCFS or FIFO)
Fluid Model
Cumulativenumber of bits
Lect-2: Basics Computer Networks 35
D(t)
A(t)
time
Q(t)
d(t)
Fluid Model ExampleCumulative
number of bits
Example: Every second, a train of 100 bits arrive at rate 1000b/s. The maximum departure rate is 500b/s.What is the average queue occupancy?
( ( ) ( ) 0) 0.5 (0.1 5Q t Q t
: During each cycle, the queue fi lls at rate 500b/ s f or 0.1s,
then drains at rate 500b/ s f or 0.1s.The average queue occupancy when
the queue is non-empty is theref ore:
Solution
00) 25 .
( ) (0.2 25) (0.8 0) 5 .Q t
bits
The queue is empty f or 0.8s each cycle, and so: bits