Unit 3: MAC Sublayer and IP Addressing

CSE306 — Computer Networks 8 min read

I. Foundations of Shared-Medium Access and Addressing

The Medium Access Control (MAC) sublayer governs how devices share a common transmission medium, while Internet Protocol (IP) addressing identifies interfaces and enables packets to be routed between networks. MAC operates in the Data Link layer, whereas IP operates in the Network layer.

  • MAC sublayer: The lower part of the IEEE 802 Data Link layer; it controls medium access, frame construction, physical addressing, and error detection.
  • Shared medium: A channel used by multiple stations, such as a wireless frequency or a traditional bus Ethernet cable.
  • Collision: Simultaneous transmissions that overlap on a shared channel and corrupt one another.
  • MAC address: Usually a 48-bit Ethernet interface identifier, written as six hexadecimal octets, for example 00:1A:2B:3C:4D:5E.
  • IP address: A logical address assigned to a network interface; an IPv4 address contains 32 bits.
  • Network and host portions: The subnet mask or prefix length determines which IPv4 bits identify the network and which identify the host.
  • Encapsulation: An IP packet is carried inside a Data Link layer frame for transmission over a local network.
  • Core distinction: MAC addresses support local frame delivery, while IP addresses support logical identification and routing across interconnected networks.

II. Multiple Access Protocols

A. Multiple Access Protocols

Multiple Access Protocols coordinate transmissions when several independent stations compete for one broadcast channel.

  • Need for coordination: Without an access rule, stations may transmit simultaneously, causing collisions and reducing useful throughput.
  • Random-access protocols: Stations compete without fixed reservations.
    • Examples include ALOHA, CSMA, and CSMA/CD.
    • Collisions are handled through retransmission after a random delay.
  • Controlled-access protocols: Permission to transmit is explicitly coordinated.
    • Polling: A central controller invites each station to transmit.
    • Token passing: Only the station holding a special token may transmit.
    • Reservation: Stations reserve future channel slots before sending data.
  • Channelization protocols: The channel is divided among users.
    • FDMA separates users by frequency.
    • TDMA separates users by time slots.
    • CDMA separates users by distinguishable codes.
  • Evaluation criteria: A protocol is judged by throughput, access delay, fairness, collision rate, implementation cost, and performance under light and heavy traffic.
  • Propagation effect: Even when a station checks the channel, another distant station may have transmitted a signal that has not yet arrived.

III. ALOHA

A. ALOHA

ALOHA is a random-access protocol in which stations transmit independently and retransmit after collisions.

  1. Pure ALOHA: A station transmits whenever it has a frame.
    • Vulnerable period: A frame is destroyed if another frame begins within one frame time before or after its start; therefore, the vulnerable period is 2T.
    • Retransmission: After a collision is inferred, the station waits for a random backoff interval.
    • Throughput:
TEXT
S = G e^(-2G)
Smax = 1/(2e) ≈ 0.184

Here, S is successful frames per frame time, G is total attempted transmissions per frame time, and e is Euler’s number. Maximum utilization is approximately 18.4%.

  1. Slotted ALOHA: Transmission may begin only at synchronized slot boundaries.
    • Slot size: One slot equals one frame transmission time, T.
    • Vulnerable period: Restricting starts to boundaries reduces it from 2T to T.
    • Throughput:
TEXT
S = G e^(-G)
Smax = 1/e ≈ 0.368

Maximum utilization is approximately 36.8%.

  • Explicit contrast: Slotted ALOHA doubles the theoretical maximum efficiency of Pure ALOHA, but requires synchronization.
  • Limitation: Both versions waste bandwidth during collisions and perform poorly under heavy offered load.

IV. CSMA

A. CSMA

Carrier Sense Multiple Access (CSMA) improves random access by requiring a station to listen before transmitting.

  • Carrier sensing: A station checks whether the medium is idle; the principle is “listen before talk.”
  • Collision possibility: CSMA cannot eliminate collisions because propagation delay may prevent one station from hearing another station’s recent transmission.
  • 1-persistent CSMA: A station transmits immediately when the channel becomes idle.
    • If the channel is busy, it senses continuously.
    • Multiple waiting stations may transmit together as soon as the channel clears.
  • Non-persistent CSMA: A busy-channel station waits for a random time before sensing again.
    • It reduces simultaneous retransmissions but may increase delay.
  • p-persistent CSMA: On a slotted channel, an idle-channel station transmits with probability p and defers one slot with probability 1-p.
    • The process repeats until transmission occurs or another station becomes active.
  • Performance factors: Efficiency depends strongly on propagation time relative to frame transmission time.
TEXT
a = propagation time / frame transmission time

Here, a measures how quickly channel-state information spreads relative to the duration of a frame; smaller values generally improve performance.

V. CSMA/CD

A. CSMA/CD

Carrier Sense Multiple Access with Collision Detection (CSMA/CD) allows a transmitting station to detect a collision, stop, and retry later.

  • Operating sequence: A station senses the medium, transmits if idle, monitors while transmitting, and aborts if it detects a collision.
  • Jam signal: After detecting a collision, a station sends a short jam sequence so every participant recognizes the collision.
  • Collision window: A sender must continue transmitting long enough for a worst-case collision signal to travel to the farthest station and return.
