the OSI reference model and the TCP/IP model
are two open standard networking models that are very similar. However,
the latter has found more acceptance today and the TCP/IP protocol suite is
more commonly used. Just like the OSI reference model, the TCP/IP model takes a
layered approach. In this section we will look at all the layers of the TCP/IP
model and various protocols used in those layers.
The TCP/IP model is a condensed version of
the OSI reference model consisting of the following 4 layers:
·
Application Layer
·
Transport Layer
·
Internet Layer
·
Network Access Layer
·
The functions of these four layers are
comparable to the functions of the seven layers of the OSI model. Figure shows
the comparison between the layers of the two models.
·
The following sections discuss each of the
four layers and protocols in those layers in detail.
Figure Comparison between TCP/IP and
OSI models
Application
Layer
The Application Layer of the TCP/IP
Model consists of various protocols that perform all the functions of the OSI
model’s Application, Presentation and Session layers. This includes interaction
with the application, data translation and encoding, dialogue control and
communication coordination between systems.
The following are few of the most common
Application Layer protocols used today:
Telnet – Telnet is a
terminal emulation protocol used to access the resourses of a remote host. A
host, called the Telnet server, runs a telnet server application (or daemon in
Unix terms) that receives a connection from a remote host called the Telnet
client.
HTTP – The Hypertext Transfer Protocol is foundation of the
World Wide Web. It is used to transfer Webpages and such resources from the Web
Server or HTTP server to the Web Client or the HTTP client.
FTP – File Transfer
Protocol is a protocol used for transferring files between two hosts. Just like
telnet and HTTP, one host runs the FTP server application (or daemon) and is
called the FTP server while the FTP client runs the FTP client application.
SMTP – Simple Mail Transfer Protocol is used to send e-mails.
When you configure an email client to send e-mails you are using SMTP. The mail
client acts as a SMTP client here.
TFTP – Trivial File Transfer Protocol is a stripped down
version of FTP. Where FTP allows a user to see a directory listing and perform
some directory related functions, TFTP only allows sending and receiving of
files.
DNS – Every host in a network has a logical address called
the IP address (discussed
later in the chapter). These addresses are a bunch of numbers.
DHCP – As you know, every host requires a logical address
such as an IP address to communicate in a network. The host gets this logical
address either by manual configuration or by a protocol such as Dynamic Host
Configuration Protocol (DHCP).
Transport Layer
The protocols discussed above are few of the
protocols available in the Application layer. There are many more protocols
available. All of them take the user data and add a header and pass it down to
the Transport layer to be sent across the network to the destination. The TCP/IP
transport layer’s function is same as the OSI layer’s transport layer. It is
concerned with end-to-end transportation of data and setups up a logical
connection between the hosts.
Two protocols available in this layer are
Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).
Transport Control Protocol (TCP)
TCP
is one of the original protocols designed in the TCP/IP suite and hence the
name of the model. When the application layer needs to send large amount of
data, it sends the data down to the transport layer for TCP or UDP to transport
it across the network. TCP first sets up a virtual-circuit between the source
and the destination in a process called three-way handshake. Then it
breaks down the data into chunks called segments, adds a header to each
segment and sends them to the Internet layer.
The TCP header
is 20 to 24 bytes in size and the format is shown in Figure 1-11. It is not
necessary to remember all fields or their size but most of the fields are
discussed below.
Figure TCP header
Connection
Establishment – TCP uses a process called three-way handshake to establish
a connection or virtual-circuit with the destination. The three-way handshake
uses the SYN and ACK flags in the Code Bits section of the
header. This process is necessary to initialize the sequence and
acknowledgement number fields. These fields are important for TCP and will be
discussed below.
Figure TCP three-way handshake
User Datagram Protocol (UDP)
The
only thing common between TCP and UDP is that they use port numbers to transport
traffic. Unlike TCP, UDP neither establishes a connection nor does it provide
reliable delivery. UDP is connectionless and unreliable protocol
that delivers data without overheads associated with TCP. The UDP header
contains only four parameters (Source port, Destination Port, Length and
Checksum) and is 8 bytes in size.
At this stage
you might think that TCP is a better protocol than UDP since it is
reliable. However you have to consider that networks now are far more
stable than when these protocols where conceived. TCP has a higher overhead
with a larger header and acknowledgements. The source also holds data till it
receives acknowledgement. This creates a delay. Some applications, especially
those that deal with voice and video, require fast transport and take care of
the reliability themselves at the application layer. Hence in lot of cases UDP
is a better choice than TCP.
Internet
Layer
Once TCP and
UDP have segmented the data and have added their headers, they send the segment
down to the Network layer. The destination host may reside in a different
network far from the host divided by multiple routers. It is the task of the
Internet Layer to ensure that the segment is moved across the networks to the
destination network.
The
Internet layer of the TCP/IP model corresponds to the Network layer of the OSI
reference model in function. It provides logical addressing, path determination
and forwarding.
The Internet
Protocol (IP) is the most common protocol that provides these services.
Also working at this layer are routing protocols which help routers learn about
different networks they can reach and the Internet Control Message Protocol
(ICMP) that is used to send error messages across at this layer.
Almost half of
the book is dedicated IP and Routing protocols so they will be discussed in
detail in later chapters, but the following sections discuss these protocols in
brief.
Internet Protocol (IP)
The
Internet layer in the TCP/IP model is dominated by IP with other protocols
supporting its purpose. Each host in a network and all interfaces of a router
have a logical address called the IP address. All hosts in a network are
grouped in a single IP address range similar to a street address with
each host having a unique address from that range similar to a house or mailbox
address. Each network has a different address range and routers that operate on
layer 3 connect these different networks.
As
IP receives segments from TCP or UDP, it adds a header with source IP address
and destination IP address amongst other information. This PDU is called a packet. When
a router receives a packet, it looks at the destination address in the header
and forwards it towards the destination network. The packet may need to go
through multiple routers before it reaches the destination network. Each router
it has to go through is called a hop.
Figure Packet flow in internetwork
Consider the
Internetwork shown in Figure 1-14 to understand the routing process better.
When Host1 needs to send data to Host2, it does not get routed because the
hosts are in the same network range. The Data Link layer takes care of this.
Now consider Host1 sending data to Host3. Host1 will recognize that it needs to
reach a host in another network and will forward the packet to Router1. Router1
checks the destination address and knows that the destination network is toward
Router2 and hence forwards it to Router2. Similarly Router 2 forwards the
packet to Router3. Router3 is directly connected to the destination network.
Here the data link layer takes care of the delivery to the destination host. As
you can see, the IP address fields in the IP header play a very important role
in this process. In fact IP addresses are so important in a network that the
next Chapter is entirely dedicated to it!
Figure IPv4 Header
There
are various versions of the Internet Protocol. Version 4 is the one used today
and version 6 is slowly starting to replace it which is why it’s presence has
increased on the CCNA Routing & Switching 200-120 exam compared to previous
CCNA exam versions. Figure 1-15 shows the header structure of IPv4.
Routing
Protocols
Router1 knew
that it needed to send the packet destined to Host3 toward Router2. Router2 in
turn knew that the packet needed to go toward Router3. To make these decisions,
the routers need to build their routing table. This is a table of all
networks known by it and all the routers in the internetwork. The table also
lists the next router towards the destination network. To build this table
dynamically, routers use routing protocols. There are many routing protocols
and their sole purpose is to ensure that routers know about all the networks
and the best path to any network. Chapter 4 and Chapter 5 discuss the routing
process and some routing protocols in detail.
Internet
Control Message Protocol (ICMP)
ICMP is essentially a management protocol and messaging service for
IP. Whenever IP encounters an error, it sends ICMP data as an IP packet.
Some of the reasons why an ICMP message can be generated are:
Destination
Network Unreachable – If a packet cannot be routed to the network in which
the destination address resides, the router will drop the packet and generate
an ICMP message back to the source informing that the destination network is
unreachable.
Time Exceeded – If
the TTL of a packet expiries (reduces to zero), the router will drop it and
generate an ICMP message back to the source informing it that the time exceeded
and the packet could not be delivered.
Echo Reply – ICMP
can be used to check network connectivity. Popular utility called Ping is
used to send Echo Requests to a destination. In reply to the request,
the destination will send back an Echo reply back to the source. Successful
receipt of Echo reply shows that the destination host is available and reachable
from the source.
Network Access
Layer
The Network Access layer of the TCP/IP model
corresponds with the Data Link and Physical layers of the OSI reference model.
It defines the protocols and hardware required to connect a host to a physical
network and to deliver data across it. Packets from the Internet layer are sent
down the Network Access layer for delivery within the physical network. The
destination can be another host in the network, itself, or a router for further
forwarding. So the Internet layer has a view of the entire Internetwork whereas
the Network Access layer is limited to the physical layer boundary that is
often defined by a layer 3 device such as a router.
The Network
Access layer consists of a large number of protocols. When the physical network
is a LAN, Ethernetat its many variations are the most common protocols
used. On the other hand when the physical network is a WAN, protocols such as
the Point-to-Point Protocol (PPP) and Frame Relay are
common. In this section we take a deep look at Ethernet and its variations. WAN
protocols are covered in detail in Chapter 11.
Before we explore Ethernet remember that:
Network Access layer uses a physical address
to identify hosts and to deliver data.
·
The Network Access layer PDU is called a frame.
It contains the IP packet as well as a protocol header and trailer from this
layer.
·
The Network Access layer header and trailer
are only relevant in the physical network. When a router receives a frame, it
strips of the header and trailer and adds a new header and trailer before
sending it out the next physical network towards the destination.