CSCI.4220 Network Programming
Class 5,Thursday Feb 3, 2005
The Data Link Layer, (Primarily Ethernet)

An adapter is a board that typically contains RAM, DSP, a host bus interface, and a link interface (these are often called Network Interface Cards or NICs)

MAC layer addresses

It is not the node, but the node's interface card that has the address - three terms MAC layer, Physical layer, LAN address

Typically 6 bytes Unique on the planet - companies purchase blocks of 24 bit addresses ARP - address resolution Protocol (RFC 826) How does the sending node learn the MAC address of the receiver when it knows the IP address? Each node has an ARP table, which contains a mapping of IP addresses to MAC addresses. It also has an expiration date (TTL, shelf life). When the sender wants to send a packet, it first looks in its own ARP table. If not, it sends a special packet, an ARP packet, this has a number of fields Sender IP address
Sender MAC address
Receiver IP address
Receiver MAC address (initially set to broadcast FF-FF-FF-FF-FF-FF)

Request and response have the same format

Reply is send only to the sender.

ARP is plug and play. It does not require the sys admin to put data in a config table.

RARP - BOOTP - how does a diskless client learn its IP address. Similar to DHCP

Ethernet

Original ethernet used a bus, (with vampire connections) but modern installations use a star. At the center is a hub or switch. The ethernet header
Preamble     8 bytes 10101010 x7, then 10101011  This alows the 
   receiver to synchronize  Note that if the receiver is initially
   not synchronized and misses a byte, it hasn't lost anything.
   When it sees two 1s, it knows that the important stuff is coming.

Dest addr    6 bytes
Source Addr  6 bytes
Type         2 bytes (ethernet can multiplex several protocols,
             So this says that it is an IP packet
CRC          4 bytes
Data 46 to 1500
Ethernet is connectionless and unreliable.

CSMA/CD (Carrier sense multiple access with collision detection)

Binary exponential backoff

The padding is necessary to prevent a station from completing the transmission before the first bit has reached the far end, where it may collide with another frame

Collision detection. Each station detects if there is more power on the cable than they are transmitting, and if they are they send a noise burst.

Round trip time on modern ethernet is about 50 usec in the worst case (including repeaters) so a frame has to take at least that long. At 10 Mbps a bit takes 100 nsec, so 500 bits is the smallest frame that is guaranteed to work. This is rounded up to 512 bits (or 64 bytes) which explains the padding.

Performance is very good under low congestion, but collapses with heavy congestion.

Ethernet Technologies

In 2004, the most common ethernet technologies are 10BaseT, and 100 BaseT which use twisted pair copper in a star and have transmission rates of 10Mbps and 100Mbps. IEEE 802.3 Note that the hub is a physical layer interface that simply amplifies the bits and sends them out to everyone. But they can also provide some management features. If an adapter malfunctions and continuously sends frames, the hub can detect this and internally disconnect the malfunctioning adapter. Gigabit Ethernet and 10Gbit ethernet Essentially the same logic (and is backward compatible), but often instead of a hub, there is a switch.

Interconnections: Hubs and Switches

A hub can be used to connect two or more LANs. Often there is a backbone hub, that has point to point connections with the individual hubs

But usually all are in a common collision domain.

Hubs are physical layer devices. They know about volts but not headers. A switch operates on ethernet frames and thus are layer 2. A full-fledged packet switch forwards frames based on LAN addresses.

The switch needs a switching table, which is a mapping of MAC addresses and interfaces.

Self-Learning (Plug and Play)

  1. The switch table is initially empty
  2. When a frame arrives with a dest addr not in the table, the switch forwards copies to all of the interfaces.
  3. For each incoming frame, the switch stores in its table The MAC address of its source field.
    The Interface from which it arrived.
    The current time
  4. Items are deleted from the table if no frames are received from that source after a period of time (the aging time). Thus if a user replaces his adapter card with a new one, the old card is eventually dropped.
Here is a link to more than you ever wanted to know about Ethernet.

Here is a link to a good description of VLANs.

Token Ring

An alternative protocol for LANs developed by IBM in which the hosts are arranged in a ring and a token is passed around the ring. A host can only send a frame when it has the token.

Performance is somewhat worse than ethernet if there is little congestion, but in times of high congestion, ethernet collapses completely while token ring continues to work, although with decayed performance

PPP the point to point protocol

Used for dial-up PPP is a link layer protocol.
PPP data framing
A one byte flag 01111110
Address field - ALWAYS 11111111
Control field - always 00000011
Protocol - IP is 21, Appletalk is 29, DECnet is 27
The data
The checksum
Byte stuffing - the final byte is always 01111110 - what happens if this appears in the data - PPP uses byte stuffing - there is an escape char 011111101. This is inserted either before the end of data btye or the escape byte if they happen to appear in the data.