- Networks are complex -> Hardware : hosts, routers, links of various media -> Software : applications, protocols
- A layered architecture allows us to simplify with modularity a well-defined, specific part of a large and complex system
- Ability to change the implementation of a service without affecting other components of the system

Layers: each layer implements a service -> via its own internal-layer actions -> relying on services provided by layer below
- Explicit structures allows identification(Ex: bugs) and relationship of complex system pieces -> layered reference model for discussion
- Modularization eases maintenance, updating of system -> change of implementation of layer's service transparent to rest of system ->change in gate procedure doesn't affect rest of system
Protocol Layering
Service Model -> services that a layer offers to the layer above
- A protocol layer can be implemented in software, in hardware, or in a combination of the two
Protocol Stack
Applications Layer: -> Includes many protocols that support network applications: - HTTP (provides for Web document request and transfer) - SMTP (provides for the transfer of e-mail messages) - FTP (provides for the transfer of files between two end systems) -> almost always implemented in software in the end systems -> end systems exchange packets of information with protocols trough each others applications
Transport Layer (Segment): -> transports application-layer messages between application endpoint -> Transport Protocols: - TCP: provides a connection-oriented service to its applications through guaranteed delivery and flow control. Also breaks long messages into shorter segments and provides a congestion-control mechanism. Prioritizes reliability guaranteeing delivery - UDP: provides a connectionless service to its application. No-frills service that provides no reliability, no flow control, and no congestion control. Prioritizes speed not guaranteeing delivery -> almost always implemented in software in the end systems
Network Layer (IP Layer): -> routing of datagrams(network-layer packets) from source to destination through: - IP : defines the fields in the datagrams and how the end systems act on them, does fragmentation when message larger than MTU - Routing protocols : determine the routes that datagrams 4take -> the transport layer protocol in a source host passes a transport-layer segment and destination to network layer (like in a postal service) -> the network layer then delivers the the segment to the transport layer in the destination host -> Uses logical addressing (like IP addresses) to determine the best path for data to travel across multiple networks. -> often a mixed implementation of hardware and software
Link Layer (frame): -> To move a packet from one node (host or router) to the next node in the route, the network layer relies on the services of the link layer -> data transfer between neighboring network elements (PPP, Ethernet, WIFI, cable access network’s DOCSIS protocol) -> Handles error detection, framing, and MAC (Media Access Control) addressing. -> Ensures that data is reliably transferred between two directly connected devices. -> a datagram may be handled by different link-layer protocols at different links along its route (EX: Ethernet on one link and PPP on the next link) -> responsible for handling communication over a specific link -> link-layer packets = frames
Physical Layer: -> transmission of raw bits through wires or signals -> responsible for handling communication over a specific link -> The protocols are link dependent and further depend on the actual transmission medium of the link (twisted-pair copper wire, single-mode fiber optics)

Summary
- Physical Layer -> Moves raw data through wires or signals.
- Link Layer → Ensures error-free transmission between two directly connected devices.
- Network Layer -> Finds the best way to send data from one network to another.
- Transport Layer -> Ensures end-to-end communication between devices. It manages how data is broken down and reassembled.
- Application Layer -> Directly interacts with applications and users. This is where web browsers, email clients, and messaging apps operate.
Layering Drawbacks: -> One layer may duplicate lower-layer functionality -> One layer may need information (for example, a timestamp value) that is present only in another layer
- ICMP (ping)
1.5.2 - Encapsulation

-
link-layer switches only have access to link and physical network
-
Routers have access to physical, link and network layers. Therefore being capable of implementing the IP protocol
-
H stands for header: -> M -> message (packet at the application lever) -> Ht -> tansport header (Ht + M = segment (packet at the transport layer)) ->Hn -> network header (Hn + Ht + M = datagram (packet at the network layer)) -> Hl -> link header (Hl + Hn + Ht + M = frame (packet at the link layer))
-
At each layer, a packet has two types of fields: header fields and a payload field (packet from the layer above)
-
the physical layer modulates the bits into the physical media. Arriving at the router's physical layer that modulates it back into digital bits
-
After the link layer at the router does what it is supposed to do, it losses the Hl.
-
It gets up to the network layer, does what it is supposed to do and appends the new Hn. Then it goes down again to the link layer where it gets the new Hl
-
Is again modulated into analog signal at the physical layer and parts to the destination host. Being once again modulated to digital signal
-
It continues going up losing the respective headers at the respective layers until it is again a message at the application layer