CMSC 137 Lecture Notes 2
CMSC 137 Lecture Notes 2
CMSC 137 Lecture Notes 2
LAYERED TASKS
• We use the concept of layers in our daily life. As an example, let us consider two friends who
communicate through postal mail.
• The process of sending a letter to a friend would be complex if there were no services available from
the post office.
• An ISO standard that covers all aspects of network communications is the Open Systems
Interconnection (OSI) model. It was first introduced in the late 1970s.
Physical layer
The physical layer is responsible for movements of individual bits from one hop (node) to the next.
The data link layer is responsible for moving frames from one hop (node) to the next.
Hop-to-hop delivery
Network layer
The network layer is responsible for the delivery of individual packets from the source host to the
destination host.
Source-to-destination delivery
Transport layer
The transport layer is responsible for the delivery of a segment from one process to another.
Session layer
Application layer
Summary of layers
◼ At the application layer, the data to be exchanged is referred to as a message. A message normally
does not contain any header or trailer, but if it does, we refer to the whole as the message. The
message is passed to the transport layer.
◼ The transport layer takes the message as the payload, the load that the transport layer should take
care of. It adds the transport layer header to the payload, which contains the identifiers of the
source and destination application programs that want to communicate plus some more
information that is needed for the end-to end delivery of the message, such as information needed
for flow, error control, or congestion control. The result is the transport-layer packet, which is called
the segment (in TCP) and the user datagram (in UDP). The transport layer then passes the packet to
the network layer.
◼ The network layer takes the transport-layer packet as data or payload and adds its own header to
the payload. The header contains the addresses of the source and destination hosts and some more
information used for error checking of the header, fragmentation information, and so on. The result
is the network-layer packet, called a datagram. The network layer then passes the packet to the
data-link layer.
◼ The data-link layer takes the network-layer packet as data or payload and adds its own header,
which contains the link-layer addresses of the host or the next hop (the router). The result is the
link-layer packet, which is called a frame. The frame is passed to the physical layer for transmission.
At the router, we have both decapsulation and encapsulation because the router is connected to two or
more links.
◼ After the set of bits are delivered to the data-link layer, this layer decapsulates the datagram from
the frame and passes it to the network layer.
◼ The network layer only inspects the source and destination addresses in the datagram header and
consults its forwarding table to find the next hop to which the datagram is to be delivered. The
contents of the datagram should not be changed by the network layer in the router unless there is a
need to fragment the datagram if it is too big to be passed through the next link. The datagram is
then passed to the data-link layer of the next link.
◼ The data-link layer of the next link encapsulates the datagram in a frame and passes it to the
physical layer for transmission.
Decapsulation at the Destination Host
◼ At the destination host, each layer only decapsulates the packet received, removes the payload, and
delivers the payload to the next-higher layer protocol until the message reaches the application
layer. It is necessary to say that decapsulation in the host involves error checking.
• The layers in the TCP/IP protocol suite do not exactly match those in the OSI model.
• The original TCP/IP protocol suite was defined as having four layers: host-to-network, internet,
transport, and application.
• However, when TCP/IP is compared to OSI, we can say that the TCP/IP protocol suite is made of five
layers: physical, data link, network, transport, and application.
◼ IP – Internet Protocol
ADDRESSING
Four levels of addresses are used in an internet employing the TCP/IP protocols:
• Physical
• Logical
• Port
• Specific
Addresses in TCP/IP
◼ 4 Layers ◼ 7 Layers
◼ Did not clearly distinguish between service, ◼ Distinction between these three concepts
interface and protocol. are explicit.
◼ Protocols in TCP/IP model are not hidden ◼ Protocols in the OSI model are better
and tough to replace if technology hidden than in the TCP/IP model and can
changes. be replaced relatively easily as the
◼ The protocols came first, and the model technology changes.
was really just a description of the existing ◼ The model was not biased toward one
protocols. particular set of protocols, a fact that made
◼ Designers have much experience with the it quite general.
subject and have clear idea of which ◼ Designers did not have much experience
functionality to put in which layer. with the subject and did not have a good
idea of which functionality to put in which
layer.
Example 2.1
In Figure 2.19 a node with physical address 10 sends a frame to a node with physical address 87. The two
nodes are connected by a link (bus topology LAN). As the figure shows, the computer with physical address
10 is the sender, and the computer with physical address 87 is the receiver.
Most local-area networks use a 48-bit (6-byte) physical address written as 12 hexadecimal digits; every byte
(2 hexadecimal digits) is separated by a colon, as shown below:
07:01:02:01:2C:4B
Example 2.3
Figure below shows a part of an internet with two routers connecting three LANs. Each device (computer or
router) has a pair of addresses (logical and physical) for each connection. In this case, each computer is
connected to only one link and therefore has only one pair of addresses. Each router, however, is connected
to three networks (only two are shown in the figure). So each router has three pairs of addresses, one for
each connection.
Example 2.4
Figure below shows two computers communicating via the Internet. The sending computer is running three
processes at this time with port addresses a, b, and c. The receiving computer is running two processes at
this time with port addresses j and k. Process a in the sending computer needs to communicate with process
j in the receiving computer. Note that although physical addresses change from hop to hop, logical and port
addresses remain the same from the source to destination.
Note: The physical addresses will change from hop to hop, but the logical and port addresses usually remain
the same.
Example 2.5
753