Lectures 22-23 Ethernet EECS 122 University of California Berkeley
Overview Robert Metcalfe at Xerox in Palo Alto developed the original Ethernet in 1973. Digital Equipment Corporation, Intel, and Xerox defined the 10-Mbps (DIX) versions in 1980 and 1982. IEEE published the IEEE802.3 standard in June 1983. Grand Junction developed Fast Ethernet (100Mbps) in 1992 that was standardized by IEEE in 1995. IEEE standardized Gigabit Ethernet in 1998. 10-Gigabit Ethernet was standardized in 2002. These standard specify the physical layer, the MAC (media access control) sublayer, and the LLC (logical link control) sublayer. In addition, the standards define the rules for addressing and routing. EECS122 - COMMENTS
Ethernet Overview Physical Layer MAC Bridged Ethernet VLAN Link Aggregation XON/XOFF 802.11 ETHERNET 2
Overview Typical Setup Names Operations Perspective ETHERNET - Overview 3
Typical Setup ETHERNET Overview -Typical 4
Names Structure [rate][modulation][media or distance] 10Base5 (10Mbps, baseband, coax, 500m) 10Base-T (10Mbps, baseband, twisted pair) 100Base-TX (100Mbps, baseband, 2 pair) 100Base-FX (100Mbps, baseband, fiber) 1000Base-CX for two pairs balanced copper cabling 1000Base-LX for long wavelength optical transmission 1000Base-SX for short wavelength optical transmission. Wireless: Wi-Fi = 802.11 Versions: a, b, g ETHERNET Overview - Names 5
Operations Hub: Single Collision Domain MAC Protocol: Wait until silent (carrier sense) Transmit CSMA/CD If collision, wait random time & repeat ETHERNET Overview Operations 6
Operations Switch: No Collisions Multiple transmissions are possible Switch stores packets that wait for same output ETHERNET Overview Operations 7
Perspective Ethernet is wildly successful, partly due to low cost (compare with FDDI or Token Ring-- - see text book) Some issues: nondeterministic service no priorities min frame size may be large ETHERNET Overview - Perspective 8
Physical Layer ETHERNET Physical 9
Physical Ethernet 10 BaseT Fast Ethernet 100 BaseT Gigabit Ethernet 1000 Base x Data Rate 10 Mbps 100 Mbps 1000 Base Mbps (1 gigabit per second) Cat 5 UTP 100 m (min) 100 m 100 m STP/Coax 500 m 100 m 25 m Multimode Fiber 2 km 412 m (hd) 2 km (fd) 550 m Single-mode Fiber 25 km 20 km 5 km EECS122 - COMMENTS
Physical ETHERNET Physical 10
MAC: Media Access Control Frame Multiple Access ETHERNET -MAC 11
Frame 7 byte preamble: alternating 1/0 combination producing 10Mhz square wave [@ 10Mbps] for 5.6 µsec; used for receiver synchronization 1 byte SFD (start of frame delimiter) 10101011 ETHERNET MAC Frame 12
Frame Length/Type field: Type (Ethernet) indicates type of data contained in payload issue: what is the length? Length field (802.3) type info follows frame header So, is it the type or length? Ethernet : types have values above 2048 (RFC894 for IP) 802.3: length (RFC1042 for IP) If length, next headers are LLC & SNAP (for IP) LLC (3 bytes): DSAP, SSAP, CTL SNAP (5 bytes): org code, type (above) ETHERNET MAC Frame 13
Frame Structure 802.3 The frame structure has two possible versions: Type encapsulation: (The number between parentheses are the lengths in bytes of the fields.) [PRE (8) DA (8) SA (8) Type (2) Data (46-1500) FCS (4)]. PRE is the preamble, used for synchronization. DA is the destination address, SA the source address. The type (> 2,048) specifies the protocol above the LLC (e.g., IP, IPX, AppleTalk, etc.). Length encapsulation: [PRE (8) DA (8) SA (8) Length (2) DSAP (1) SSAP (1) Ctrl (1-2) Data Pad (if needed) FCS (4)]. DSAP is the destination service access point and specifies the process that gets the data at the destination. SSAP is the source service access point. The length specifies the length (0 1500) in bytes of the unpadded data. The padding makes sure that the size from the start of DSAP to the end of the padding is between 46 and 1500 bytes. EECS122 - COMMENTS
Multiple Access High-Level View Multiple Access Protocols Random Access Protocols Slotted ALOHA CSMA/CD ETHERNET MA 14
High-Level View Goal: share a communication medium among multiple hosts connected to it Problem: arbitrate between connected hosts Solution goals: High resource utilization Avoid starvation Simplicity (non-decentralized algorithms) ETHERNET MA High Level 15
Medium Access Protocols Channel partitioning Divide channel into smaller pieces (e.g., time slots, frequency) Allocate a piece to node for exclusive use Random access Allow collisions recover from collisions Taking-turns Tightly coordinate shared access to avoid collisions ETHERNET MA Protocols 16
Random Access protocols When node has packet to send Transmit at full channel data rate R. No a priori coordination among nodes Two or more transmitting nodes -> collision, Random access MAC protocol specifies: How to detect collisions How to recover from collisions Examples of random access MAC protocols: Slotted ALOHA CSMA and CSMA/CD ETHERNET MA Random 17
Slotted Aloha Time is divided into equal size slots (= packet transmission time) Node with new arriving pkt: transmit at beginning of next slot If collision: retransmit pkt in future slots with probability p, until successful. Success (S), Collision (C), Empty (E) slots ETHERNET MA S.Aloha 18
Slotted Aloha: Efficiency What is the maximum fraction of successful transmissions? Suppose N stations have packets to send Each transmits in slot with probability p Prob. successful transmission S is (very approximated analysis!): by a particular node: S = p (1-p) (N-1) by any of N nodes S = Prob (only one transmits) = N p (1-p) (N-1) 1/e = 0.37 ETHERNET MA S.Aloha 19
CSMA: Carrier Sense Multiple Access CS (Carrier Sense) means that each node can distinguish between an idle and a busy link Sender operations: If channel sensed idle: transmit entire packet If channel sensed busy, defer transmission Persistent CSMA: retry immediately with probability p when channel becomes idle Non-persistent CSMA: retry after a random time interval ETHERNET MA CSMA 20
CSMA: collisions spatial layout of nodes along ethernet Collisions can occur: propagation delay means two nodes may not hear each other s transmission Collision: entire packet transmission time wasted Note: role of distance and propagation delay in determining collision prob. ETHERNET MA CSMA 21
CSMA/CD (collision detection) Overview Timing Ethernet ETHERNET MA CSMA/CD 22
Overview Collisions detected within short time Colliding transmissions aborted, reducing channel wastage Easy in wired LANs: measure signal strengths, compare transmitted, received signals Difficult in wireless LANs ETHERNET MA CSMA/CD- Overview 23
Timing ETHERNET MA CSMA/CD- Timing 24
Ethernet Overview Collision Detection Minimum Frame Size Maximum Frame Size Operations Efficiency Addressing Fast Ethernet Gigabit Ethernet ETHERNET MA CSMA/CD- Ethernet 25
Overview Will discuss classical Ethernet primarily Single segments up to 500m; with up to 4 repeaters gives 2500m max length Baseband signals broadcast, Manchester encoding, 32-bit CRC for error detection Max 100 stations/segment, 1024 stations/ethernet ETHERNET MA CSMA/CD Ethernet Overview 26
Collision Detection CD circuit operates by looking for voltage exceeding a transmitted voltage Want to ensure that a station does not complete transmission prior to 1st bit arriving at farthest-away station Time to CD can thus take up to 2x{max prop. delay} A B time CD ETHERNET MA CSMA/CD Ethernet CD 27
Minimum Frame Size Speed of light is about 4µs/km in copper So, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With repeaters, etc. 802.3 requires 51usec, corresponding to 512 bit-times Thus, minimum frame size is 512 bits (64 bytes); also called slot time ETHERNET MA CSMA/CD Ethernet Minimum 28
Maximum Frame Size 1500 byte limitation on maximum frame transmission size We will call this the MTU limits maximum buffers at receiver allows for other stations to send also requires 96 bit Inter-Packet-Gap (IPG) ETHERNET MA CSMA/CD Ethernet Maximum 29
Operations When ready & line idle, await IPG (96 bit times) and send while listening (CD) If CD true, send max 48-bit jamming sequence and do exponential backoff Jamming sequence used to inform all stations that a collision has occurred ETHERNET MA CSMA/CD Ethernet Operations 30
Operations For retransmission N (1<=N<=10) choose k at random on U(0..2^N-1) wait k * (51.2µsec) to retransmit send on idle; repeat on another collision for (11<=N<=15), use U(0..1023) if N = 16, drop frame Longer wait implies lower priority (strategy is not fair ) ETHERNET MA CSMA/CD Ethernet Operations 31
Operations: Capture Effect Given two stations A & B, unfair strategy can cause A to continue to win Assume A & B always ready to send: if busy, both wait, send and collide suppose A wins, B backs off next time, B s chances of winning are halved ETHERNET MA CSMA/CD Ethernet Operations 32
Efficiency Typical Sequence of Events: Average = 5T T = max.prop.time between 2 nodes Average = L/R seconds L = average packet length Wait Random Successful Transmission Time Collision L/R Efficiency = = 1/(1 + 5a) Start L/R + 5T Transmitting a = T/(L/R) = RT/L ETHERNET MA CSMA/CD Ethernet Efficiency 33
Efficiency a impacts what happens during simultaneous transmission: a small early collision detection Efficient a = RT/L eff = 1/(1 + 5a) a large late detection Inefficient Example 1: 10Mbps, 1000m => T = (1km)(4µs/km) = 4µs; RT = 400 bits L = 4000 bits, say 5a = 2000/4000 = 0.5 => efficiency = 66% Example 2: 1Gbps, 200m => T = (0.2km)((4µs/km) = 0.8µs; RT = 800 bits L = 4000 bits; 5a = 4000/4000 = 1 => efficiency = 50% ETHERNET MA CSMA/CD Ethernet Efficiency 34
Efficiency - Analysis Model: Slot = 2T N stations compete by transmitting with probability p, independently If success => transmit L bits If failure (idle or collision), try next slot P(success) = P(exactly 1 out of N transmits) = Np(1 p) N-1 Indeed: N possibilities of station that transmits P(one given station transmits, others do not) = p(1 p) N-1 ETHERNET MA CSMA/CD Ethernet Efficiency 35
Efficiency - Analysis Average = A Slot = 2T success P(success) = Np(1 p) N-1 Assume backoff algorithm results in best p = 1/N => P(success) 1/e = 0.36 Average time until success: A = 0.36x0 + 0.64x(2T + A) => A = 1.28T/0.36 = 3.5T In practice, backoff not quite optimal => 5T ETHERNET MA CSMA/CD Ethernet Efficiency 36
Efficiency of CSMA/CD Consider a discrete-time model where N stations compete for time slots with duration S. In this model, the stations transmit independently, with probability p each, in every time slot. If a single station transmits in a slot, then it keeps transmitting a full packet with duration T. If more than a station transmits, they all stop and the slot is wasted. The probability that a slot is "successful" is then Np(1 - p)^{n - 1}. The maximum over p occurs for p = 1/N and the optimal value is close to 1/e where e = 2.718. If A designates the average number of slots wasted until the first successful slot, then A = 0(1/e) + (1 + A)(1-1/e). Solving for A, one finds A = e - 1 = 1.7. Consequently, the transmission of a packet which should take T seconds takes on average T + 1.7S seconds. The value of S is an upper bound on a round-trip propagation time on the network. The rationale for optimizing over p is that the actual algorithm uses an exponential back off scheme that achieve a throughput close to the optimal. However, all this is rather approximate. EECS122 - COMMENTS
Addressing 48 bit Ethernet/MAC/Hardware Addresses Prefix assigned per-vendor by IEEE Unique per-adapter, burned in ID PROM Multicast & Broadcast (all 1 s) addresses Many adapters support promiscuous mode ETHERNET MA CSMA/CD Ethernet Addressing 37
Addressing - Multicast Each vendor assignment supports 2^24 individual and group (multicast) addresses Each adapter supports multiple group subscriptions usually implemented as hash table thus, software may have to filter at higher layer ETHERNET MA CSMA/CD Ethernet Addressing 38
Fast Ethernet Fast Ethernet (1995) adds: 10x speed increase (100m max cable length retains min 64 byte frames) replace Manchester with 4B/5B (from FDDI) full-duplex operation using switches speed & duplex auto-negotiation ETHERNET MA CSMA/CD Ethernet Fast 39
Gigabit Ethernet IEEE 802.3{z,ab} 1000 Mb/s Gigabit Ethernet (1998,9) adds: 100x speed increase carrier extension (invisible padding...) packet bursting ETHERNET MA CSMA/CD Ethernet GE 40
Bridged Ethernets Objectives No-Frills Bridge Learning Bridge Spanning Tree Algorithm Bridge Limitations ETHERNET Bridged 41
Objectives Bridges interconnect network segments at the link layer (layer 2) Handle any layer 3 protocol (incl. non-routable ones); some can interconnect different media Mostly for LANs, also used in WANs (2 half bridges on ends of pt-to-pt links ETHERNET Bridged Objectives 42
Objectives Extending LANs Extending (interconnecting) multiple LANs. Appears as single LAN to layer 3. Essentially accepts and forwards all frames Benefits: extend number of stations extend size limit interfering traffic H B B R ETHERNET Bridged Objectives 43
No-Frills Bridge Interconnect 2 or more LAN segments Listens in promiscuous mode, buffers packets and transmits them on other interfaces when able On average, still cannot exceed link bandwidth bridge copies all traffic small bursts accommodated in buffers B ETHERNET Bridged No Frills 44
Learning Bridge Bridges learn which interfaces reach which end stations could do this by hand, but a hassle best if this happens transparently Learn by watching source addresses in frames senders usually use their own addresses (note that bridges don t!) ETHERNET Bridged Learning 45
Learning Bridge Listen promiscuously for all traffic Store (src addr, port) tuple in station cache for each new sender observed For each received frame: try to match frame dest to cache src entry not there->send on all interfaces except rcv is there->send on indicated, or filter if same as rcv interface Age cache entries ETHERNET Bridged Learning 46
Learning The switch must learn the MAC addresses of the NICs attached to each of its ports. If one switch port is attached to a hub, then a number of NICs are effectively attached to that port. The switch makes a list of the NICs addresses by watching the source addresses of the packets that arrive at the port. EECS122 - COMMENTS
Learning Bridge Example 1 1 2 A B A 1 C D B 1 ETHERNET Bridged Learning 47
Learning Bridge Example 2 3 1 2 C D A B A 1 E F D 3 ETHERNET Bridged Learning 48
Spanning Tree Algorithm Loops hurt! Spanning Tree Algorithm Example Topology Change ETHERNET Bridged STA 49
Spanning Tree To prevent frame duplications when there are multiple paths between pairs of hosts in a collection of bridged Ethernets, the bridges implement the spanning tree protocol. Unfortunately, the spanning tree protocol is slow to reconfigure after failure (one minute is typical) and it uses only one possible path that is typically inefficient. EECS122 - COMMENTS
Loops Hurt With redundant paths, bridges can loop traffic can happen forever (example) with more than 2, can cascade Cascade each bridge with N interfaces may produce up to N -2 new copies! ETHERNET Bridged STA Loops Hurt 50
Spanning Tree Consider LAN a graph G = (E, V), with LANs as vertices, and bridges as edges Spanning Tree: A spanning tree of an undirected, connected graph G is a subgraph which is both a tree and contains all vertices in G Thus, the ST will throw out some edges and be cycle-free Purpose will be to provide a single path to reach each network Generally, graphs have many STs Must be a distributed algorithm Can result in some bridges not forwarding at all! ETHERNET Bridged STA Spanning Tree 51
Algorithm Each bridge will decide over which ports it will forward frames bridges have unique addresses per port ports are also numbered by each bridge bridges have a single unique identifier (e.g. the lowest address) Ultimately Steps Root of tree = bridge with smallest ID Tree = shortest paths to root Resolve ties in favor of link to bridge with smallest ID Send [ my ID current root ID my distance to current root ] Update when receive smaller root ID ETHERNET Bridged STA Algorithm 52
Example 4 [2 1 1] B2 B1 3 [1 1 0] 1 [3 3 0] 5 [3 1 2] B3 B4 B6 6 [6 1 1] B5 2 [5 3 1] Format: [my ID current root ID distance to current root] ETHERNET Bridged STA Example 53
Topology Change Want to inform all bridges, but without having traffic scale as # of bridges Operation bridges noticing change send message on root port toward root root config messages subsequently contain topology changed flag ETHERNET Bridged STA Topology Change 54
Limitations Scale: not very realistic to interconnect more than 10 s of LANs Heterogeneity: really works best for homogeneous systems All broadcasts and multicasts are flooded ETHERNET Bridged Limitations 55
VLAN Virtual LAN A A B C A C B A, B, C A, B, C A B C Each port belongs to a set of VLANs and transmits only packets that belong to these VLANs ETHERNET VLAN 56
Link Aggregation Links are combined. Hello protocol determines which links are working and transmits across working links. ETHERNET VLAN 57
XON/XOFF 2 - XOFF 2 - XOFF 1 - Saturated XON/XOFF is a backpressure scheme designed to prevent nodes from saturating links. Unfortunately, in its present version, the scheme is not very effective it stops too many flows. ETHERNET XON/XOFF 58
Wireless (802.11) Overview Physical MAC Summary ETHERNET 802.11 59
Overview Designed for use in limited geographical area (i.e., couple of hundreds of meters) Designed for three physical media (run at either 1Mbps or 2 Mbps) Two based on spread spectrum radio One based on diffused infrared ETHERNET 802.11 Overview 60
Physical Frequency hoping (OFDM) Transmit the signal over multiple frequencies The sequence of frequencies is pseudo-random, i.e., both sender and receiver use the same algorithm to generate their sequences Direct sequence (DSSS) Represent each bit by multiple (e.g., n) bits in a frame; XOR signal with a pseudo-random generated sequence with a frequency n times higher Infrared signal Sender and receiver do not need a clear line of sight Limited range; order of meters ETHERNET 802.11 Physical 61
Physical 802.11b DSSS: 1, 2, 5.5, or 11 Mbps (depending on SNR) 2.4GHz Each channel occupies 22MHz There are 11 channels, but only 3 non-overlapping ones (1, 6, 11) Max. power = 1W 802.11a OFDM: 6, 9, 12, 18, 24, 36, 48, 54 Mbps (last 3 are optional) 5GHz 12 channels Max. power = 40mW, 200mW, 800mW (depending on freq.) ETHERNET 802.11 Physical 62
Physical 802.11g OFDM: 6, 12, 24, 18, 36, 48, 54 Mbps (last 4 are optional) 2.4GHz Backward compatible with 802.11b 3 non-overlapping channels ETHERNET 802.11 Physical 63
MAC: The Problems Reachability is not transitive: if A can reach C, and C can reach D, it doesn t necessary mean that A can reach D A B C D Hidden nodes: A and C send a packet to B; neither A nor C will detect the collision! Exposed node: B sends a packet to A; C hears this and decides not to send a packet to D (despite the fact that this will not cause interference)! ETHERNET 802.11 MAC 64
MAC: RTS/CTS sender RTS CTS data ACK receiver other node in sender s range Before every data transmission Sender sends a Request to Send (RTS) frame containing the length of the transmission Receiver respond with a Clear to Send (CTS) frame Sender sends data Receiver sends an ACK; now another sender can send data When sender doesn t get a CTS back, it assumes collision ETHERNET 802.11 MAC 65
MAC: CSMA/CA CA instead of CD: cannot listen while transmitting NAV: Network Allocation Vector: time until channel will become available transmitted in every frame Distributed Coordinated Function: Before transmitting Check if channel is busy, or In an interval between frames [as determined from NAV], or In an interval reserved for retransmission of an erroneous frame [as determined from previous transmission]. If one of the above, exponential backoff; else transmit. Centralized Controlled Access Mechanism: A point coordinator (in access point) coordinates transmissions. Stations request that the PC puts them in polling list Periodically, PC polls stations for traffic. Without hidden terminal; with hidden terminal ETHERNET 802.11 MAC 66
Summary Arbitrate between multiple hosts sharing a common communication media Wired solution: Ethernet (use CSMA/CD protocol) Detect collisions Backoff exponentially on collision Wireless solution: 802.11 Use MACA protocol Cannot detect collisions; try to avoid them ETHERNET 802.11 Summary 67