Outline: Contention-based Access Ethernet Ethernet MAC Features

advertisement
Outline: Contention-based
Access
18-345: Introduction to
Telecommunication Networks
Lectures 7: Datalink layer
Switching
•
•
•
•
Peter Steenkiste
Aloha
Ethernet MAC
Collisions
Ethernet Frames
Spring 2015
www.cs.cmu.edu/~prs/nets-ece
1
2
Ethernet
Ethernet MAC Features
• First practical local area network, built at Xerox
PARC in 70’s
• Dominant LAN technology:
• Carrier Sense: listen before you talk
– Avoid collision with active transmission
• Collision Detection during transmission
– Cheap
– Kept up with speed race: 10, 100, 1000, … Mbps
– Listen while transmitting
– If you notice interference  assume collision
– Abort transmission immediately – saves time
• Why didn’t ALOHA have this?
Metcalfe’s Ethernet
sketch
– Signal strength is reduced by distance for radio
• May not hear remote transmitter – hidden terminal
– Very difficult for radios to listen and transmit
– More on this later in the course
3
4
1
Ethernet CSMA/CD:
Making it work
Ethernet MAC – CSMA/CD
Carrier Sense Multiple Access/Collision Detection
Jam Signal: make sure all other transmitters
are aware of collision; 48 bits;
Exponential Backoff:
• If deterministic delay after collision, collision
will occur again in lockstep
• Why not random delay with fixed mean?
Packet?
No
Sense
Carrier
Detect
Collision
Send
– Few senders  needless waiting
– Too many senders  too many collisions
Yes
Discard
Packet
attempts < 16
Jam channel
b=CalcBackoff();
wait(b);
attempts++;
• Goal: adapt retransmission attempts to
estimated current load
attempts == 16
– heavy load: random wait will be longer
6
5
Outline: Contention-based
Access
Ethernet Backoff Calculation
• Delay is set as K slots – control K
• Exponentially increasing random delay
•
•
•
•
– Infer senders from # of collisions
– More senders  increase wait time
• First collision: choose K from {0,1}; delay is K
x 512 bit transmission times
• After second collision: choose K from
{0,1,2,3}…
• After ten or more collisions, choose K from
{0,1,2,3,4,…,1023}
7
Aloha
Ethernet MAC
Collisions
Ethernet Frames
8
2
Collisions
A
B
Minimum Packet Size
C
Time
• Packets must be long
enough to guarantee
all nodes observe
collision
• Depends on packet
size and length of wire
– Propagation delay
• Min packet length > 2x
max prop delay
Space
10
9
Delay & Collision Detection
Scaling Ethernet
• Speed in cable ~= 60% * c ~= 1.8 x 10^8 m/s
• 10Mb Ethernet, 2.5km cable
–
–
–
–
• What about scaling? 10Mbps, 100Mbps,
1Gbps, ...
~= 12.5us delay
+Introduced repeaters (max 5 segments)
Worst case – 51.2us round trip time!
Corresponds to 512 bits
– Use a combination of reducing network diameter
and increasing minimum minimum packet size
• Reality check: 40 Gbps is 4000 times 10 Mbps
– 10 Mbps: 2.5 km and 64 bytes -> silly
– Solution: switched Ethernet – next lecture
• Also used as slot time = 51.2us for backoff
– After this time, sender is guaranteed sole access to
link
– Specifically, will have heard any signal sent in the
previous slot
• What about a maximum packet size?
– Needed to prevent node from hogging the network
– 1500 bytes in Ethernet
11
12
3
Ethernet Frame Structure
Outline: Contention-based
Access
•
•
•
•
• Sending adapter encapsulates IP
datagram (or other network layer protocol
packet) in Ethernet frame
Aloha
Ethernet MAC
Collisions
Ethernet Frames
13
Ethernet Frame Structure (cont.)
14
Addressing Alternatives
• Broadcast  all nodes receive all packets
• Preamble: 8 bytes
– Addressing determines which packets are kept and
which are packets are thrown away
– Packets can be sent to:
– 101010…1011
– Used to synchronize receiver, sender clock rates
• CRC: 4 bytes
– Checked at receiver, if error is detected, the frame is
simply dropped
• Type: 2 bytes
– Demultiplexing: indicates the higher layer protocol,
mostly IP today but historically more protocols (such
as Novell IPX and AppleTalk)
15
• Unicast – one destination
• Multicast – group of nodes (e.g. “everyone playing Quake”)
• Broadcast – everybody on wire
• Dynamic addresses (e.g. Appletalk)
– Pick an address at random
– Broadcast “is anyone using address XX?”
– If yes, repeat
• Static address (e.g. Ethernet)
16
4
Ethernet Address Assignment
Why Did Ethernet Win?
• Failure modes
• Each adapter is given a globally unique 6byte address at manufacturing time
– Token rings – network unusable (or expensive)
• Good performance in common case
– Address space is allocated to manufacturers
– Deals well with bursty traffic
– Usually used at low load
• 24 bits identify manufacturer
• E.g., 0:0:15:*  3com adapter
• Volume  lower cost  higher volume ….
• Adaptable
– Frame is received by all adapters on a LAN and dropped if address
does not match
– To higher bandwidths (vs. FDDI)
– To switching (vs. ATM)
• Special addresses
– Broadcast – FF:FF:FF:FF:FF:FF is “everybody”
– Range of addresses allocated to multicast
• Easy incremental deployment (backwards compatible)
• Cheap cabling, etc
• Adapter maintains list of multicast groups node is
interested in
17
18
And .. It is Easy to Manage
Summary
• CSMA/CD  carrier sense multiple access with
collision detection
• You plug in the host and it basically works
– No configuration at the datalink layer
– Today: may need to deal with security
– Why do we need exponential backoff?
– Why does collision happen?
– Why do we need a minimum packet size?
• Protocol is fully distributed
• Broadcast-based.
• How does this scale with speed?
– In part explains the easy management
– Some of the LAN protocols (e.g. ARP) rely on broadcast
• Ethernet
• Networking would be harder without ARP
– Not having natural broadcast capabilities adds complexity to a
LAN (e.g., ATM)
– What is the purpose of different header fields?
– What do Ethernet addresses look like?
• What are some alternatives to Ethernet design?
• Network managers love it!
19
20
5
Outline
•
•
•
•
•
•
Datalink Classification
Error Detection and Correction
Framing
Error and flow control
Medium access control
Contention based access
Bridging and switching
Datalink
Switch-based
Multiple Access
Virtual
Circuits
Packet
Switching
ATM,
MPLS, ..
Bridged
LANs
In ~2 weeks
Scheduled
Access
Random
Access
Token ring,
Ethernet,
FDDI, 802.11 802.11, Aloha
Today
Last lecture
21
Outline
Scale
yak yak…
• Bridging and switching:
•
•
•
•
Scaling the network
Spanning tree protocol
Why Ethernet?
Something different
• What breaks when we keep adding people
to the same wire?
23
24
6
Building Larger LANs: Bridges
Scale
• Extend reach of a single shared medium
• Connect two or more “segments” by copying data frames between
them
yak yak…
– Only copy data when needed  key difference from repeaters/hubs
– Reduce collision domain compared with single LAN
– Separate segments can send at once  much greater bandwidth
• What breaks when we keep adding people
to the same wire?
• Only solution: split up the people onto
multiple wires
• Challenge: learning which packets to copy across links
– But how can they talk to each other?
LAN 1
LAN 2
25
26
Frame Forwarding
Transparent Bridges
Bridge
• Design goals:
2
– Self-configuring without hardware or software
changes
– Bridge do not impact the operation of the
individual LANs
MAC
Address
• Three parts to making bridges transparent:
A21032C9A591
1) Forwarding frames
2) Learning addresses/host locations
3) Spanning tree algorithm
99A323C90842
8711C98900AA
301B2369011C
27
695519001190
1
3
• A machine with MAC Address lies in the
direction of number port of the bridge
Port
Age
1
2
2
36
2
3
16
01
15
11
• For every packet, the bridge “looks up” the
entry for the packets destination MAC
address and forwards the packet on that
port.
– Other packets are broadcast – why?
• Timer is used to flush old entries
28
7
Learning Bridges
Spanning Tree Bridges
• Manually filling in bridge tables?
• More complex topologies can provide
redundancy.
– Time consuming, error-prone
• Keep track of source address of packets arriving on every
link, showing what segment hosts are on
– Fill in the forwarding table based on this information
host
host
host
host
host
host
– But can also create loops.
• What is the problem with loops?
• Solution: spanning tree
host
Bridge
host
host
host
host
host
host
Bridge
host
host
host
host
host
host
host
host
Bridge
host
host
host
29
30
Spanning Tree Algorithm
Steps
Spanning Tree Protocol
Overview
Embed a tree that provides a single unique path
to each destination:
1) Elect a single bridge as a root bridge
2) Each bridge calculates the distance of the
shortest path to the root bridge
3) Each LAN identifies a designated bridge,
the bridge closest to the root. It will forward
packets to the root.
4) Each bridge determines a root port, which
will be used to send packets to the root
5) Identify the ports that form the spanning
tree
• Root of the spanning tree is
the bridge with the lowest
identifier.
2 B3
B5 1
– All ports are part of tree
• Each bridge finds shortest path
to the root.
1 B7
1 B2
– Remembers port that is on the
shortest path
– Used to forward packets
B1
• Select for each LAN the
designated bridge that has the
shortest path to the root.
– Identifier as tie-breaker
– Responsible for that LAN
31
B6 1
1 B4
32
8
Spanning Tree Algorithm
(part 2)
Spanning Tree Algorithm
• Each node sends configuration
message to all neighbors.
–
–
–
–
Identifier of the sender
Id of the presumed root
Distance to the presumed root
E.g. B5 sends (B5, B5, 0)
• When B receive a message, it
decide whether the solution is
better than their local solution.
• Each bridge B can now select
which of its ports make up the
spanning tree:
B3
– B’s root port
– All ports for which B is the
designated bridge on the LAN
B5
B7
B2
B3
B5
B7
B2
• Bridges can not configure their
ports.
– A root with a lower identifier?
– Same root but lower distance?
– Same root, distance but sender
has lower identifier?
– Forwarding state or blocked
state, depending on whether the
port is part of the spanning tree
B1
• After convergence, each bridge
knows the root, distance to root,
root port, and designated bridge for
each LAN.
B6
• Root periodically sends
configuration messages and
bridges forward them over LANs
they are responsible for.
B4
B1
B6
B4
33
Spanning Tree Algorithm
Example
•
•
• Bridges make it possible to increase LAN
capacity.
B3
Sends (B2, B2, 0)
Receives (B1, B1, 0) from B1
Sends (B2, B1, 1) “up”
Continues the forwarding forever
Node B1:
– Will send notifications forever
•
Ethernet Switches
Node B2:
–
–
–
–
– Packets are no longer broadcasted - they are only
forwarded on selected links
– Adds a switching flavor to the broadcast LAN
B5
B7
B2
• Ethernet switch is a special case of a bridge:
each bridge port is connected to single host.
Node B7:
–
–
–
–
–
–
34
Sends (B7, B7, 0)
Receives (B1, B1, 0) from B1
Sends (B7, B1, 1) “up” and “right”
Receives (B5, B5, 0) - ignored
Receives (B5, B1, 1) - better
Continues forwarding the B1
messages forever to the “right”
– Can make the link full duplex (really simple protocol!)
– Simplifies the protocol and hardware used (only two stations
on the link) – no longer full CSMA/CD
– Can have different port speeds on the same switch
B1
B6
• Unlike in a hub, packets can be stored
• An alternative is to use cut through switching
B4
35
36
9
Ethernet Evolution
Ethernet or 802.3
B/R
A Local Area Network
•
MAC addressing, non-routable
•
BUS or Logical Bus topology
•
Collision Domain, CSMA/CD
•
Bridges and Repeaters for distance/capacity extension
•
1-10Mbps: coax, twisted pair (10BaseT)
Conc..
S7
CSMA - Carrier Sense
Multiple Access
•
Switched solution
•
Little use for collision domains
HUB
•
80% of traffic leaves the LAN
Switch
•
Servers, routers 10 x station speed
•
10/100/1000 Mbps, 10gig coming: Copper, Fiber
•
95% of new LANs are Ethernet
Server
WAN
Capacity?
Reliability?
S9
S1
S5
Current Implementations
Router
Ethernet
WAN
•
WAN
LAN
Typical Campus Topology
Early Implementations
S1
S8
S2
S6
S11
S3
S10
S4
S12
CD - Collision Detection
37
…
…
…
…
…
…
38
“Traditional” Topology
Next Lecture
• Hierarchical single tree
• Redundancy for reliability
• Spanning tree (or variant) for loop-freeness
• Discussion of the two papers
– “The design philosophy of the DARPA
Internet Protocols”, Dave Clark, SIGCOMM
88
– “End-to-end arguments in system design”,
Saltzer, Reed, and Clark, ACM
Transactions on Computer Systems,
November 1984
39
40
10
Download