
Forwarding and Addressing in the Link Layer 3035/GZ01 Networked Systems Kyle Jamieson Lecture 4 Department of Computer Science University College London The link layer The link layer (L2) has the job of transferring a datagram point-to-point over a link Datagram link_send(packet, link-id) network_handle Wireless Node A Node B Node D Link layer Link layer Link layer Serial Link layer Node C Ethernet Unit of data is called a frame at the link layer Where is the link layer implemented? • In each and every host Host Applicaon • Network adapter Transport CPU Memory – Physical card Network – Chip in a device Link Network adapter – APaches to host’s Controller system bus Link • Implemented both in Physical PHY hardware and soRware – SoRware: device driver running on CPU – Hardware: FPGA, ASIC in network adapter Hardware or soware? Host • SoRware is more flexible, Applicaon unless you need: Transport CPU Memory Network 1. Time-criYcal funcYonality Link Network adapter – Backoff transmission Yming in Ethernet Controller Link Physical PHY 2. Highly parallel processing – Dot product computaons for CDMA, filtering for the PHY Today 1. Framing – Byte-oriented framing – Bit-oriented framing 2. Link layer addressing 3. Link layer switching and forwarding Framing: The problem Bit stream 1 0 0 0 1 0 0 1 1 Binary encoding Manchester encoding Time • We have seen how to encode bits on a link – Ethernet: Manchester encoding, synchronizaon on edges – Result in general: An infinite stream of bits • Problem: where does each frame begin and end? Byte-oriented framing • Treat each frame as a collecYon of bytes rather than bits • Byte-oriented framing link layer protocols: – PPP (point-to-point protocol), used to carry Internet Protocol (IP) packets over dialup lines, Virtual Private Networks – BISYNC (IBM, 60’s), Digital Data Communicaon Message Protocol (DDCMP), Digital Equipment Corporaon’s DECNET • BISYNC uses sennel characters to frame: • SYN: Beginning of frame • SOH: Start of header • STX: Start of text (packet data) • ETX: End of text • What if senYnel occurs in data? Character stuffing: insert escape character DLE before senYnel • What if escape character occurs in data? Escape the escape character PPP byte stuffing • Like BISYNC, PPP takes a senYnel-based approach • At the sender: – Stuff escape byte before each flag byte in payload – Stuff escape byte before each escape byte in payload • At the reCeiver: – Escape, flag byte à discard escape byte, keep flag byte, conYnue data recepYon – Single flag byte: interpret as the flag byte – Two escape bytes à discard one Byte-CounHng approaCh: DDCMP • Byte-coun/ng framing: Include number of bytes in header (Count field): • What if Count field is corrupted? – Will frame the wrong bytes – This is called a framing error – With high probability, CRC will detect the framing error and discard the frame • Do we sYll need to escape the SYNs? Bit-oriented framing • Main idea: View link as stream of bits instead of bytes • Example: High-Level Data Link Control (HDLC), used in Cisco routers and the V.42 standard for telephone modems • Choose some paern of bits as a senYnel e.g.: 1111111 Seven 1s • Bit stuffing algorithm: Modify the outgoing data stream as follows: • At sender: 111111 → 1111110 Six 1s Six 1s • At receiver: 1111110 → 111111 1111111 → (end of frame) Seven 1s • Size of frame depends on data it contains! • Not guaranteed free of framing errors Today 1. Framing 2. Link layer addressing 3. Link layer switching and forwarding 4. Virtualizing links Comparing addressing schemes • Network layer address (IP address) – FuncYon: move datagram to desYnaon network – 32-bit address, doPed quad notaon a.b.c.d where each component is an eight-bit unsigned integer – Hierarchical address space • Link layer address (MAC address, Ethernet address): – FuncYon: move frame from one point to another point on the same network – 48-bit address (in most LANs) – Burned in NIC ROM, also someYmes soRware sePable – Usually a flat address space Link-layer addressing • Each adapter on LAN has unique link layer address, my_station_id! • Special broadcast address broadcast_id! Station Identifier (Ethernet 17 24 12 05 19 Address) • Each L3 protocol registers itself in net_handler array • L2 address-related funcYonality for inbound frames: • Test received_frame.destination against my_station_id or broadcast_id, drop if neither match • handler ß net_handler! !! !!!![received_frame.net_protocol]! • call handler(received_frame.payload)! Mapping network to link addresses • Goal: Translate from nework_send(data, length, IP, N) to link_send(data, length, IP, enet/18)! • Name-mapping table: example of soR state upper-layer network address link identifier G internet Ethernet/ L M N P Q K address station work work work work router 1 H station station server station station 2 enet/15 … 3 J M 4 enet/18 1 1 1 1 1 N 6 5 E P enet/14 17 15 18 14 22 19 Q enet/22 K enet/19 Ethernet F E enet/19 Ethernet station identifier Link layer addresses aren’t routable • Network layer routes from one network to another upper-layer network address link identifier G L M N P Q K work work work work router 1 H station station server station station 2 … 3 J 4 1 1 1 1 1 6 5 E 17 15 18 14 22 19 Ethernet F Ethernet station identifier (link layer address) The Address ResoluHon ProtoCol (ARP) L sending a datagram to N: L: network_send(data, length, IP, N)! L: link_send(“where is N?”, length, ARP, broadcast_id)! N: link_send(“N is at enet/18”, length, ARP, enet/17)! L: link_send(data, length, IP, enet/18)! upper-layer network address ARP table at L: link identifier G Internet enet/ L M N P Q K Address station TTL work work work work router 1 H station station server station station 2 … 3 J N 18 20 min 4 1 1 1 1 1 6 5 E 17 15 18 14 22 19 Ethernet F Ethernet station identifier ARP’s role in L3 roung • Walkthrough: send IP data from L to E via router K • Router K • Two ARP tables: one for each subnet • Two interfaces (interface ids 6, 4): one for each subnet, with two link-layer addresses (19, 27) L N K E work work router server station station 4 27 1 1 6 17 18 19 28 Ethernet Ethernet Example: roung between subnets L sending a datagram to E: L: network_send(data, length, IP, E)! L: link_send(data, length, IP, enet/28)! L: ARPs for K’s link layer address (enet/19) L: link_send(data, length, IP, enet/19)! K: ARPs for E’s link layer address (enet/28) on link/4 K: link_send(link/4, data, length, IP, enet/ 28)! L N K E work work router server station station 4 27 1 1 6 17 18 19 28 Ethernet Ethernet Hubs • Replicang device: bits coming in go out all ports – Operates at the physical layer (L1) • Doesn’t run CSMA/CD: immediately replicates bits • Collisions possible between all hosts • No frame buffering at the hub • Physical limitaons: can’t grow collision domain too big Hub Today 1. Framing 2. Link layer addressing 3. Link layer switChing and forwarding – Learning switches – Spanning Tree Protocol – Virtual LANs Ethernet nowadays: Switched • Hosts have dedicated, direct A connecYon to switch F B • Switches buffer frames 1 2 6 3 Switch S • Ethernet protocol used on each 5 4 incoming link, but no collisions – Each link in own collision domain C • Switching: Allows two E D conversaons A → A’ and B → B’ simultaneously, without collisions The switch table • How to tell which port to A forward packet? F B 21 22 26 1 2 • The switch table: 6 3 Switch S LAN addr Port Time-to-live 5 4 23 25 24 C • Switch table iniYally empty E D • How to build up switch table entries? Building the switch table: Self-learning • Switch table: entries of (LAN address, port id, Yme-to-live) • Learning algorithm: on receiving a packet from LAN address S to LAN address D: 1. Add S to switch table with incident port id 2. If D is broadcast_id: forward out all ports 3. If D is in switch table, lookup entry and forward to resulYng port id. Otherwise, forward out all ports • Periodically flush link table entries based on Yme-to-live Building up the switch table: example 1. Aà S: [A (enet/21) à D (enet/24)] A S à (all ports) F 2. B à S: [B (enet/22) à C (enet/23)] B 21 22 26 S à (all ports) 1 2 à à 6 3 3. D S: [D (enet/24) B (enet/22)] Switch S S à port 2 only 5 4 23 25 24 Switch table: C LAN addr Port TTL E D enet/21 1 20 min enet/22 2 20 min enet/24 4 20 min Aside: What is a hub? Hub Switch • Differences – Physical layer (L1) device – Link-layer (L2) device – Replicang device: bits in one – SelecYvely forward frame to port go out all ports one or more outgoing links – No medium access control – CSMA/CD MAC – No frame buffering – Buffers frames • CommonaliYes – Hosts are unaware of – Hosts are unaware of presence of hubs presence of switches – No configuraon needed – No configuraon needed InterConneCHng LANs Link layer addresses S 1 4 2 3 S1 11 1 1 S3 2 S 1 21 2 A 3 4 2 12 3 4 13 D 22 23 B C E F • Switches can connect LANs as well as hosts • SomeYmes called bridges in this context • The enYrety is called an extended LAN InterConneCHng LANs: example Suppose C sends frame to F, F responds to C Link layer addresses S 1 4 2 3 S1 11 1 1 S3 2 S 1 21 2 A 3 4 2 12 3 4 13 D 22 23 B C E F Address Port 13 4 InterConneCHng LANs: example Suppose C sends frame to F, F responds to C S 1 4 2 3 S1 11 1 1 S3 2 S 1 21 2 A 3 4 2 12 3 4 13 D 22 23 B C E F Address Port 13 4 Address Port 13 1 InterConneCHng LANs: example Suppose C sends frame to F, F responds to C S 1 4 2 3 S1 11 1 1 S3 2 S 1 21 2 A 3 4 2 12 3 4 13 D 22 23 B C E F Address Port 13 1 Address Port 13 4 Address Port 13 1 Address Port 13 1 InterConneCHng LANs: example Suppose C sends frame to F, F
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages53 Page
-
File Size-