Linklayer
data link layer
ethernet, wifi, fiber, telephony
transfer frames: ethernet, PPP, MAC address (add size, error correction codes)
- Inserts framing info to denote frame boundaries
- Inserts control, addressing and error correction info in header
- Detects transmission errors on link. May retransmit frames
- Activation, maintenance, & deactivation of link connection
- mission: transfer frames from one node, over a link
- scope: Service received from physical layer is the ability to move a bit across the link
- A packet is transferred by different link protocols over different links
- Each data link protocol provides different services
- addressing mechanism:MAC
- data types : frame
- responsibilities/services
addresses!!- Framing: encapsulate datagram into frame, adding header, trailer; identify source, destination with addresses • Different from IP
- Link access: use medium access control (MAC) protocol - Error Detection - Error Correction - Reliable Delivery: critical for wireless links ➙ high error rates
CSMA/CD
- Carrier Sense: Listen before talking Multiple Access: Broadcast Medium
- Collision Detection: Listen as you talk. If you hear someone else, be quiet
- Capturing a Channel: If no other station initiates transmission during this period, sender has captured the channel. t = tprop
- Ethernet is the most famous example
- Before transmitting, listen
- If channel is sensed idle, send the frame
- Else, defer transmission a random time
- If collision is detected, abort transmission
- reduces channel wastage
- Min transmission time must be long enough for collisions to propagate
- Length of the packet >= 2 Tp Bandwidth of the link worst case
ARP
- mission: Translate a network-layer address (IP) to a link-layer address (MAC), Similar to DNS
- frame fields:
- Sender Ethernet and IP address
- Target Ethernet and IP address
- transmission mechanism
- Sent in an Ethernet frame to a broadcast address
- ARP Reply takes the same form
- broadcast request, if some one know, reply
- if in another subnet, sent datagram to router
- caching
- Each Ethernet adapter uses a table to keep track of known mappings between IP addresses and Ethernet MAC Addrs
- When given IP address, ARP looks in ARP table and returns corresponding MAC address
- If IP not in table, queue frame and broadcast ARP request
- security
- ARP frames are not authenticateds
- May be spoofed by a malicious entity
- May be proxied by design
- gratuitous use
- ARP can be an “announcement” protocol
- Can send an ARP frame just to update other node’s ARP tables
- Set target address and sender address to the same value
csma/ca
- CSMA / Collision Avoidance
-
- Listen for a specified time (DIFS) If medium is not free:
-
- Exponential Backoff (下次请求的时间)
- If medium is free:
- Transmit entire frame
- Await ACK frame (AP send ACK to sender)
- If no ACK, then Exponential Backoff
- ACK
- protects against bit errors
- Receiver only sends ACK if frame passes CRC
- Exponential Backoff
- Each node chooses a random number
- Max size increases from round to round
- Can be modeled as a counter (wait time)
- Decremented during any idle time
- Put on hold if another node transmits and for a short time afterwards (SIFS)
- When zero, the counting station may transmit
Backlinks