TEXT
Minimum frame transmission time ≥ 2 × maximum propagation time
  • Binary exponential backoff: After the ith collision, Ethernet chooses a random integer K from a widening range and waits K slot times.
TEXT
K ∈ {0, 1, ..., 2^m - 1}
m = min(i, 10)

Here, i is the number of collisions for the frame and m limits range growth. Traditional Ethernet abandons transmission after 16 attempts.

  • Applicability: CSMA/CD was required by shared, half-duplex Ethernet using hubs or coaxial cable.
  • Modern limitation: Switched full-duplex Ethernet has separate send and receive paths, so collisions do not occur and CSMA/CD is disabled.

VI. Ethernet Protocol

A. Ethernet protocol

Ethernet is the dominant IEEE 802.3 LAN technology and defines MAC framing, medium access behavior, and physical transmission options.

  • Ethernet frame fields:
    • Preamble: 7 bytes used for receiver synchronization.
    • Start Frame Delimiter: 1 byte marking the frame’s beginning.
    • Destination address: 6-byte recipient MAC address.
    • Source address: 6-byte sender MAC address.
    • Type/Length: 2 bytes identifying the encapsulated protocol or payload length.
    • Data and padding: 46 to 1500 bytes in a standard frame.
    • Frame Check Sequence: 4-byte CRC used to detect transmission errors.
  • Frame size: From destination address through FCS, a standard frame is at least 64 bytes and normally at most 1518 bytes without VLAN tagging.
  • Address types: Ethernet supports unicast, multicast, and broadcast; the broadcast address is FF:FF:FF:FF:FF:FF.
  • Switch operation: A switch learns source MAC addresses and associates them with ports, then forwards frames according to its MAC address table.
  • Error handling: Ethernet detects damaged frames using CRC but does not repair or retransmit them at the MAC layer.
  • Interframe gap: Standard Ethernet requires an idle interval equivalent to 96 bit times between frames.

VII. Classful IP Addressing

A. Classful IP Addressing

Classful IP Addressing divides the IPv4 space into fixed classes whose leading bits determine the network and host boundaries.

  • Class A: Leading bit 0, first octet 1–126, and default mask /8 or 255.0.0.0.
    • It provides 24 host bits per network.
  • Class B: Leading bits 10, first octet 128–191, and default mask /16 or 255.255.0.0.
    • It provides 16 network bits and 16 host bits.
  • Class C: Leading bits 110, first octet 192–223, and default mask /24 or 255.255.255.0.
    • It provides 8 host bits per network.
  • Class D: First octet 224–239; reserved for multicast and not divided into conventional network and host fields.
  • Class E: First octet 240–255; reserved for experimental or special purposes.
  • Special range detail: 127.0.0.0/8 is reserved for loopback, while 0.0.0.0/8 has special “this network” meanings.
  • Host capacity:
TEXT
Usable hosts = 2^h - 2

Here, h is the number of host bits; two addresses are traditionally excluded as the network and directed-broadcast addresses.

  • Limitation: Fixed /8, /16, and /24 boundaries waste address space and make route aggregation inflexible.

VIII. Classless IP Addressing

A. Classless IP Addressing

Classless Inter-Domain Routing (CIDR) represents an IPv4 network using an address followed by an arbitrary prefix length.

  • CIDR notation: 192.168.10.0/26 means that the first 26 bits identify the network and the remaining 6 bits identify addresses within it.
  • Prefix mask: A /26 prefix has 26 consecutive 1 bits.
TEXT
/26 = 255.255.255.192
  • Block size:
TEXT
Total addresses = 2^(32 - p)

Here, p is the prefix length. A /26 therefore contains 2^6 = 64 total addresses and traditionally supports 62 hosts.

  • Route matching: Routers use longest-prefix matching; if both /16 and /24 routes match a destination, the more specific /24 route is selected.
  • Aggregation: Contiguous networks with a common leading-bit pattern can be advertised as one route, reducing routing-table size.
  • Classful contrast: CIDR ignores historical address classes; for example, a former Class C address may legitimately use /20, /27, or another valid prefix.
  • Allocation benefit: Organizations can receive blocks closer to their actual size instead of being forced into fixed class boundaries.

IX. Subnetting Examples

A. Subnetting examples

Subnetting divides one address block into smaller logical networks by extending the network prefix into the original host portion.

  • Given block: Divide 192.168.10.0/24 into at least four equal subnets.
  • Borrowed bits: Four subnets require two additional prefix bits because 2^2 = 4.
  • New prefix: /24 + 2 = /26, producing the mask 255.255.255.192.
  • Addresses per subnet: Each /26 block contains 2^(32-26) = 64 addresses, normally providing 62 usable host addresses.
  • Increment: The last mask octet is 192, so the subnet increment is:
TEXT
256 - 192 = 64
  • Resulting subnets:
Subnet Network address Usable host range Broadcast address
1 192.168.10.0/26 192.168.10.1–62 192.168.10.63
2 192.168.10.64/26 192.168.10.65–126 192.168.10.127
3 192.168.10.128/26 192.168.10.129–190 192.168.10.191
4 192.168.10.192/26 192.168.10.193–254 192.168.10.255
  • Identification rule: The network address has all host bits set to 0, while the broadcast address has all host bits set to 1.
  • Operational value: Subnetting limits broadcast domains, separates departments or security zones, and uses an allocated IPv4 block more systematically.