The Link Layer
Tom Kelliher, CS 325
May 2, 2011
Projects due Wednesday at beginning of class.
Two or more review questions due Friday morning.
Assignment VII due at beginning of exam on May 12.
- Multiple Access protocol -- CSMA/CD.
- Link layer addressing.
- Link layer switches.
Link layer exists between hosts on either side of a single link:
Unit of exchange is a packet/frame/datagram. Physical layer exchanges
Example technologies: Ethernet, ATM, 802.11.
Error detection/correction codes appended frame:
Link layer services:
- Framing -- encapsulation.
- Link access -- protocols for shared access links.
- Reliable delivery -- important for media with high error rates
- Flow control.
- Duplex -- half or full?
How do you control transmission in a shared access medium?:
A number of possible ideas:
- Take turns: fixed intervals, or a request protocol.
Time division multiplexing.
- Partition the bandwidth.
Frequency division multiplexing.
- Code division multiplexing.
- Random access protocols:
- Listen. If no stations sending, begin to send.
If a station is sending, wait a random amount of time, then listen
- Possible for two senders to begin sending. Action upon detection
Is it always possible to detect a sending collision?
- CSMA/CD -- Carrier Sense Multiple Access/Collision Detection:
- Sense media for idle state. If idle, begin transmitting.
If media isn't idle, backoff for a randomly chosen unit of time.
- How can collisions occur?
- Each network adapter has an eight byte MAC address:
% ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1A:A0:16:65:8B
inet addr:10.67.1.26 Bcast:10.67.1.255 Mask:255.255.255.0
inet6 addr: fe80::21a:a0ff:fe16:658b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:295533 errors:0 dropped:0 overruns:0 frame:0
TX packets:173558 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:139988511 (133.5 MiB) TX bytes:31578020 (30.1 MiB)
MAC addresses are ``unique.''
- Each host on a network has an IP address and a MAC address:
MAC addresses are not hierarchical, beyond vendor/adapter number
- So you want to send a datagram to IP address w.x.y.z. At the link layer,
you really need the MAC address. How do we get that?
An ARP cache:
Address HWtype HWaddress Flags Mask Iface
10.67.1.1 ether 00:13:5F:C4:B8:0A C eth0
shrike.goucher.edu ether 00:08:74:92:71:6B C eth0
goldfinch.goucher.edu ether 00:0B:DB:A7:EC:2A C eth0
ARP protocol screen capture.
(On web site.) Ping of kingfisher from bluebird. Note multiple protocols:
- DNS -- A record lookup.
- ARP -- broadcast request, single destination response.
- DNS -- PTR record lookup.
- ICMP -- echo request/reply.
- Trace an IP datagram from one network to the next:
Example: Send an HTTP request to a server on another subnet. (Resolver
target on same subnet.)
- Originally, Ethernet was a shared access medium using thinwire (10B2)
or thickwire (10B5) coaxial cabling:
- Then, we moved on to twisted-pair and hubs in a star topology:
Hubs are physical layer devices (re-generate and broadcast) -- still a
- Ethernet frame fields:
- Preamble (8 bytes): Used to synchronize receiver clocks with send
(Ethernet is asynchronous.)
- Type (2 bytes): Indicates which network layer protocol is
contained in the frame's payload.
- Data: 46 to 1,500 bytes. Short frames are padded to 46 bytes.
Padded bytes passed onto network layer.
(IP uses datagram length to ignore padding.)
- CRC (4 bytes): error detection.
- Ethernet's CSMA/CD uses exponential backoff and random choice after
- After 1st collision, wait
- After 2nd, wait
- After 3rd, wait
- Maximum is
- Ethernet standards exist at both link and physical layers:
- Switches are intelligent, link layer devices.
Store & forward.
Heterogeneous link speeds.
- Are transparent -- hosts aren't aware they're there.
Don't have MAC addresses.
- Learn about the network, to eliminate broadcasting frames meant for
- When a host first sends a frame, switch notes the source MAC
- Switch stores (MAC address, interface, timestamp) -tuples in a
Essentially, a small forwarding table.
Multiple MAC addresses may be associated with the same interface. Why?
- On receipt of a frame, lookup the destination MAC address in the
- If found, send the frame to the indicated interface.
- Otherwise, broadcast the frame.
- Timestamp used to purge stale entries.
Thomas P. Kelliher