Upload
bridget-west
View
216
Download
0
Embed Size (px)
Citation preview
Data Link Layer
Moving Frames
Link Layer
• Protocols: ethernet, 802.11 wireless, 802.5 Token Ring and PPP
• Has node-to-node job of moving network layer datagrams over a single link in the path
• Protocol implemented in adapter/NIC
Possible services
• Framing: encapsulate network datagram into frame
• Link Access: Medium Access Control protocol describes who gets access when
• Reliable delivery: wireless links need this
• Flow control: response to limited buffering
• Error detection: done in hardware
• Half-duplex and full-duplex
Error Detection
• Parity check: use one bit; detects odd number of errors (even number undetected)
• Two dimensional parity: can detect and correct any one error
Error Detection
Cyclic Redundancy Check
• CRC codes also known as polynomial codes
• Agree on generator, G
• For given data D, choose r additional bits such that the resulting d+r bit pattern is exactly divisible by G
Multiple Access Protocols
• Broadcast link: more than one node on the (shared) channel wants to use the channel
• Categories:– Channel partitioning– Random access– Taking-turns
• S
Channel Partitioning
• TDM divides time into sections and further divides sections into (N) time slots; channel rate is R bps
• Eliminates collisions and is perfectly fair
• But: a node is limited to an average rate of R/N even if only node transmitting
• But: a node must always wait for its turn, even if only node transmitting
Code Division Multiple Access
• CDMA
• Assign a different code to each transmitting node; encode data bits; receiver can sort out correct transmission
• Used in wireless channels
Random Access
• Transmitting node at full channel rate• If collision, retransmit packet until packet
gets through without collision• Slotted ALOHA
– Node waits for beginning of next slot; transmits packet
– No collision; transmit another packet– Collision; retransmit [randomly] until success
• 1970
8
After all the math, the maximum efficiency of the protocol is 37% of Slots do useful work
In pure ALOHA, efficiency drops to 18%
Carrier Sense Multiple Access
• Listen before sending (carrier sensing)
• If collision, stop sending (collision detection)
• There are a lot of these that have been proposed
Taking-Turns Protocols
• Polling Protocol– Master node– Master polls each node in round-robin fashion– If master fails, the whole channel goes down
• Token-passing protocol– Small, special purpose frame = token– Can send frames if node has the token– Decentralized and highly efficient
MAC addresses
• Not the node, but the (NIC) adapter that has a link-layer address– LAN address– Physical Address– MAC address
• Permanent – burned into ROM• 6 bytes long; 3 for manufacturer, 3 for
adapter – expressed in Hex notation• IEEE manages address space
Addressing
• Frame includes destination MAC address
• Each adapter on LAN sees each frame– If address is a match, adapter sends frame up
the protocol stack in parent node– If address is not a match, adapter discards
frame
• Broadcast address is all ones (FF FF…)
Address Resolution Protocol
• We have both network addresses (IP) and link addresses (MAC); ARP does translation
• On same LAN
• ARP table stored in RAM
• TTL typically 20 minutes
• ARP query sent in broadcast frame; response in a standard frame
A
B
We want to get a frame from A to BIf our link address is 49-BD … we will never get out of 111 subnetWe have to use router’s E6-E9 address first (with IP 222.222)
Dynamic Host Configuration Protocol
• DHCP is a client/server protocol– Client is newly arriving host
• DHCP server discovery– UDP packet to port 67– Destination address 255.255 and source 0.0 (this host)– Frame has FF-FF destination address
• DHCP server offer(s)– Includes lease time– Link layer frame containing the IP datagram containing the UDP
segment containing the DHCP offer message is then sent
• DHCP request by client• DHCP ACK to client
Ethernet
• Ethernet has taken over the wired LAN market
• Bob Metcalf’s original bar napkin:
Ethernet Frame
• The sending adapter encapsulates the IP datagram within an ethernet frame and passes the frame to the physical layer…
• Preamble: 8 bytes, seven of 10101010 and one of 10101011
• Destination address: 6 bytes• Source address: 6 bytes (MAC address)• Type: IP, IPX, AppleTalk, ARP• Data: 46-1500 bytes• Cyclic Redundancy Check: 4 bytes
Ethernet
• Uses baseband transmission
• Connectionless service (like IP’s datagram and UDP’s segment)
• Unreliable service: adapter B runs CRC check; if pass frame handed to network layer; if fail, frame is discarded; no message back to adapter A
CSMA/CD
• An adapter may begin to transmit at any time (provided the channel is clear)
• Adapter never transmits when it senses that some other adapter is (carrier sense)
• Adapter aborts transmission as soon as it detects another adapter transmitting (collision detection) – sends 48-bit jam signal
• Before attempting retransmission, adapter waits a random time (typically small) [exponential backoff]
Ethernet Technologies
• Most common are 10BaseT and 100BaseT which use twisted pair copper wire in a star/bus topology
• Two wires for transmit; two for receive
• T is for twisted pair
• Maximum cable length is 100 meters
Hubs
• Physical layer device: simply senses bits and amplifies the signal to all ports
• Extends the collision domain
• Can also extend the reach of a LAN by 100 meters each
• Can only connect similar-speed LANs (10- or 100BaseT)
Switches
• Operate on ethernet frames – layer 2 devices
• Forward frames based on LAN destination addresses
• Switch does not have MAC addresses• Thanks to buffers, can connect differing
technologies (10Base2, 10BaseT, 100BaseT)
• Switches are self-learning
Now have three collision domains, thanks to switch
A to A’ at 10B to B’ at 10C to C’ at 10 for total of 30Mbps
Point-to-Point Protocol
• Used between modem and ISP; still have a lot of that
• Flag field• Address field (only 11111111)• Control field (only 11)• Protocol field (IP, AppleTalk, DECnet)• Information (packet)• Checksum (2 or 4 byte CRC)