MSDN Documentation

TCP/IP Protocol Suite

The Transmission Control Protocol/Internet Protocol (TCP/IP) suite is the foundation of the modern internet and is essential for network communication on Windows operating systems. This documentation provides a comprehensive overview of TCP/IP concepts, architecture, and implementation within the Windows environment.

Core Concepts

TCP/IP is a layered protocol suite, with each layer responsible for a specific aspect of network communication. The primary layers include:

  • Application Layer: Protocols like HTTP, FTP, SMTP, DNS.
  • Transport Layer: TCP (connection-oriented, reliable) and UDP (connectionless, unreliable).
  • Internet Layer: IP (addressing and routing), ICMP.
  • Network Access Layer: Ethernet, Wi-Fi, PPP.

TCP (Transmission Control Protocol)

TCP provides reliable, ordered, and error-checked delivery of a stream of octets between applications running on hosts communicating via an IP network.

Key Features of TCP:

  • Connection-Oriented: Establishes a connection before data transfer (three-way handshake).
  • Reliability: Uses acknowledgments (ACKs) and retransmissions to ensure data integrity.
  • Flow Control: Manages data transmission rate to prevent overwhelming the receiver.
  • Congestion Control: Adapts to network conditions to avoid congestion.
  • Ordered Delivery: Ensures data segments arrive in the correct sequence.

TCP Header Structure:

Field Description
Source Port 16 bits: Identifies the sender's port.
Destination Port 16 bits: Identifies the receiver's port.
Sequence Number 32 bits: The sequence number of the first data octet in this segment.
Acknowledgment Number 32 bits: If the ACK flag is set, this contains the value of the next expected octet.
Data Offset 4 bits: Specifies the size of the TCP header.
Reserved 6 bits: Reserved for future use.
Flags 6 bits: Control flags (SYN, ACK, FIN, RST, PSH, URG).
Window Size 16 bits: The number of data octets the sender is willing to accept.
Checksum 16 bits: Used for error checking.
Urgent Pointer 16 bits: Indicates where the urgent data ends.
Options Variable: Optional parameters like MSS, SACK.

IP (Internet Protocol)

IP is responsible for addressing, packaging, and routing data across networks. It is a connectionless protocol.

Key Features of IP:

  • Logical Addressing: Assigns unique IP addresses to devices.
  • Packet Switching: Data is broken into packets for transmission.
  • Best-Effort Delivery: Does not guarantee delivery, order, or error checking (handled by higher layers).
  • Routing: Determines the path packets take across networks.

IPv4 Header Structure (Simplified):

Field Description
Version 4 bits: Indicates IPv4.
Internet Header Length (IHL) 4 bits: Length of the IP header in 32-bit words.
Differentiated Services Code Point (DSCP) 6 bits: For Quality of Service (QoS).
Explicit Congestion Notification (ECN) 2 bits: For congestion notification.
Total Length 16 bits: Length of the entire IP datagram.
Identification 16 bits: Used to uniquely identify fragments of an IP datagram.
Flags 3 bits: Control flags (Reserved, Don't Fragment, More Fragments).
Fragment Offset 13 bits: Offset of a fragment relative to the beginning of the unfragmented datagram.
Time to Live (TTL) 8 bits: Maximum number of hops a datagram can take.
Protocol 8 bits: Identifies the next protocol (e.g., 6 for TCP, 17 for UDP).
Header Checksum 16 bits: Error checking for the IP header.
Source IP Address 32 bits: The IP address of the sender.
Destination IP Address 32 bits: The IP address of the receiver.

TCP/IP in Windows

Windows implements the TCP/IP stack to provide network connectivity. Key components include:

  • TCP/IP Properties: Configured through Network Connections or via DHCP.
  • Netsh Utility: A powerful command-line tool for configuring TCP/IP settings.
  • Winsock API: The standard interface for network programming on Windows.

Example: Basic Network Configuration

To configure a static IP address for an adapter named "Ethernet0" using netsh:

netsh interface ip set address "Ethernet0" static 192.168.1.100 255.255.255.0 192.168.1.1
netsh interface ip set dns "Ethernet0" static 8.8.8.8 primary
                

Example: Checking TCP/IP Connectivity

Use the ping and tracert utilities:

ping google.com
tracert google.com
                

Further Reading