Day 3 : TCP/IP Model
Protocols and Standards:
- A protocol is a set of rules that defines how data should be communicated between devices over a network.
- “Language” computer uses to communicate
history
- Vint Cerf and Bob Kahn (working at DARPA) began developing TCP (Transmission Control Program) in 1974.
- Later divided into two protocols still used today:
- Transmission Control Protocol (TCP)
- Internet Protocol (IP)
Who defines standards?
- IEEE (Institute of Electrical and Electronics Engineers)
- Develops many of the technologies used on local area networks:
- Ethernet (802.3)
- Wi-Fi (802.11)
- IETF (Internet Engineering Task Force)
- Open community that defines protocols used on the Internet:
- TCP, IP, UDP, HTTP, DNS, etc.
- Publishes standards in documents called RFCs (Requests for Comments)
- Layered models
- Networks do different jobs to move data from one device to other like:
- Physical transmission of signals, local delivery on a LAN, routing traffic between networks, end-to-end conversations, applications, etc.
- A model lets us group related jobs into layers.
- Each layer has a specific role
- Each layer uses the services of the layer below and provides services to the layer above
- Protocols live(mostly) at one layer.
- e.g. IP, TCP, HTTP, etc.
- Together they form a stack of protocols that work as a team (the network stack)
From RFC 791, “Internet Protocol” (1981)

TCP/IP Model

Application layer (layer 5)
- Protocols for communication between application processes.
- Defines how application processes format, send and interpret data
- Prototols at this layer define message formats and rules for specific tasks, such as:
- browsing web pages (HTTP/HTTPS)
- Transferring files (FTP, TFTP)
- Sending/receiving email (SMTP, POP3, IMAP)
- Network infrastructure devices (routers, switches) don’t care about Application-layer details.
- They just move messages across the network.
- Only the communicating hosts interpret the data.
Transport layer (layer 4)
- Provides end-to-end communication between application processes using port numbers .
- also called process-to-process or service-to-service
- Runs mainly on the communicating hosts.
- Protocols at this layer include:
- UDP (User Datagram Protocol): simple and efficient
- TCP (Transmission Control Protocol): more robust features beyond basic message addressing
Internet layer (layer 3)
- Provides ene-to-end communication between hosts, using IP addresses and routers.
- Protocols at this layer include:
- IP (IPv4, IPv6)
- ICMP (Internet Control Message Protocol)
Local Network layer (layer 2)
- Provides hop-to-hop delivery of messages within a local network using MAC addresses and switches.
- A hop is one step along the path between two devices:
- from one router or host, to the next router or host in the path.
- switches don’t count: a switch just extends the local network, allowing multiple devices to connect.
- Uses MAC (Media Access Control) addresses to identify interfaces.
- Protocols at this layer include:
- Ethernet (IEEE 802.3)
- Wi-Fi (IEEE 802.11)
Physical layer (layer 1)
- Sends bits as electrical, optical, or radio signals over the physical medium.
- defines things like cables, connectors, signal levels and link speeds.
- e.g. copper UTP cables, fiber-optic cables, Wi-Fi radios and antenna, network interface cards(NICs),
Encapsulation & Decapsulation

- Application layer prepares the data to be sent over the network.
- As the messages moves down the stack, each layer encapsulates the data with a header including the information needed for that layer.
- source and destination addresses (port numbers, IP addresses, MAC addresses), etc.
- layer 2 also adds a trailer that the receiving device uses to check for transmission errors.
- Physical layer transmits the bits as signals over the physical medium.
- the L2 header is transmitted first, and the L2 trailer is transmitted last

- Receiving device receives the message as a stream of bits at Layer 1.
- The device examines the information in the Layer 2 header and trailer, and then removes them (decapsulation).
- The decapsulation process continues up the stack: Layer 3 removes the L3 header, then Layer 4 removes the L4 header, and then the data is delivered to the Application layer
- The application processes the data and, if needed, generates a response that goes back down the stack.
Protocol Data Units
At every stage of Encapsulation/Decapsulation process, there is a name given to the message:

- The combination of data and L4 header is called a segment(TCP) or datagram(UDP).
- TCP creates segments, UDP creates datagrams.

- The combination of segment/datagram and L3 header is called a packet.

- The combination of a packet and L2 header/trailer is called a frame.
- the is the exact thing sent over the wire.
Alternate name to describe message at each stage: Protocol Data Unit (PDU)
- A segment or datagram’s payload is the application data.
- A packet’s payload is a segment or datagram.
- A frame’s payload is a packet.
Adjacent-layer interaction
- Each layer provides a service to the layer above it, and is serviced by the layer below it (adjacent-layer interaction).
- e.g. Layer 4 provides a service to layer 5 by delivering data to the correct application using port numbers.
Same-layer interaction
- Each layer communicates with the same layer on other devices(same-layer interaction).
- e.g. Application layer on one host sends data to application layer on the other host.
Separation of layers
- Each layer has its own job and provides a specific service to the layers above.
- As long as each layer keeps its “contract” with the other layers, we can improve or replace protocols at different layers without redesigning everything.
- That flexibility is one of the main benefits of a layered model.
The OSI Model
- In late 1970s and 1980s, International Organization of Standardization(ISO) designed a 7 layer Open Systems Interconnection (OSI) model and a matching protocol suite.
- OSI protocols ended up being late and complex, and never gained the same deployment as TCP/IP.

7 Layers of OSI
Acronym:
Application : A > All
Presentation : P > People
Session : S > Seem
Transport : T > To
Network : N > Need
Data Link : D > Data
Physical : P > Processing
- 7.Application Layer
- Closest to the user. Provides network services directrly to software like browser, email client
- Protocols: HTTPS, DNS, FTP, SMTP, SSH etc.
- 6.Presentation Layer
- Acts as a translator. translates the data in different format and handles encryption, compression, character encoding
- Protocols: SSL/TLS (Encryption), JPEG,MPEG(Media format)
- 5.Session Layer
- Manages “dialogues” (sessions) between communicating hosts. It opens, maintains and terminates the communication sessions between local and remote applications.
- Protocols: NetBIOS, RPC(Remote Procedure Call), PPTP
- 4.Transport Layer
- Responsible for end-to-end communication and error recovery. Breaks large pieces of data into smaller segments.
- Protocols: TCP, UDP
- 3.Network Layer
- The “routing” layer. It determines best physical path for the data to take based on network conditions and IP addresses. Provides logical addressing (IP addresses)
- Provides connectivity between end hosts on different networks (i.e. outside LAN)
- Protocols: IP(IPv4/IPv6), ICMP(Ping), ARP(Address Resolution Protocol), IGMP, OSPF/BGP(Routing Protocols)
- 2.Data Link Layer
- Handles data trasfers between two directly connected nodes.
- Convert raw bits into structured frames
- Error correction from the physical layer
- manages MAC addresses
- Protocols: Ethernet(802.2), Wi-Fi(802.11), PPP (Point to Point Protocol)
- 1.Physical Layer
- The actual hardware level. It defines physical characteristics of the medium to transfer data, like, voltage levels, max transmission distance, physical connectors, cable specifications.
- Digital bits are converted to electrical (for wired connections) or radio (for wireless connection) signals
- Hardware/Standards: RJ45 connectors, Fiber Optics, Coaxial Cables
- Network engineers dont usually work with top 3 layers. Application developers work with the top layers to connect their applications over networks.
