Updated on 02 Mar, 20269 mins read 14 views

What Is a Network Interface Card (NIC)?

A Network Interface Card (NIC) is a hardware component that enables a device (computer, printer, IoT device) to connect to a network. It operates primarily at:

  • Layer 1 (Physical Layer) – electrical/optical/radio signaling
  • Layer 2 (Data Link Layer) – framing, MAC addressing, error detection

Modern NICs also offload some higher-layer processing (Layer 3-4  and beyond).

NICs can be:

  • Wired Ethernet NICs
  • Wireless NICs (Wi-Fi adapters)
  • Integrated on motherboard (onboard LAN)
  • Expansion cards (PCIe)
  • USB adapters

Core Functions of a NIC

A NIC performs several critical tasks:

1 Physical Signaling (Layer 1)

  • Converts digital data into:
    • Electrical signals (Ethernet copper)
    • Optical signals (fiber)
    • Radio waves (Wi-Fi)
  • Handles:
    • Line encoding
    • Signal timing
    • Auto-negotiation (speed, duplex)
    • Link detection

2 MAC Addressing (Layer 2)

Each NIC has a unique MAC address (Media Access Control address), typically 48-bits (e.g., 00:1A:2B:3C:4D:5E).

MAC addresses:

  • Identify devices inside a LAN
  • Used for frame delivery within broadcast domain
  • Burned into hardware (but can be spoofed)

3 Frame Encapsulation & Decapsulation

When sending data:

  1. Data comes from upper layers (IP -> TCP/UDP -> Application)
  2. NIC wraps it into an Ethernet frame
  3. Adds:
    1. Destination MAC
    2. Source MAC
    3. EtherType
    4. Frame Check Sequence (FCS)
  4. Transmits onto network medium

When receiving data:

  1. Detects signal
  2. Convert to bits
  3. Validates FCS
  4. Check destination MAC
  5. Passes payload to OS networking stack

How NIC Works During Data Transmission

Let's walk through the entire process:

A. Sending Data (Outbound Traffic)

Step 1: Application Generates Data

Example: Browser requests a webpage

Step 2: OS Networking Stack Processes It

  • TCP adds headers
  • IP adds headers
  • ARP resolves MAC address

Step 3: OS Passes Frame to NIC Driver

  • Driver queues packet in transmit ring buffer

Step 4: DMA Transfer

NIC uses Direct Memory Access (DMA) to:

  • Read packet from system RAM
  • Avoid CPU copying overhead

Step 5: Frame Processing

NIC:

  • Adds preamble
  • Adds FCS (CRC checksum)
  • Applies encoding

Step 6: Physical Transmission

Signal sent via:

  • Ethernet cable
  • Fiber optic cable
  • Wireless antenna

B. Receiving Data (Inbound Traffic)

Step 1: Signal Detection

PHY detects incoming signal

Step 2: Bit Conversion

Analog -> digital conversion

Step 3: Frame Validation

  • Checks FCS
  • Verifies MAC address
  • Drops corrupted frames

Step 4: Buffering

Frame stored in RX buffer.

Step 5: Interrupt or Polling

NIC informs CPU via:

  • Interrupt (traditional)
  • NAPI polling (modern Linux)

Step 6: OS Stack Processing

Frame passed up:

  • Ethernet -> IP -> TCP/UDP -> Application

 

Buy Me A Coffee

Leave a comment

Your email address will not be published. Required fields are marked *