1 BIM 302: Computer Networks Time:Thursdays 09:15-12:00 Location: BLab4 Instructor: Emre Kaçmaz –...
-
Upload
tracy-woods -
Category
Documents
-
view
217 -
download
0
Transcript of 1 BIM 302: Computer Networks Time:Thursdays 09:15-12:00 Location: BLab4 Instructor: Emre Kaçmaz –...
1
BIM 302: Computer Networks
• Time:Thursdays 09:15-12:00• Location: BLab4• Instructor: Emre Kaçmaz – Yasin Pak• Grading:
– Midterm I – 15%– Midterm II – 15%– 1 Final – 40%– Homeworks - 30%
2
High-level picture of the problem
Transmission System
Sender Node Destination Node
Problem: Transmit a message M from a source node to one or more destination node(s) through a transmission system=computer network
Nodes: Things that send/receive messages. Examples are PCs, labtops, PDAs, Internet telephones etc.
3
Transmission System
Sender NodeDestination Node
• mesh of interconnected routers (switches) inter-connected in an arbitrary topology
• the fundamental question: how is data transferred through net?– circuit switching: dedicated circuit per call: telephone net– packet-switching: data sent thru net in discrete “chunks”
4
Circuit-Switching: Idea
End-end resources reserved for “call”• call setup required• After the call, the resources (the circuit bandwidth) is
dedicated and is not shared with other calls• circuit-like (guaranteed) performance• This course is not about circuit-switching, but we will touch
on it so that you get an idea on how it works
5
Circuit-Switching: Data Flow
• After the call is setup, the data flows through the circuit bit by bit– No store or forward delay at the routers (switches)– As soon as a bit from the connection arrives at a router, it
is immediately forwarded over the outgoing link without any delay
– So the transmission time is independent of the # of links from the source to the destination
6
CS: Sharing Link Capacity
• How do several calls using the same link share the link?– In the example above, we have 2 calls sharing 2 links in
the middle of the network
• 2 Approaches– Frequency Division Multiplexing (FDM)– Time Division Multiplexing (TDM)
7
Circuit-Switching: FDM
• FDM: Divide the link capacity into several frequency bands (space-wise division) and allocate each band to a different call– Each circuit gets the fraction of the bandwidth
continuously (all the time)– Also used by radio/TV transmission through the
air
8
Circuit-Switching: TDM
• TDM: Divide the link capacity in time into several slots and allocate each slot to a different call– Each circuit gets ALL of the link bandwidth
periodically– Used by wireless telephones (GSM)
9
Circuit Switching Example
• 1890-current: Phone network– Fixed bit rate– Mostly voice– Not fault-tolerant– Components extremely reliable– Global application-level knowledge
throughout network
10
Circuit Switching: Summary• Establish a dedicated circuit before sending data
– Dedicated resources– Data flows through the circuit– No store and forward at the switches (routers)– Good for constant-bit-rate traffic such as voice
• BUT– Dedicated resources means if no data is flowing the
circuit, the allocated resources are idle• Leads to waste of network resources• Might be OK for telephone calls where two parties are
typically talking all the time• But is this good if two people are exchanging a data as in a
instant messaging session?
– How can be let other people use unused bandwidth?• Packet Switching -- Next
11
Packet-Switching: Idea
• Divide the message into smaller chunks, packets• Send each packet through the network independently• Each packet uses a link’s full bandwidth during
transmission• Resources are used as needed
Message M
Message M
queue of packetswaiting for output
link
12
Packet switching vs Circuit Switching
• 1 Mbit link• each user:
– 100Kbps when “active”
– active 10% of time
• circuit-switching: – can admit 10 users
• packet switching: – With 35 users,
probability > 10 active less that .004
Conclusion: Packet switching allows more users to use network!
N users
1 Mbps link
13
Packet-Switching: Link Sharing
• resource contention: – aggregate resource demand can exceed amount available– congestion: packets queue, wait for link use– store and forward: packets move one hop at a time
• A router must receive the whole packet before the packet can be forwarded• After reception, queue the packet internally and have it wait its turn for the
output link. • This is done by each router: Per hop forwarding
• Sequence of A & B packets does not have fixed pattern– Called statistical multiplexing.
Message M
Message M
queue of packetswaiting for output
link
A
B
14
Packet-Switching: Issues• Two Fundamental Questions must be
answered in a packet-switched network:1. What should the packet size be?
• Fixed-size or variable-sized packets? • How big?
2. Should we establish an end-to-end path through the network for the packets to flow?• Yes: Virtual-Circuit Networks (X.25, Frame-Relay, ATM)• No: Datagram Networks (the Internet)
15
Packet-Switching: Packet SizeSource Destination
0
5
10
15
• Consider a message M, that is 7.5*106 bits long, no message frag.• Assume each link has 1.5Mbps bandwidth• It takes (7.5*106 /1.5Mbps) = 5 seconds to move the message
from the source to the first switch (router) R1• Another 5 secs to move M from R1 to R2• Another 5 secs to move M from R2 to destination• Total time: 5 + 5 + 5 = 15 seconds
R1 R2
16
Packet-Switching: Packet SizeSource = S Destination = D
10
5
• Assume now that we divide the message into 5000 packets, each 1500 bits long
• It takes 1 milisecs to move the 1st packet from S to R1• But while the first packet is being moved from R1 to R2, we are
also moving 2nd packet from S to R1• The first packet makes it to D in time 3ms, the 2nd packet is at
R2 and 3rd packet is at R1 at this time• Following this logic, the last packet makes it to D at time 5002
ms = 5.002 sec as opposed to 15 seconds
R1 R2
1
5002
22
21
12
33
33
5000
17
Packet-Switching: Packet Size• Small-sized packets has yet another advantage
– Bit errors can be introduced as packet travels through the network. In such cases the packet is simply discarded• The smaller the packet, the smaller the discarded info
• If small packets are so good, why not make them 1 byte– Each packet carries some headers with it– Headers are used for packet forwarding, and other stuff– The smaller the packet, the bigger the header to payload
ratio, which translates to more waste of bandwidth
– Consider 100 byte packets with 20 byte header• 20% bandwidth waste
– Consider 1000 byte packets with 20 byte header• 2% bandwidth waste
18
Virtual Circuits Networks: Signaling
• Virtual Circuit Networks (e.g., X.25, Frame Relay, ATM)– Establish a path along which the packets will flow between the
source and the destination. How?• Use a signaling (virtual circuit establishment) protocol• Ex: B tells its router (R1) that it wants to talk to C• The call establishment message is forwarded by the routers in the
network until it reaches C. Then a reply comes back from C to B.– Path established at call setup time remains fixed during packet
exchange– Routers maintain state information for ongoing connections
A
B
C
D
R1
R2 R3
R4
R5
R6
R7R8
R9
R10
19
Virtual Circuits Networks: Forwarding
A
B
C
D
IncomingInterface
Incoming VC #
Outgoing interface
Outgoing VC #
1 12 2 22
2 38 1 19
VC table at R1:
R1
R2 R3
R4
R5
R6
R7R8
R9
R10
1 2
– each packet carries tag (virtual circuit ID), which determines next hop– Path established at call setup time remains fixed during packet exchange– Routers maintain state information for ongoing connections
12
22
IncomingInterface
Incoming VC #
Outgoing interface
Outgoing VC #
1 45 3 53
3 8 1 15
VC table at R2:
1 3
245
532
66
69
3
43
977
20
Datagram Networks: Idea
A
B
C
D
R1
R2 R3
R4
R5
R6
R7R8
R9
R10
• Datagram networks (e.g. the Internet): • No call establishment before data exchange• Simply put the destination address on top of the
packet and submit it to the network for delivery• Similar to postal service
C
C
DD
CC
C
C
D
DD
C C
CD
DD
D
21
Datagram Networks: Forwarding
A
B
C
D
Destination Address
Outgoing interface
Next Hop
B 1 B
C 2 R3
D 2 R3
Forwarding table at R1:
R1
R2 R3
R4
R5
R6
R7R8
R9
R10
1 2
– Destination address is written on top of a packet and it is simply submitted to the network for delivery (like postal service)
– Routers look at destination address in packet to determine the next hop– No connection-state information needed in the routers– Routes may change during session
C
C
Forwarding table at R2:
1 3
2D
DC
C
C
C
D
DD
Destination Address
Outgoing interface
Next Hop
A 1 B
C 3 R3
D 3 R3
C C
22
Packet switching versus circuit switching
• Great for bursty data– resource sharing
• But, excessive congestion: packet delay and loss– protocols needed for reliable data transfer,
congestion control• Q: How to provide circuit-like behavior?
– Bandwidth guarantees needed for audio/video apps
– Active research area: IP QoS
Is packet switching a “slam dunk winner?”
23
Network Taxonomy
Telecommunicationnetworks
Circuit-switchednetworks
FDM TDM
Packet-switchednetworks
Networkswith VCs
DatagramNetworks
24
Packet Switched Networks• This course is about packet-switched networks• We will not cover circuit-switched networks• In looking at packet-switched networks, our
approach will be from the view of network designer, a system engineer, who wants to build a packet switched network from the ground up– How do you build a packet switched network?– What are the issues?– How do you solve them?– What are the specific solutions in existence today?– We will mostly look at Internet Protocols
25
Point-to-Point Links
• The simplest packet switched network is a network consisting of 2 hosts, A and B, and a link connecting them– Link can be guided media, i.e., a copper, coax, fiber wire– Link can be unguided media, i.e., the air – wireless– Link can be half-duplex (only one node can send data over
the link at any time) or full-duplex (A can send a message to B, while B is sending a message to A)
• Problem: Given a message M at A, divide the message into several packets, and send them over the link to B
Message M
A B Simple point-to-point link
26
Point-to-Point Links
Message M
A B
• What are the issues in a point-to-point link?– How does B know the beginning and end of a packet?
• Called the framing problem
– How does B know whether the packet is corrupted, i.e., if any bits of the message has changed, during transmission or not? If any bits changed, can B correct them?
• Called the error detection & correction problem
– How do you encode a digital data on the link?• Called the data encoding problem
Simple point-to-point link
27
Broadcast (Multi-Access) Links
Message M
A B
• The next-simple packet switched network you can imagine is a network consisting of several hosts, A, B, C and D above, sharing a common link– Again, the link can be wired or wireless
• In such a network, when one node sends a packet over the link, the packet reaches ALL nodes attached to the link– Such a link is called a broadcast link, e.g., Ethernet, FDDI
C D
28
Broadcast (Multi-Access) Links
Message M
A B
• What are the issues in a broadcast link?– All the issues of a point-to-point exists: framing, error
detection & correction and encoding.– What else? First issue is, how do the stations agree on who
gets to use the link?• Called the media access control problem
– Second, how does A tell that the packet is destined to B not to C or D?
• Addressing problem: Each station must have a UNIQUE address, called the Media Access Control (MAC) address
C D
29
Limit on Broadcast Links
Message M
A B
• What’s the limit of a broadcast link?– How many hosts (stations) can we connect to a broadcast
link?– Can we build a global network such as the Internet with a
broadcast link?• Can you imagine connecting millions of hosts to a broadcast link?• If we do, does it make sense that when a host in Germany wants
to send a packet to another host next door, that my host in here receive that packet, examine it, realize that the packet is destined to someone else and discard it?
– Broadcast does not scale. So there is a limit on the size of a broadcast link.
C D
30
A General Packet-Switched Network
• To build a global packet-switched network such as the Internet, we must have a “network core” consisting of lots of packet switches, called routers
• The end systems (hosts, stations) are at the edge of the network• End system hosts can be attached to the network core with a
point-to-point link or they can be attached together with a broadcast link and then attached to the network core
A
B
E
F
R1
R2 R3
R4
R5
R6
R7R8
R10
I
G
HC
D
A Broadcast Link
A Point-to-PointLink
Network Core
31
A General Packet-Switched Network
• What are the issues in such a packet-switched network?– Addressing: Each host and router interface must have
GLOBALLY UNIQUE addresses – IP address– When host A wants to send a packet to host F on the other side
of the network, how does A and routers know how to reach F?• Routing and forwarding problem: Establishing reach-ability
information (forwarding table) and using it to forward a packet from the source to the destination host
A
B
E
F
R1
R2 R3
R4
R5
R6
R7R8
R10
I
G
HC
D
A Broadcast Link
A Point-to-PointLink
Network Core
32
A General View of the Internet
local ISP
a companynetwork
regional ISP
router workstation
servermobile
a universitynetwork
Connection to national ISP
Mesh of interconnected autonomous systems
33
What about applications?
• It is the applications that communicate!– Host A runs a Web Browser and an FTP Client– Web Browser is talking to the Web Server running
C– FTP Client is talking to the FTP Server running in D– Packets from both C and D arrive at A
A
B
C
D
R1
R2 R3
R4
R5
R6
R7R8
R9
R10Web
Browser
FTPClient
WebServer
FTPServer
34
What about applications?
• What are the issues here?– How does host A know that “green packets” need to
delivered to the Web Browser and Blue Packets need to be delivered to the FTP client?
• Multiplexing/Demultiplexing problem– What if some of the packets sent from the Web Server is lost
during transmission. How do we recover them?• Reliable packet delivery problem
A
B
C
D
R1
R2 R3
R4
R5
R6
R7R8
R9
R10Web
BrowserFTP
Client
WebServer
FTPServer
35
How do two network entities talk to each other: PROTOCOLS
• For two entities to communicate, they must “speak the same language”– What is communicated?
• Message format
– How is it communicated and what it means?• Order of messages and their meaning
– When is it communicated?• Timing of the messages
– The above must conform to mutually acceptable conventions between the entities involved
– In networking, these conventions are referred to as a “protocol”
36
Protocols• A protocol is a set of rules governing the
exchange of data between the two entities• Key elements of a protocol are
– Syntax: Message format
– Semantics: The meaning of messages • order of messages sent and received• actions taken on message transmission, receipt
– Timing: Includes speed matching and sequencing
• When to send a message
37
More on Protocolsa human protocol and a computer network protocol:
Hi
Hi
Got thetime?
2:00
TCP connection req
TCP connectionresponseGet http://www.awl.com/kurose-ross
<file>time
• What are some other human protocols?• Raise you hand before asking questions• Take turns to speak, i.e., do not speak at the same time
38
Designing Protocols
Message M
A B
• Recall the issues in communication over a P-2-P link– Message fragmentation: Dividing a message into packets at A– Framing: Identifying the beginning and end of a packet at B– Error Detection & Correction: Identifying corrupt packets at B– Encoding: Encoding packet bits onto the link as a signal at A
and reconstructing the packet bits from the received signals at B
• What kind of protocols do we need to handle the above issues?– Next
39
Physical and Link LayersMessage M
A B
• Typically the listed issues are handled by 2 protocols– A Physical Layer (PL), which deals with bit Encoding/Decoding
• Physical Layer at A deals with the following problem: – Given a sequence of bits (bits making up a packet), how do you
encode the bits onto the link as signals (electromagnetic, light..)
• Physical Layer at B deals with the following problem: – As you receive signals from the link, how do you decode these signals
into bits?
– A Link Layer (LL) that sits on top of the physical layer (PL) and deals with the rest of the problems: Message Fragmentation, Framing, Error Detection/Recovery
linkphysic
al
linkphysic
al
40
Physical and Link Layers
Message M
A
C
linkphysic
al
linkphysic
al
linkphysic
al
B
• What about a broadcast link?– PL and LL will be there as before having the same
responsibilities as described before– But now LL has the additional responsibility of Media
Access Control (MAC) to deal with
• Link Layer: data transfer between neighboring network elements– PPP, Ethernet
• Physical Layer: bits “on the wire”
41
Network Layer
A
linkphysic
al
linkphysic
al
linkphysic
al
linkphysic
al
BR1 R2
• What about a general packet-switched network?– Are PL and LL enough? – Recall that LL is responsible for data transfer between
neighboring network elements, that is, if they are connected to the same link
• Are hosts A and B neighbors above? No.– Need a new layer, called the “Network Layer”
• Responsible for forwarding of datagrams from source HOST A to destination HOST B
• Internet Protocol (IP, routing protocols)
NetworkLink
Physical
NetworkLink
Physical
NetworkLink
Physical
NetworkLink
Physical
42
Transport Layer
AB
R1 R2
• What about applications running in hosts?– Is NL enough?
• Recall that NL is responsible for forwarding a packet from one HOST to another HOST
• How do you make applications on HOSTs to communicate?– Need a new layer, called the “Transport Layer”
• Responsible for providing communication between applications running in different hosts
• A Web Browser talking to a Web Server
NetworkLink
Physical
NetworkLink
Physical
NetworkLink
Physical
NetworkLink
Physical
C
NetworkLink
Physical
TransportNetwork
LinkPhysical
TransportNetwork
LinkPhysical
TransportNetwork
LinkPhysical
FTPServer
WebServer
WebBrowser
FTPClient
43
Application Layer
AB
R1 R2
• Lots of different applications in the Internet– Web browsing, file download, e-mail, instant messages,
presence…– Each require different message types, formats, actions
• So need a new layer, called the “Application Layer”– Responsible for defining application specific message types,
formats, actions taken on messages– HTTP for Web, FTP for file download, SMTP for e-mail, SIP for
instant messaging and presence… so many others!!
NetworkLink
Physical
NetworkLink
Physical
C
TransportNetwork
LinkPhysical
TransportNetwork
LinkPhysical
TransportNetwork
LinkPhysical
Application
TransportNetwork
LinkPhysical
Application
TransportNetwork
LinkPhysical
Application
TransportNetwork
LinkPhysical FTP
Server
WebServer
FTPClient
WebBrowser
44
Internet protocol stack• application: Define application specific
message types, formats– FTP, SMTP, STTP
• transport: Provide application-to-application communication– TCP, UDP
• network: Provide host-to-host communication. That is, forwarding of packets from source to destination– IP, routing protocols
• link: Provide data transfer between neighboring network elements (host-to-host, host-to-router, router-to-router)– PPP, Ethernet
• physical: transmit bits “on the link”
application
transport
network
link
physical
45
Protocol layering and data• At the source, each layer takes data from above
– adds header information to create new data unit• Called “encapsulation”
– passes new data unit to layer below• At the destination, each layer takes data from below
– strips off its own header• Called “decapsulation”
– passes the remaining part of the packet to the upper layer
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
46
Multiplexing/Demultiplexing
• A way for multiple protocol objects at one level to identify themselves to the protocol above or below them.– Multiplex
• Tag each message with a key– Lower protocol knows where
it came from!
– Demux• Use key on arriving packet to
know where to send it above
1 2
1 data 3 data
3
1 2
1 data 3 data
3
1 data
3 data
MUX
DEMUX
47
Protocol Interfaces• Each protocol defines 2 interfaces
– Service Interface: The kind of services it provides to protocols that sit on top of it on the same machine
– Peer Interface: Communication interface with its counterpart (peer) on another machine
• This interface defines the form and meaning of messages exchanged between protocol peers to implement the service interface
Host 1
Protocol
Host 2
Protocol
Upper-layerprotocol
Upper-layerprotocol
Serviceinterface
Peer-to-peerinterface
• Example: IP exports a connectionless, unreliable, best-effort datagram service to transport layer protocols
48
Protocol Communication
A protocol always communicates with same protocol at peer machine. Never do we have
a protocol at one layer talk to another protocol at a different layer at the peer
Link Layer Link Layer
49
Internet Protocols• Defined by Internet Engineering Task Force (IETF)• Hourglass Design: Everything goes over IP• Lots of application layer protocols• Mainly 2 transport layer protocols: TCP, UDP• Network Protocol is Internet Protocol (IP)• Any Link Layer Protocol
…
FTP HTTP NV RTP
TCP UDP
IP
NET1 NET2 NETn
6 17
8020,21 4444
50
OSI v TCP/IP
• Open Systems Interconnection– Developed by the
International Organization for Standardization (ISO)
– Seven layers– A theoretical system
delivered too late!– TCP/IP is the de facto
standard
51
Network Performance Metrics• Bandwidth
– data transmitted per time unit– link versus end-to-end– Notation: Mbps = 106 bits per second– Bits transmitted at a particular bandwidth can be
regarded as having some width(a) Bits transmitted at 1Mbps, each bit is 1us wide(b) Bits transmitted at 2Mbps, each bit is 0.5us
wide1 second
(a)
(b)
52
Network Performance Metrics• Latency (delay)
– time for the first byte of the message to reach the destination– one-way versus round-trip time (RTT)– components
Latency = Transmission + Propagation + Nodal Pros. + Queuing Delay
Transmission Time = Message Size / BandwidthPropagation = Distance / Speed of LightNodal Processing = F(Amount of Processing, Processor Speed)Queuing Delay = F(Amount of total traffic)
A
B
propagation
transmission
nodalprocessing queueing
Cpropagation
transmission
53
Latency or Delay
• dtrans = transmission delay– = L/R, L: Message size, R: Link Bandwidth– significant for low-speed links
• dprop = propagation delay– a few microsecs to hundreds of msecs
• dproc = processing delay– typically a few microsecs or less
• dqueue = queuing delay– depends on congestion (the amount of total traffic)
queuingprocessingproptransdelay ddddd
54
Queueing delay• R=link bandwidth (bps)• L=packet length (bits)• a=average packet
arrival rate
traffic intensity = La/R
• La/R ~ 0: average queueing delay small• La/R -> 1: delays become large• La/R > 1: more “work” arriving than can
be serviced, average delay infinite!
55
How and why do packet loss occur?• Packets get queued in router buffers• If packet arrival rate exceeds output capacity, packets
get buffered and wait for their turn to be transmitted• Buffer is of finite size
– If more packets than what buffer can store, new packets will be dropped
A
B
packet being transmitted
packets queueing
free (available) buffers: arriving packets dropped (loss) if no free buffers
56
Introduction: SummaryCovered a “ton” of material!• Internet overview• what’s a protocol?• network edge, core
– packet-switching versus circuit-switching
• performance: loss, delay• layering and service
models
You now have: • context, overview,
“feel” of networking• The rest of the
course will be to learn the details of these protocols in the context of IP protocol stack