20-755: The Internet Lecture 4: Internetworking I

advertisement
20-755: The Internet
Lecture 4: Internetworking I
David O’Hallaron
School of Computer Science and
Department of Electrical and Computer Engineering
Carnegie Mellon University
Institute for eCommerce, Summer 1999
Lecture 4, 20-755: The Internet, Summer 1999
1
Today’s lecture
•
•
•
Connecting computers (50 min)
Break (10 min)
Connecting networks (50 min)
Lecture 4, 20-755: The Internet, Summer 1999
2
Typical computer system
Keyboard
Processor
Interrupt
controller
Mouse
Keyboard
controller
Modem
Serial port
controller
Printer
Parallel port
controller
Local/IO Bus
Memory
IDE disk
controller
SCSI
controller
Video
adapter
Network
adapter
Display
Network
SCSI bus
disk
disk
Lecture 4, 20-755: The Internet, Summer 1999
cdrom
3
Simple example
Starting Point: Want to send bits between 2 computers
•
•
•
•
FIFO (First-in First-out) queue (buffer) on each end
Can send both ways (“full duplex”)
Name for standard group of bits sent: “packet”
Packet format and rules for communicating them (“protocol”)
Simple request/response protocol and packet format:
header
payload
0/1
data/address
0: please send the data word at “address”
1: here is the data word you asked for.
Lecture 4, 20-755: The Internet, Summer 1999
4
Questions about simple example
•
What if more than 2 computers want to communicate?
– Need an interconnect? Need computer address field in packet?
•
What if the machines are far away?
– WAN vs LAN
•
How do multiple machines share the interconnect?
– multiple paths? arbitration? congestion control?
•
What if a packet is garbled in transit?
– Add error detection field in packet?
•
What if a packet is lost?
– More elaborate protocols to detect loss?
•
What if multiple processes per machine?
– one queue per process? separate field in packet to identify process?
•
Warning: You are entering a buzzword-rich
environment!!!
Lecture 4, 20-755: The Internet, Summer 1999
5
Generic network
host
host
host
OS code
protocol
stack
network adapter/
interface card
software
software
software
hardware
hardware
hardware
link
link
link
Interconnect (wires, repeaters, bridges, etc)
Lecture 4, 20-755: The Internet, Summer 1999
6
Protocols
•
•
A protocol defines the format of packets and the rules
for communicating them across the network.
Different protocols provide different levels of service:
–
–
–
–
–
•
simple error correction (ethernet)
uniform name space, unreliable best-effort datagrams (host-host) (IP)
reliable byte streams (TCP)
unreliable best-effort datagrams (process-process) (UDP)
multimedia data retrieval (HTTP)
Crucial idea: protocols leverage off of the capabilities
of other protocols.
Lecture 4, 20-755: The Internet, Summer 1999
7
Protocol layering
interface between user
code and OS code
(Application program
interface (API))
Protocols provide specialized services by
relying on services provided by lowerlevel protocols (I.e., they leverage lowerlevel services).
User application program (FTP, Telnet, WWW, email)
Unreliable
best effort
datagram
delivery
(processprocess)
Unreliable
best effort
datagram
delivery
(host-host)
User datagram protocol
(UDP)
Transmission control
protocol (TCP)
Internet Protocol (IP)
Reliable
byte stream
delivery
(processprocess)
Network interface (ethernet)
Lecture 4, 20-755: The Internet, Summer 1999
hardware
Physical
connection
8
Encapsulation
Application program
User code
data
User Interface (API)
OS code
TCP segment
header
data
IP datagram TCP segment
header
header
data
Ethernet frame IP datagram TCP segment
header
header
header
data
IP
TCP
OS/adapter interface
(exception mechanism)
Adapter
Adapter/Network interface
Network
Lecture 4, 20-755: The Internet, Summer 1999
9
Basic network types
•
System area net (SAN)
•
– same room (meters)
– 300 MB/s Cray T3E
•
Local area network (LAN)
– same bldg or campus
(kilometers)
– 10 Mb/sEthernet
– 100 Mb/s Fast Ethernet
– 100 Mb/s FDDI
– 150 Mb/s OC-3 ATM
– 622 Mb/s OC-12 ATM
Lecture 4, 20-755: The Internet, Summer 1999
Metropolitan area
network (MAN)
– same city (10’s of kilometers)
– 800 Mb/s Gigabit Nectar
•
Wide area network (WAN)
– nationwide or worldwide
(1000’s of kilometers)
– telephone system
» AT&T, MCI, Sprint
– 1.544 Mb/s T1 carrier
– 44.736 Mb/s T3 carrier
10
Examples of transmission media
twisted pair:
(1-2 Mb/s at 1 km)
fiber:
(100-200 Gb/s at 1 km)
2 insulated copper wires
light source
silica
coaxial cable:
(1-2 Gb/s at 1 km)
plastic cover
station wagon full of mag tapes
hurtling down the highway every
hour:
(15 Gb/s at 1 hour)
insulator
stiff copper wire
braided outer conductor
7 GBytes/tape
1000 tapes/station wagon (50x50x50cm)
7,000 GBytes total
7,000 GBytes/3600 seconds = 15 Gb/s
$5/tape reused 10 times -> $500 tape cost
$200 for shipping ->10 cents /GByte
Lecture 4, 20-755: The Internet, Summer 1999
11
Shared vs switched media
Shared media (e.g., Ethernet)
a
b
c
d
a
b
c
d
a
b
c
d
a
b
c
d
Lecture 4, 20-755: The Internet, Summer 1999
Switched media (e.g., ATM)
a
c
input ports
output ports
b
switch
a
b
d
c
switch
d
12
Network performance measures
•
Link bandwidth
– throughput measure
expressed as rate
» MB/s = 220 bytes/sec
» Mb/s = 106 bits/sec
– transfer rate across link
•
Bisection bandwidth
– smallest achievable
throughput if network is
cut in half
•
Latency
– elapsed time (s, ms, etc)
– time to cross network
•
Overhead
– another latency measure
– time to snd/rcv first byte.
Lecture 4, 20-755: The Internet, Summer 1999
13
Example performance measures
Interconnect
Example
Bisection BW
Link BW
Latency
HW Overhead to/from
SW Overhead to/from
SAN
CM-5
N x 5MB/s
20 MB/s
5 µsec
0.5/0.5 µs
1.6/12.4 µs
LAN
WAN
Ethernet
ATM
1.125 MB/s
N x 10 MB/s
1.125 MB/s
10 MB/s
15 µsec
50 to 10,000 µs
6/6 µs
6/6 µs
200/241 µs
207/360 µs
(TCP/IP on LAN/WAN)
N = number of hosts
Lecture 4, 20-755: The Internet, Summer 1999
14
AT&T Telephone Hierarchy
2
3
4
5
1
10 regional offices
(fully interconnected)
10
6
7
8
9
1
2
3
65
66
67
67 sectional offices
1
2
3
228
229
230
230 primary offices
1
2
3
1298
1299
1300
1,300 toll offices
19,000 end offices
local loops
local loops
200 million telephones
Lecture 4, 20-755: The Internet, Summer 1999
Source: Tannenbaum
15
Connecting distant
computers with modems
28.8 Kb/s
analog
local loop
V.34 modem
digital
(short cable
or bus)
33 MB/s
1.544 Mb/s (T1 carrier)
digital
codec
local
office
home
computer
Lecture 4, 20-755: The Internet, Summer 1999
28.8 Kb/s
analog
local loop
digital
codec
toll
office
local
office
V.34 modem
digital
(short cable
or bus)
33 MB/s
ISP
computer
16
Modulating digital signals
0
1
0
1
1
0
0
1
0
0
1
0
binary signaling
sine wave carrier (1kHz-2kHz)
amplitude
modulation
phase
modulation
00 : no shift
01: 1/4 shift left
10: 1/2 shift left
11: 3/4 shift left
(shifts are relative
to previous wave)
Lecture 4, 20-755: The Internet, Summer 1999
17
Quadrature amplitude modulation (QAM)
Modern modems use a combination of of amplitude and phase modulation to
encode multiple bits per “symbol”, i.e. amplitude/phase pair.
phase angle
is 1/4
1/8
3 bits/symbol QAM modulation
(8 symbols)
Lecture 4, 20-755: The Internet, Summer 1999
4 bits/symbol QAM modulation
(16 symbols)
18
Conventional Modems
MOdulate: convert from digital to analog
DEModulate: convert from analog to digital
modem standards:
type
symbols/sec
bits/symbol
Kb/s
v.32
v.32.bis
v.34
2400
2400
3200
4
6
9
9.6
14.4
28.8
Theoretical limit for modulated signals is approx 35 Kb/s:
Shannon's law: max bits/s = H log2(1 + S/N), where H is
bandwidth
and S/N is signal to noise ratio. For phone network, H~3,600 bps
and 10 log10 (S/N) = 30 dB. Thus max rate is ~35 Kb/s.
Lecture 4, 20-755: The Internet, Summer 1999
19
T1 carrier (1.544 Mb/s)
Digital part of phone system based on the T1 carrier:
193 bit frame (125 us, 8000 samples/s, 8 bits/sample/channel)
channel 1
channel 2
channel 3
channel 24
8 data bits
per channel
bit 1 is a
framing code
Each channel has a data rate
of 8000 samples/s * 8 bits/channel = 64 Kb/s
Lecture 4, 20-755: The Internet, Summer 1999
20
56KB “Modems”
V.90 modem
receiver
1.544 Mb/s (T1 carrier)
Analog Samples:
92 or 128 levels
8000 samples/second
ADC
digital
DAC
Binary Signal:
56,000 bits/second
home computer
Key: no analog
conversion at ISP
local
office
digital
Interface
digital
(short cable
or bus)
toll
office
Service Provider
(ISP)
– Asymmetric: home to SP uses conventional v.34 modem
– SP has digital connection into phone system
» Channel sending 8000 samples / second, up to 8-bits/sample
– DAC encodes each sample with 92 or 128 voltage levels
» Not enough precision on analog side to handle finer resolution
– Receiver converts samples back to digital values
» Must match frequency & phase of senders DAC
» Establish using “training” signals from sender
Lecture 4, 20-755: The Internet, Summer 1999
21
Connecting nearby computers
using Ethernet
•
History
– 1976- proposed by Metcalfe and Boggs at Xerox PARC
– 1978 - standardized by Xerox, Intel, DEC
•
Bandwidth
– 10 Mbits/sec (old) , 100 Mbits/sec (current), 1GB/s (new)
•
Key features
– broadcast over shared bus (the ether)
» no centralized bus arbiter
» each adapter sees the same bit stream
– each adapter has a unique (for all time!) 48-bit address
– variable length frames (packets) (64 - 1518 bytes)
Lecture 4, 20-755: The Internet, Summer 1999
22
Ethernet cabling
transceiver &
controller
controller
50 m
transceiver &
controller
transceiver
(carrier and
collision
detection)
hub
10Base5
(“thick ethernet”)
10Base2
(“thin ethernet”)
10Base-T
name
cable
max segment
nodes/segment advantages
10Base5
10base2
10Base-T
10Base-F
thick coax
thin coax
twisted pair
fiber
500 m
200 m
100 m
2000 m
100
30
1024
1024
Lecture 4, 20-755: The Internet, Summer 1999
good for backbones
cheapest
easy maintenance
best between bldgs
Source: Tannenbaum
23
Ethernet packet (frame) format
64 - 1518 bytes
Preamble
Dest
addr
Src
addr
Frame
type
64 bits
48 bits
48 bits
16 bits
Payload
368-12000 bits
CRC
Postamble
32 bits
8 bits
visible from the host
Preamble: 101010101 (synch)
Dest and Src addr: unique ethernet addresses
Frame type: indicates what packet type it encapsulates
E.g. encapsulated IP packets are denoted by 0x0800
Payload: data (may include encapsulated packets of other protocols)
CRC: cyclic redundancy check (error detection/correction)
Lecture 4, 20-755: The Internet, Summer 1999
24
Ethernet receiving algorithm
•
•
Ethernet adapter receives all frames.
Accepts:
– frames addressed to its own address
– frames addressed to broadcast address (all 1’s).
– frames addressed to multicast address (1xxx...), if it has
been instructed to listen to that address
– all frames, if it has placed in promiscuous mode
•
Passes to the host OS (via the exception
mechanism) only those packets it accepts.
Lecture 4, 20-755: The Internet, Summer 1999
25
Ethernet sending algorithm (CSMA/CD)
•
•
•
Problem: how to share one wire without centralized
control.
Ethernet solution: Carrier Sense Multiple Access with
Collision Detection (CSMA/CD):
1. Adapter has frame to send and line is idle:
– then send frame immediately
•
2. When adapter has frame to send and line is busy:
– wait for line to become idle, then send frame immediately.
•
3. If “collision” (simultaneous sends) occurs during
transmission:
–
–
–
–
send at least 1024 bits
send “jam signal” to notify receivers
wait some period of time (binary exponential backoff)
retry
Lecture 4, 20-755: The Internet, Summer 1999
26
Binary exponential backoff
Contention Slots (51.2 us per slot)
Frame
Frame
Contention interval
Frame
Frame
Idle
Binary exponential backoff algorithm:
• after 1st collision, wait 0 or 1 contention slots, at
random.
• after 2nd collision, wait 0, 1, 2, or 3 contentio slots at
random.
• etc up to 1023 slots.
• after 16 collisions, exception.
Lecture 4, 20-755: The Internet, Summer 1999
27
Why the 64 byte minimum packet size?
Assume propagation delay from A to B is tau microseconds (us).
A sends to B at time 0
A
B
packet almost at B at
time tau-eps
A
B
For ethernet, 2*tau is specified by standard
(2500 m cable w/ 4 repeaters) to be 51.2 us,
which at 10 Mb/s is 512 bit times, or 64 bytes.
Rough estimate: propagation through copper
is about 20 cm/ns. With a 2500 m cable,
tau is 12.5 us and 2*tau is 25 us.
B sends at time tau: collision
A
Conclusion: Senders must take more
than 2*tau seconds to send their packets.
B
As speeds increase there are two possibilities:
1. increase packet sizes
2. decrease maximum cable length
A
Noise burst gets back to A at
time 2*tau
Lecture 4, 20-755: The Internet, Summer 1999
B
Neither is particularly appealing.
28
Ethernet pros and cons
•
Pros:
– simple
– robust
– cheap ($50/adapter in 1998)
•
Cons:
– no quality of service guarantees
» OK for data
» not always OK for real-time bit streams like video or
voice
– fixed bit rate
» not keeping up with faster processors
» workstations can produce data at 10-50 MBytes/sec
– prone to congestion
» processors getting faster
» bridged Ethernets can help
Lecture 4, 20-755: The Internet, Summer 1999
29
Break time!
Lecture 4, 20-755: The Internet, Summer 1999
30
Today’s lecture
•
•
•
Connecting computers (50 min)
Break (10 min)
Connecting networks (50 min)
Lecture 4, 20-755: The Internet, Summer 1999
31
The internetworking idea
(Kahn, 1972)
•
Build a single network (an interconnected set of
networks, or internetwork, or internet) out of a large
collection of separate networks.
– Each network must stand on its own, with no internal changes
allowed to connect to the internet.
– Communications would be on a best-effort basis.
– “black boxes” (later called routers) should be used to connect the
networks.
– No global control at the operations level.
Lecture 4, 20-755: The Internet, Summer 1999
32
Internetworking challenges
•
Challenges:
– heterogeneity
» lots of different kinds of networks (Ethernet, FDDI,
ATM, wireless, point-to-point)
» how to unify this hodgepodge?
– scale
» how to provide uniques names for potentially billions
of nodes? (naming)
» how to find all these nodes? (forwarding and routing)
•
Note: internet refers to a general idea, Internet
refers to a particular implementation of that
idea (The global IP Internet).
Lecture 4, 20-755: The Internet, Summer 1999
33
Internetworking with repeaters
r
Repeaters (also called hubs)
(r in the figure) directly transfer
bits from their inputs to their
outputs
r
r
r
Lecture 4, 20-755: The Internet, Summer 1999
34
Internetworking with repeaters
Telnet, FTP,
HTTP, email
10Base-T
application
application
transport
transport
network
network
data link
data link
physical
physical
Host on
network A
Repeater
(forwards bits)
Lecture 4, 20-755: The Internet, Summer 1999
Host on
network B
35
Internetworking with repeaters:
Pros and cons
•
Pros
– Transparency
» LANS can be connected without any awareness from
the hosts.
– Useful for serving multiple machines in an office from
one ethernet outlet.
•
Cons
– Not scalable
» ethernet standard allows only 4 repeaters.
» more than 4 would introduce delays that would break
contention detection.
– No heterogeneity
» Networks connected with repeaters must have
identical electrical properties.
Lecture 4, 20-755: The Internet, Summer 1999
36
Internetworking with bridges
b
Bridges (b In the figure)
maintain a cache of hosts on
their input segments.
b
Selectively transfer
ethernet frames from their
inputs to their outputs.
b
b
Lecture 4, 20-755: The Internet, Summer 1999
37
Internetworking with bridges
Telnet, FTP,
HTTP, email
application
application
transport
transport
network
network
CSMA/CD
data link
data link
10Base-T
physical
physical
Host on
network A
Bridge
(forwards ethernet
frames)
Lecture 4, 20-755: The Internet, Summer 1999
Host on
network B
38
Bridges
adapter (interface)
A
B
Ethernet A
C
port 1 (really just another adapter)
bridge
port 2
Unlike repeaters (which operate
at the physical level), bridges
operate at the data link level
(or link level).
X
Ethernet X
Y
Z
By link level, we mean that they
can parse and understand e.g. ethernet frames (as opposed to IP packets).
Basic forwarding algorithm (flooding): copy each received frame to all
other ports.
Lecture 4, 20-755: The Internet, Summer 1999
39
Learning bridges
Problem: Flooding is wasteful
A
B
Ethernet A
C
port 1
bridge
port 2
X
Ethernet X
Y
Z
Optimization: Forward packets only when necessary by learning and
remembering which hosts are connected to which bridge ports.
Lecture 4, 20-755: The Internet, Summer 1999
40
Learning bridges
(cont)
Learning algorithm:
1. start with empty hash table T that maps hosts to ports
2. receive frame from host src on port p
3. add (src,p) to T
4. delete old entries
Forwarding algorithm:
1. receive frame f from host src to host dst on port p
2. if T(dst) = n/a then flood f.
else if T(dst) = p then discard f
else forward f on port T(dst).
Lecture 4, 20-755: The Internet, Summer 1999
41
Learning bridges (example)
A
B
C
P
1
Ethernet A
Q
R
3
Ethernet P
bridge
2
Ethernet X
X
B -> A
A -> C
host
A
port
1
flood 2 & 3
Y
host
A
B
port
1
1
discard
Z
X -> A
host
A
B
X
port
1
1
2
forward on 1
Lecture 4, 20-755: The Internet, Summer 1999
42
Cycles in bridged networks
1. host writes frame F
to unknown destination
2. B1 and B2 flood
3. B2 reads F1,
B1 reads F2
F
B1
B2
B1
F1
4. B1 and B2 flood
F2
F1
B1
B2
B1
B2
B2
F2
F2
5. B1 reads F1
B2 reads F2
F1
F1
6. B1 and B2 flood
F2
B1
B2
B1
F1
Lecture 4, 20-755: The Internet, Summer 1999
B2
F2
43
Spanning tree bridges
A
B
A
B
G
B3
C
B4
G
B5
B3
D
C
B2
B5
D
B2
F
E
B4
F
E
B1
B1
• Networks are graph nodes, ports are graph edges
• Tree is constructed dynamically by a distributed “diffusing computation”
that prunes ports.
• “spanning” refers only to networks, not bridges
Lecture 4, 20-755: The Internet, Summer 1999
44
Portion of the bridged CMU internet
gw.cs
interlink.sw.net
baker
rtrbone.net
backbone-1.net.cs
es-weh-cle-4.net.cs
(PDL/CMCL Labs)
porter
7th floorWean
cyert host
cmu-fddi.psc.net
es-weh-cl6-2.net.cs
8th floor Wean
ATM
poconos.cmcl
PSC
pitt.edu
AT&T
Sprint
Lecture 4, 20-755: The Internet, Summer 1999
45
Internetworking with bridges:
Pros
and
cons
• Pros
– Transparency
» LANS can be connected without any awareness from the hosts
» popular solution for campus-size networks
•
Cons
– Transparency can be misleading
» looks like a single Ethernet segment, but really isn’t
» packets can be dropped, latencies vary
– Homogeneity
» can only support networks with identical frame headers (e.g.,
Ethernet/FDDI)
» however, can connect different speed Ethernets
– Scalability
» tens of networks only
– bridges forward all broadcast frames
– increased latency
Lecture 4, 20-755: The Internet, Summer 1999
46
Internetworking with
application gateways
•
Network A
g
x
– User on host x posts
news item to gateway
machine on network A.
– Gateway on A passes item
(along with others) to
gateway B.
– User on host y reads
message from gateway on
B.
phone
system
Network B
g
•
application gateways (g
in the figure) connect
different networks for
particular applications.
Example:
y
Lecture 4, 20-755: The Internet, Summer 1999
47
Internetworking with
application gateways
Gateway program
usenet news
application
application
transport
network
modem
data link
data link
phone
physical
physical
Application gateway
on network A
Application gateway
on network B
Lecture 4, 20-755: The Internet, Summer 1999
host on network B
48
Internetworking with
application gateways:
Pros and cons
•
Pros
– Heterogeneous
» can connect different types of networks
– Simple
» modems + gateway software
•
Cons
– Not general-purpose
» each solution is application-specific
Lecture 4, 20-755: The Internet, Summer 1999
49
Internetworking with routers
•
Def: An internetwork (internet for short) is an
arbitrary collection of physical networks
interconnected by routers to provide some
sort of host-to-host packet delivery service.
host
host
internet
host
Lecture 4, 20-755: The Internet, Summer 1999
host
50
Building an internet
We start with two separate, unconnected computer networks (subnets),
which are at different locations, and possibly built by different vendors.
A
B
C
X
Y
Z
adaptor
adaptor
adaptor
adaptor
adaptor
adaptor
network 1 (SCS)
Ethernet
network 2 (ECE)
ATM
Question: How to present the illusion of one network?
Lecture 4, 20-755: The Internet, Summer 1999
51
Building an internet (cont)
Next we physically connect one of the computers, called a router
(in this case computer C), to each of the networks.
A
B
adaptor
adaptor
C (router)
adaptor
network 1 (SCS)
Lecture 4, 20-755: The Internet, Summer 1999
adaptor
X
Y
Z
adaptor
adaptor
adaptor
network 2 (ECE)
52
Building an internet (cont)
Finally, we run a software implementation of the Internet Protocol (IP)
on each host and router. IP provides a global name space for the hosts,
routing messages between network1 and network 2 if necessary.
IP addresses:
128.2.250.1
128.2.250.2
A
B
adaptor
adaptor
network 1 (SCS)
Lecture 4, 20-755: The Internet, Summer 1999
128.2.250.0
128.2.80.0
C (router)
adaptor
adaptor
128.2.80.1
128.2.80.2
128.2.80.3
X
Y
Z
adaptor
adaptor
adaptor
network 2 (ECE)
53
Building an internet (cont)
At this point we have an internet consisting of 6 computers built from
2 original networks. Each computer on our internet can communicate
with any other computer. IP provides the illusion that there is just
one network.
128.2.80.1
128.2.250.1
128.2.250.2
internet
128.2.80.2
128.2.80.3
128.2.250.0
128.2.80.3
Lecture 4, 20-755: The Internet, Summer 1999
54
Download