layered communication layers work together encapsulation and deencapsulation
TRANSCRIPT
Layered Communication
Layers work together
Encapsulation and Deencapsulation
Indirect Communication• Application programs on different
machines cannot communicate directly– They are on different machines!
BrowserBrowser
TransTrans
IntInt
DLDL
PhyPhy
User PC
Web AppWeb App
TransTrans
IntInt
DLDL
PhyPhy
Webserver
HTTP RequestHTTP Request
Layer Cooperation on the Source Host
• Application layer process passes HTTP-request to transport layer process
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
HTTP RequestHTTP Request
PhysicalUser PC
Layer Cooperation on the Source Host
• Transport layer makes TCP segments– HTTP message is the data field– Adds TCP header fields shown earlier– Transport process “encapsulates” HTTP
request within a TCP segment
HTTP RequestHTTP Request TCP-HTCP-H
TCP Segment
DataField
TCPHeader
Encapsulation
• Encapsulation is delivering a message in the data field of another message– TCP encapsulates HTTP request messages
– Can also encapsulate other types of messages
HTTP RequestHTTP Request TCP-HTCP-H
TCP Segment
DataField
TCPHeader
Layer Cooperation on the Source Host
• Transport layer process passes the TCP segment down to the internet layer process
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
TCP segmentTCP segment
PhysicalUser PC
Layer Cooperation on the Source Host
• Internet Layer Process Encapsulates TCP Segment within an IP packet– An IP packet to deliver a TCP segment has a
TCP segment in its data field
TCP segmentTCP segment IP-HIP-H
Data IP Packet
DataField
IPHeader
Layer Cooperation on the Source Host
• The internet layer process passes the IP packet to the data link layer process– Internet layer messages are called packets
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
IP packetIP packet
PhysicalUser PC
Layer Cooperation on the Source Host
• Data Link Layer Encapsulates IP Packet Within a PPP Frame– Data link layer messages are called frames– Data PPP frame has IP packet in data field
PPP Frame Encapsulating an IP Packet
PPP-TPPP-T IP packetIP packet PPP-HPPP-H
Layer Cooperation on the Source Host• The data link layer process passes the PPP frame
to the physical layer process, which delivers it to the physical layer process on the first router, one bit at a time (no message at the physical layer)
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
Physical (10110 …)User PC
PPP framePPP frameTo firstrouter
PPP-TPPP-T
Layer Cooperation on the Source Host
• Recap: Adding Headers and Trailers:
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
HTTP msgHTTP msg
PhysicalUser PC
HTTP msgHTTP msg TCP-HTCP-H
HTTP msgHTTP msg TCP-HTCP-H IP-HIP-H
HTTP msgHTTP msg TCP-HTCP-H IP-HIP-H PPP-HPPP-H
Layer Cooperation on the Source Host
• Encapsulation in Layering– Whenever a process at Layer N (the application,
transport, internet, or data link layer) creates a message,
– That Layer N process passes the message down to the next-lower-layer process, the process at layer N-1
– The N-1 process encapsulates the Layer N message by placing it in the data field of a Layer N-1 message and adding headers and perhaps trailers to create the full Layer N-1 Message
Layer Cooperation on the Source Host
• Small but important detail on naming
• Layer 3 (internet) messages are called packets– IP message is a packet
• Layer 2 (data link) messages are called frames– PPP message is called a frame
Layer Cooperation: Destination Host• Destination host reverses processes on the
sending host– Delivers HTTP message to the webserver
application programApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
PhysicalUser PC Webserver
Layer Cooperation: Destination Host• Successively pass up layer messages
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
IP-PacketIP-Packet
DL-Frame (protocol unknown)containing IP packet in data field
DL-Frame (protocol unknown)containing IP packet in data field
PhysicalFinal Router Webserver
Data link layer program processes the data link frame’s header and trailer, deencapsulates the IP packet, and passes the IP packet to the next higher layer, the internet layer
Layer Cooperation: Destination Host• Successively pass up layer messages
– Other layers pass successive data fields (containing next-layer messages) up to the next higher layer
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
HTTP msgHTTP msg
TCP segmentTCP segment
IP-PacketIP-Packet
DL-Frame (protocol unknown)DL-Frame (protocol unknown)
PhysicalFinal Router Webserver
Layer Cooperation: Destination Host• Successively pass up layer messages
– Other layers process headers & trailers, pass up message in data field
ApplicationApplication
TransportTransport
InternetInternet
Data LinkData Link
PhysicalFinal Router Webserver
PPP-TPPP-T
HTTP msgHTTP msg
HTTP segHTTP seg TCP-HTCP-H
HTTP msgHTTP msg TCP-HTCP-H IP-HIP-H
HTTP msgHTTP msg TCP-HTCP-H IP-HIP-H PPP-HPPP-H
IP Packet
TCPsegment
HTTP msg
Indirect Communication
• Two processes on different machines cannot communicate directly with one another because they are physically separated
• So they communicate indirectly, using cooperation with lower layers
The First Router• First router receives an IP packet
(encapsulated in a frame) in one port (interface)
• Must make a router forwarding decision: select the port to use to send it back out
B?
D?
C?
Router A
B
C
DPacket
Layer Cooperation on the First Router• So far, we have only looked at hosts
– But deencapsulation and encapsulation also occur on EACH router
• Frame arrives at a port on the first router– Port’s data link layer process receives the
PPP frame containing an IP packet
Data LinkData Link Data LinkData Link
InternetInternet
PPP FramePPP Frame
First Router
Layer Cooperation on the First Router• Incoming Data Link Process on the Router
– Deencapsulates the IP packet from the PPP frame
– Passes the IP packet to the router’ internet layer process
Data LinkData Link Data LinkData Link
InternetInternetIP PacketIP Packet
First Router
Incoming Port on First Router
Layer Cooperation on the First Router• Routers only have physical, data link,
and internet layer processes– So internet layer process is the highest-layer
process on a router for router forwarding– Internet layer process decides where to send
the packet next: another router or the destination host
Data LinkData Link Data LinkData Link
InternetInternet
First Router
Layer Cooperation on the First Router• Internet layer process passes IP packet to
data link layer process on the selected output port that will carry the IP packet to the next router or the destination host
Data LinkData Link Data LinkData Link
InternetInternet
First Router
IP Packet
Selected Output Port on First Router
Layer Cooperation on the First Router
• The data link and physical layer process on the selected port sends the frame encapsulating the IP packet onto the next router (or destination host)
InternetInternet
Data LinkData Link
InternetInternet
Data LinkData LinkFrame
Selected Output PortOn First Router
Input PortOn Next Router
(Or Destination Host)
PhysicalLayer
Layer Cooperation on the First Router
• Notes• For router forwarding, routers only use
physical, data link, and internet processes• Routers First Receive Frames
– Receiving interface deencapsulates the IP packet, passes the packet to the internet layer process
• Routers Then Send Frames Out– On a different output interface (port)
– This requires encapsulating of the IP packet in a data link layer frame