How TCP/IP works
TCP/IP is the family of protocols that moves data across the internet and most private networks, also called the internet protocol suite. It takes its name from its two best-known members. The Internet Protocol (IP) gives every device an address and routes packets between networks. The Transmission Control Protocol (TCP) runs on top of IP and turns a stream of packets into a reliable, ordered connection between two applications.
Vint Cerf and Bob Kahn published the design in 1974. IPv4 was specified in RFC 791 and TCP in RFC 793 in 1981, and ARPANET switched over to TCP/IP on 1 January 1983. TCP is now defined in RFC 9293 and IPv6 in RFC 8200, both maintained by the Internet Engineering Task Force (IETF).
TCP/IP is independent of the physical network. The same IP packets travel over Ethernet, Wi-Fi, fiber and 4G or 5G, which is why it became the common language of computer networks.
The four layers of the TCP/IP model
The TCP/IP model splits networking into four layers, described in RFC 1122. Each layer adds its own header to the data and relies on the layer below to carry it.
| TCP/IP layer | OSI layers | Job | Example protocols | Typical device |
|---|---|---|---|---|
| Application | 5, 6, 7 | Data the user or program works with | HTTP, DNS, MQTT, OPC UA, Modbus TCP | Computer, controller |
| Transport | 4 | End-to-end delivery between applications | TCP, UDP | Computer, controller |
| Internet | 3 | Addressing and routing between networks | IPv4, IPv6, ICMP | Router, layer 3 switch |
| Link | 1, 2 | Moving frames across one physical link | Ethernet (IEEE 802.3), Wi-Fi (IEEE 802.11) | Switch, access point |
Some textbooks split the link layer into data link and physical layers to give a five-layer model. The four-layer version is the one the IETF uses.
TCP vs IP vs UDP
The three protocols do different jobs and are often confused.
-
//
IP. Delivers individual packets from one address to another, on a best-effort basis. It does not guarantee arrival or order.
-
//
TCP. Opens a connection with a three-way handshake (SYN, SYN-ACK, ACK), numbers every byte, acknowledges what arrives, resends what is lost and slows down when the network is congested. Used where every byte matters, such as web pages, file transfer and Modbus TCP.
-
//
UDP. Sends datagrams with no connection, acknowledgment or retransmission, defined in RFC 768. Lower overhead and delay make it the choice for video streaming, voice, DNS and many real-time industrial messages.
Ports and addresses
An IP address identifies a device, and a port number identifies the application on that device. Together they form a socket. Well-known ports are registered with IANA: HTTP uses 80, HTTPS 443, Modbus TCP 502, OPC UA 4840 and MQTT 1883, or 8883 with TLS. A firewall rule usually names the address, the port and whether it is TCP or UDP.
Inside a local network, switches forward frames by MAC address at the link layer, and routers or layer 3 switches forward packets between networks by IP address. Our explainer on how an Ethernet switch forwards traffic covers the link layer side.
How data moves through the layers
Sending data down the stack is called encapsulation. An application hands a message to TCP, which adds a header with the source and destination ports and a sequence number. IP adds a header with the source and destination IP addresses. Ethernet adds a header with MAC addresses and a trailer with a checksum, and the frame goes onto the wire.
Each device along the way reads only the header it needs. A switch reads the Ethernet header, and a router strips it, reads the IP header and builds a new Ethernet frame for the next link. The receiving computer removes each header in turn until the original message reaches the application.
TCP/IP vs the OSI model
The OSI model, published by ISO as ISO/IEC 7498-1, has seven layers and was intended as a full protocol suite of its own. TCP/IP was built first and won in practice, so OSI survives mainly as a reference model and a shared vocabulary, which is why engineers still talk about layer 2 and layer 3 switches.
The main differences are the number of layers and the approach. OSI separates session, presentation and application layers, while TCP/IP leaves all three to the application. OSI was designed as a specification before the protocols existed, while TCP/IP grew from protocols already running on ARPANET.
TCP/IP in industrial systems
Industrial Ethernet protocols sit on TCP/IP in different ways. Modbus TCP and OPC UA run over TCP. EtherNet/IP uses TCP for configuration and UDP for cyclic I/O data. MQTT, common for sending data from machines to the cloud, runs over TCP. PROFINET RT is an exception: its real-time frames skip IP entirely and travel directly in Ethernet frames, while configuration uses UDP/IP.
At the boundary between serial devices and IP networks, a gateway polls the serial side and passes the data on over TCP/IP. Our industrial IoT gateways combine serial ports with Ethernet and cellular links for this job, carrying readings from older equipment to SCADA and cloud systems.
Quick answers on TCP/IP
TCP/IP: common questions
What does TCP/IP stand for?
Transmission Control Protocol / Internet Protocol. The name covers the whole suite, which also includes UDP, ICMP, DNS and many more.
What are the layers of the TCP/IP model?
Link, internet, transport and application. Some sources split the link layer in two and describe a five-layer model.
Who invented TCP/IP?
Vint Cerf and Bob Kahn. They published the design in 1974, and ARPANET adopted TCP/IP on 1 January 1983.
What is the difference between TCP/IP and UDP?
UDP is part of TCP/IP. It is the connectionless alternative to TCP at the transport layer: faster and simpler, but with no delivery guarantee.
Why are protocols like TCP/IP important?
They let any device talk to any other. Because every system follows the same open standards, a sensor, a controller and a cloud server from different makers can exchange data.
We set up the IP addressing, firewall rules and industrial protocols on the computers, gateways and switches in every system we build, so the network is ready to connect when it arrives.