Layered Communication

advertisement
Layered Communication
Layers work together
Encapsulation and Deencapsulation
Indirect Communication
• Application programs on different
machines cannot communicate directly
– They are on different machines!
Browser
HTTP Request
Web App
Trans
Trans
Int
Int
DL
DL
Phy
Phy
User PC
Webserver
Layer Cooperation on the Source
Host
• Application layer process passes HTTPrequest to transport layer process
Application
HTTP Request
Transport
Internet
Data Link
User PC
Physical
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
TCP Segment
HTTP Request
TCP-H
Data
Field
TCP
Header
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
TCP Segment
HTTP Request
TCP-H
Data
Field
TCP
Header
Layer Cooperation on the Source Host
• Transport layer process passes the TCP
segment down to the internet layer process
Application
Transport
TCP segment
Internet
Data Link
User PC
Physical
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
Data IP Packet
TCP segment
IP-H
Data
Field
IP
Header
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
Application
Transport
Internet
IP packet
Data Link
User PC
Physical
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-T
IP packet
PPP-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)
Application
Transport
Internet
Data Link
User PC
PPP frame
Physical (10110 …)
To first
router
Layer Cooperation on the Source Host
• Recap: Adding Headers and Trailers:
Application
HTTP msg
Transport
HTTP msg
TCP-H
Internet
HTTP msg
TCP-H IP-H
HTTP msg
TCP-H IP-H PPP-H
Data Link
User PC
PPP-T
Physical
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 N1
– 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 program
Application
Transport
Internet
Data Link
User PC
Physical
Webserver
Layer Cooperation: Destination Host
• Successively pass up layer messages
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
IP-Packet
DL-Frame (protocol unknown)
containing IP packet in data field
Final Router
Physical
Application
Transport
Internet
Data Link
Webserver
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
HTTP msg
TCP segment
IP-Packet
DL-Frame (protocol unknown)
Final Router
Physical
Application
Transport
Internet
Data Link
Webserver
Layer Cooperation: Destination Host
• Successively pass up layer messages
– Other layers process headers & trailers, pass up
message in data field
Application
HTTP msg
HTTP msg
TCP
segment
HTTP seg
TCP-H
IP Packet
HTTP msg
TCP-H IP-H
PPP-T
HTTP msg
TCP-H IP-H PPP-H
Data Link
Physical
Webserver
Final Router
Transport
Internet
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
B?
D?
Router A
D
Packet
C?
C
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
Internet
PPP Frame
Data Link
Data Link
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
First Router
Internet
IP Packet
Data Link
Data Link
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
Internet
Data Link
Data Link
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
First Router
Internet
Data Link
IP Packet
Data Link
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)
Internet
Internet
Data Link
Data Link
Frame
Selected Output Port
On First Router
Physical
Layer
Input Port
On Next Router
(Or Destination Host)
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
Download