380 likes | 409 Views
Goal of this lecture: Introduce data link layer concepts and protocols. Contents: Link Layer Services Medium Access Methods MAC Protocols LAN Technologies ARP & RARP. Data Link Layer. Link Layer Protocols. Link Layer Services.
E N D
Goal of this lecture: Introduce data link layer concepts and protocols Contents: Link Layer Services Medium Access Methods MAC Protocols LAN Technologies ARP & RARP Data Link Layer
Link Layer Services • Framing and link access: encapsulate datagram into frame adding header and trailer, implement channel access if shared medium, ‘physical addresses’ are used in frame headers to identify source and destination of frames on broadcast links • Reliable Delivery: seldom used on fiber optic, co-axial cable and some twisted pairs too due to low bit error rate. Used on wireless links, where the goal is to reduce errors thus avoiding end-to-end retransmissions • Flow Control: pacing between senders and receivers • Error Detection: errors are caused by signal attenuation and noise. Receiver detects presence of errors: it signals the sender for retransmission or just drops the corrupted frame • Error Correction: mechanism for the receiver to locate and correct the error without resorting to retransmission
Link Layer Protocol Implementation • Link layer protocol entirely implemented in the adapter (e.g., PCMCIA card). Adapter typically includes: RAM, DSP chips, host bus interface, and link interface • Adapter send operations: encapsulates (set sequence numbers, feedback info, etc.), adds error detection bits, implements channel access for shared medium, transmits on link • Adapter receive operations: error checking and correction, interrupts host to send frame up the protocol stack, updates state info regarding feedback to sender, sequence numbers, etc.
Medium Access Links and Protocols • Two types of links: (a) Point-to-point (single wire) (b) Broadcast (shared wire or medium; eg, Ethernet, wireless, etc.) We focus on Broadcast links. Main challenge: Medium Access Protocol
Medium Access Protocols • Another human analogy: A classroom - Teacher(s) and student(s) share the same, single, broadcast channel • Central problem: Who gets to talk?, i.e., transmit on the channel • Evolved set of protocols for sharing the broadcast channel • “Give everyone a chance to speak” • “Don’t speak until you are spoken to” • “Don’t monopolize the conversation” • “Raise your hand if you have a question” • “Don’t interrupt when someone is speaking” • “Don’t fall asleep when someone else is talking”
Medium Access Control Protocols • MAC protocol: coordinates transmissions from different stations in order to minimize/avoid collisions • Channel Partitioning MAC protocols (TDM, FDM) • Random Access MAC protocols • “Taking turns” MAC protocols • Goal: efficient, fair, simple, decentralized R bps
Random Access protocols • A node transmits at random (i.e.,, no a priory coordination among nodes) at full channel data rate R. • If two or more nodes “collide”, they retransmit at random times • The random access MAC protocol specifies how to detect collisions and how to recover from them (via delayed retransmissions, for example) • Examples of random access MAC protocols: (a) SLOTTED ALOHA (b) ALOHA (c) CSMA and CSMA/CD
CSMA (Carrier Sense Multiple Access) • CSMA: listen before transmit. If channel is sensed busy, defer transmission • PersistentCSMA: retry immediately when channel becomes idle (this may cause instability) • Non persistent CSMA: retry after random interval • Note: collisions may still exist, since two stations may sense the channel idle at the same time (or better, within a “vulnerable” window = round trip delay) • In case of collision, the entire frame transmission time is wasted
CSMA/CD (Collision Detection) • CSMA/CD: carrier sensing and deferral like in CSMA. But, collisions are detected within a few bit times. • Transmission is then aborted, reducing the channel wastage considerably. • Collision detection is easy in wired LANs (eg, E-net): can measure signal strength on the line • Collision detection cannot be done in wireless LANs (the receiver is shut off while transmitting, to avoid damaging it with excess power) • CSMA/CD can approach channel utilization =1 in LANs (low ratio of propagation over packet transmission time)
“Taking Turns” MAC protocols • We have seen that channel partitioning MAC protocols (TDM, FDM) can share the channel fairly; but a single station cannot use it all • Random access MAC protocols allow a single user full channel rate; but cannot share the channel fairly • Taking TurnsMAC protocols achieve both fairness and full rate, at the expense of some extra control overhead • Polling: a Master station on a LAN in turn “invites” the slave stations to transmit their packets (up to a Max). Problems: Request to Send overhead, single point of failure (Master) • Token passing: the control token is passed from one node to the next sequentially. Can improve fault tolerance (in a token bus configuration). Still, elaborate procedures to recover from lost token.
LAN technologies • MAC protocols used in LANs, to control access to the channel • Token Ring: IEEE 802.5 (IBM token ring), for computer room, or Department connectivity, up to 16Mbps; FDDI (Fiber Distributed Data Interface), for Campus and Metro connectivity, up to 200 stations, at 100Mbps. • Ethernet: employ the CSMA/CD protocol; 10Mbps (IEEE 802.3), Fast E-net (100Mbps), Giga E-net (1,000 Mbps); by far the most popular LAN technology
Ethernet • Widely deployed because: • First LAN technology • Simpler and less expensive than token LANs and ATM • Kept up with the speed race: 10, 100, 1000, and higher Mbps • Many E-net technologies (cable, fiber, etc). But they all share common characteristics
Ethernet Frame Structure • Sending adapter encapsulates an IP datagram (or other network layer protocol packet) in Ethernet Frame which contains a Preamble, a Header, Data, and CRC fields • Preamble: 7 bytes with the pattern 10101010 followed by one byte with the pattern 10101011; used for synchronizing receiver to sender clock (clocks are never exact, some drift is highly likely) • Header contains Destination and Source Addresses and a Type field • Addresses: 6 bytes, frame is received by all adapters on a LAN and dropped if address does not match • Type: indicates the higher layer protocol, mostly IP but others may be supported such as Novell IPX and AppleTalk) • CRC: checked at receiver, if error is detected, the frame is simply dropped
Ethernet Technologies: 10Base2 • 10=>10Mbps; 2=>under 200 meters maximum length of a cable segment; also referred to as “Cheapnet” • Uses thin coaxial cable in a bus topology • Repeaters are used to connect multiple segments (up to 5); a repeater repeats the bits it hears on one interface to its other interfaces, ie a physical layer device only!
10BaseT and 100BaseT • 10/100 Mbps rate; latter called “Fast Ethernet” • T stands for Twisted Pair • Hub to which nodes are connected by twisted pair, thus “star topology” • CSMA/CD implemented at the Hub • Max distance from node to Hub is 100 meters • Hub can disconnect a “jabbering adapter”; 10base2 would not work if an adapter does not stop transmitting on the cable • Hub can gather monitoring information and statistics for display to LAN administrators
Gbit Ethernet • Use standard Ethernet frame format • Allows for Point-to-point links and shared broadcast channels • In shared mode, CSMA/CD is used; short distances between nodes to be efficient • Uses Hubs called here “Buffered Distributors” • Full-Duplex at 1 Gbps for point-to-point links
LAN Addresses and ARP • IP address: drives the packet to destination network • LAN (or MAC or Physical) address: drives the packet to the destination node’s LAN interface card (adapter card) on the LAN • 48 bit MAC address(for most LANs); burned in the adapter ROM
LAN Address (cont) • MAC address allocation administered by IEEE • A manufacturer buys a portion of the address space (to assure uniqueness) • MAC flat address structure => portability • IP hierarchical address NOT portable (need mobile IP) • Analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address • Broadcast LAN address: 1111………….1111
Packet Delivery • Delivery of a packet to a host or a router requires two levels of addressing • Logical => IP Addresses • Physical => MAC addresses • Mapping of a logical address to its corresponding physical address and vice versa is required
Mapping • Static mapping • a table stored in each machine on the network that associates a logical address with a physical address • Dynamic mapping • knowing one of the two (logical or physical) address; uses a protocol to find the other one • address resolution protocol (ARP) • reverse address resolution protocol (RARP)
ARP: Address Resolution Protocol • Each IP node (Host, Router) on the LAN has ARP module and Table • ARP Table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; TTL> < ……………………………………………….. > • TTL (Time To Live): timer, typically 20 min
ARP (cont) • Host A wants to send packet to destination IP addr XYZ on the same LAN • Source Host first checks own ARP Table for IP addr XYZ • If XYZ not in the ARP Table, ARP module broadcasts ARP pkt: < XYZ, MAC (?) > • ALL nodes on the LAN accept and inspect the ARP pkt • Node XYZ responds with unicast ARP pkt carrying own MAC addr: < XYZ, MAC (XYZ) > • MAC address cached in ARP Table
Routing Packets to another LAN • Say, route packet from source IP addr <111.111.111.111> to destination addr <222.222.222.222> • In routing table at source Host, find router 111.111.111.110 • In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc.
ARP • An IP datagram must be encapsulated in a frame to pass through the physical network. This requires the physical address of the receiver. • ARP associates an IP address with its physical address.
Obtaining the Physical Address • When the physical address of another host is required an ARP query packet is sent which includes • IP address of sender • IP address of the receiver • The intended recipient recognises its IP address and sends back an ARP response which contains the physical address.
Encapsulation An ARP message is encapsulated directly into a data link frame.
ARP functions • Sender knows IP address • IP asks ARP to create an ARP request message • sender physical address • sender IP address • target IP address • target physical address filled with 0's
ARP functions • Message passed to data link layer; destination address = broadcast address • All hosts receive frame; only target host accepts the packet • Target host replies (unicast) with an ARP reply message containing the physical address • Sender receives reply; it now knows the physical address of the target host • IP datagram's are now unicast to the destination host
Cache Table • A sender usually has more than one IP datagram to send to the same destination • It is inefficient to use ARP for each datagram • A cache table is used • limited size • mappings retained only for a limited time
RARP: Reverse ARP • Finds the logical address for a host that only knows its physical address • RARP request packets are broadcast; RARP reply packets are unicast • Used by diskless machines to obtain their IP addresses
Alternatives • BOOTP • DHCP • Offer additional information • subnet mask • IP address of a router • IP address of a name server
You now hopefully have: a good understanding of the data layer link protocols and issues ARP: Address Resolution Protocol RARP: Reverse Address Resolution Protocol Further Reading RFC:903 Reverse Address Resolution Protocol http://www.faqs.org/rfcs/rfc903.html RFC:826 An Ethernet Address Resolution Protocol http://www.faqs.org/rfcs/rfc826.html Summary