tcp/ip training basic concepts
TRANSCRIPT
TCP/IP Protocol Suite 1
TCP/IP Protocol Suite
معرفي پروتكلهاي TCP/IP
ارائه دهندهاميرحسين پناهي
1391خرداد
بنام خدا
TCP/IP Protocol Suite 2
The OSI Model
Established in 1947, the International Standards Organization (ISO) is
a multinational body dedicated to worldwide agreement on
international standards. 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.
The topics discussed in this section include:
Layered Architecture
Peer-to-Peer Processes
Encapsulation
TCP/IP Protocol Suite 3
ISO is the organization.
OSI is the model
Note:
TCP/IP Protocol Suite 4
The OSI model
TCP/IP Protocol Suite 5
OSI layers
TCP/IP Protocol Suite 6
An exchange using the OSI model
TCP/IP Protocol Suite 7
Layers in the OSI Model
The functions of each layer in the OSI model is briefly described.
The topics discussed in this section include:
Physical Layer
Data Link LayerNetwork LayerTransport LayerSession Layer
Presentation LayerApplication LayerSummary of Layers
TCP/IP Protocol Suite 8
The physical layer is responsible for Movement of individual bits from
one hop (node) to the next.
•Includes electrical and mechanical connection features
•Determines bit rates
•Should be synchronized in transmission clock
•Transmission modes: Simplex, Half and Full duplex
Note:
Physical layer
TCP/IP Protocol Suite 9TCP/IP Protocol Suite 9
The data link layer is responsible for moving frames from one hop (node) to the next
•Framing
•Physical addressing
•Flow control
•Bit error control
•Access control in shared link(CSMA/CD/CA)
Note:
Data link layer
TCP/IP Protocol Suite 10
CSMA/CA
TCP/IP Protocol Suite 11
Hop-to-hop delivery
TCP/IP Protocol Suite 12
The network layer is responsible for the delivery of individual
packets from the source host to the destination host.
•Physical addressing
•Routing
Network layer
Note:
TCP/IP Protocol Suite 13
Source-to-destination delivery
TCP/IP Protocol Suite 14
The transport layer is responsible for the delivery of a message from one process to
another.
•Port addressing (Process Addressing)
•Segmentation and Reassembly by sequencing
•Connection control (connection-less/connection-oriented)
• flow control (window size)
•Error control (Acknowledgement)
Note:
Transport layer
TCP/IP Protocol Suite 15
The Session layer is responsible for synchronization of a message
•Synchronization point insertion and deletion for integrity
validation of message
•Dialog control by changing mode of transmission (half/full duplex)
Note:
Session layer
TCP/IP Protocol Suite 16
The presentation layer is responsible for:
•Translation (coding/decoding)
•Encryption/Decryption
•Compression/Decompression
Note:
Presentation layer
TCP/IP Protocol Suite 17
Application layer
TCP/IP Protocol Suite 18
Summary of layers
TCP/IP Protocol Suite 19
TCP/IP Protocol Suite
The TCP/IP protocol suite is made of five layers: physical, data link,
network, transport, and application. The first four layers provide
physical standards, network interface, internetworking, and transport
functions that correspond to the first four layers of the OSI model. The
three topmost layers in the OSI model, however, are represented in
TCP/IP by a single layer called the application layer.
The topics discussed in this section include:
Physical and Data Link Layers
Network Layer
Transport Layer
Application Layer
TCP/IP Protocol Suite 20
TCP/IP and OSI model
TCP/IP Protocol Suite 21
Addressing
Three different levels of addresses are used in an internet using the
TCP/IP protocols: physical (link) address, logical (IP) address, and
port address.
The topics discussed in this section include:
Physical Address
Logical Address
Port Address
TCP/IP Protocol Suite 22
Relationship of layers and addresses in TCP/IP
TCP/IP Protocol Suite 23
Physical addresses
In Figure a node with physical address 10 sends a frame to a node with physical
address 87. The two nodes are connected by a link. At the data link level this
frame contains physical (link) addresses in the header. These are the only
addresses needed. The rest of the header contains other information needed at
this level. The trailer usually contains extra bits needed for error detection.
07:01:02:01:2C:4B
A 6-byte (12 hexadecimal digits) physical address.
TCP/IP Protocol Suite 24
IP addresses
•In Figure we want to send data from a node
with network address A and physical
address 10, located on one LAN, to a node
with a network address P and physical
address 95, located on another LAN.
Because the two devices are located on
different networks, we cannot use link
addresses only; the link addresses have only
local jurisdiction. What we need here are
universal addresses that can pass through
the LAN boundaries. The network (logical)
addresses have this characteristic.
•The packet at the network layer contains
the logical addresses, which remain the
same from the original source to the final
destination (A and P, respectively, in the
figure). They will not change when we go
from network to network. However, the
physical addresses will change as the packet
moves from one network to another. The
boxes labeled routers are internetworking
devices.
132.24.75.9
An internet address in IPv4 in decimal
numbers
TCP/IP Protocol Suite 25
Figure 2.20 Port addresses
753
A 16-bit port address represented
as one single number.
TCP/IP Protocol Suite 26
•Figure shows an example of transport layer communication. Data
coming from the upper layers have port addresses j and k ( j is the
address of the sending process, and k is the address of the receiving
process). Since the data size is larger than the network layer can handle,
the data are split into two packets, each packet retaining the service-point
addresses ( j and k). Then in the network layer, network addresses (A and
P) are added to each packet.
•The packets can travel on different paths and arrive at the destination
either in order or out of order. The two packets are delivered to the
destination transport layer, which is responsible for removing the
network layer headers and combining the two pieces of data for delivery
to the upper layers
Port addresses
TCP/IP Protocol Suite 27
IP Versions
IP became the official protocol for the Internet in 1983. As the Internet
has evolved, so has IP. There have been six versions since its inception.
We look at the latter three versions here.
The topics discussed in this section include:
Version 4
Version 5
Version 6
TCP/IP Protocol Suite 28
Connecting Devices
LANs or WANs do not normally operate in isolation. They are
connected to one another or to the Internet. To connect LANs or
WANs, we use connecting devices. Connecting devices can operate in
different layers of the Internet model. We discuss three kinds of
connecting devices: repeaters (or hubs), bridges (or two-layer
switches), and routers (or three-layer switches). Repeaters and hubs
operate in the first layer of the Internet model. Bridges and two-layer
switches operate in the first two layers. Routers and three-layer
switches operate in the first three layers
The topics discussed in this section include:
Repeaters
Hubs
Bridges
Router
TCP/IP Protocol Suite 29
Figure 3.28 Connecting devices
TCP/IP Protocol Suite 30
Figure 3.29 Repeater
TCP/IP Protocol Suite 31
A repeater connects segments of a LAN.
Notes:
A repeater forwards every bit;
it has no filtering capability.
A repeater is a regenerator, not an amplifier.
TCP/IP Protocol Suite 32
Figure 3.30 Function of a repeater
TCP/IP Protocol Suite 33
A bridge has a table used in filtering
decisions.
Note:
TCP/IP Protocol Suite 34
Figure 3.31 Bridge
TCP/IP Protocol Suite 35
A bridge does not change the physical
(MAC) addresses in a frame.
Note:
TCP/IP Protocol Suite 36
Figure 3.32 Learning bridge
TCP/IP Protocol Suite 37
A router is a three-layer
(physical, data link, and network)
device.
Note:
TCP/IP Protocol Suite 38
A repeater or a bridge connects segments
of a LAN.
A router connects independent LANs or
WANs to create an internetwork
(internet).
Note:
TCP/IP Protocol Suite 39
Figure 3.33 Routing example
TCP/IP Protocol Suite 40
A router changes the physical addresses
in a packet.
Note:
TCP/IP Protocol Suite 41
CLASSFUL ADDRESSING
IP addresses, when started a few decades ago, used the concept of
classes. This architecture is called classful addressing. In the mid-
1990s, a new architecture, called classless addressing, was introduced
and will eventually supersede the original architecture. However, part
of the Internet is still using classful addressing, but the migration is
very fast.
TCP/IP Protocol Suite 42
Finding the class in binary notation
TCP/IP Protocol Suite 43
Finding the class in decimal notation
TCP/IP Protocol Suite 44
Netid and hostid
TCP/IP Protocol Suite 45
Masking concept
Default masks
TCP/IP Protocol Suite 46
The network address is the beginning
address of each block. It can be found
by applying the default mask to any
of the addresses in the block
(including itself). It retains the netid
of the block and sets the hostid to
zero.
Note:
TCP/IP Protocol Suite 47
Upon completion you will be able to:
ARP and RARP
• Understand the need for ARP
• Understand the cases in which ARP is used
• Understand the components and interactions in an ARP
package
• Understand the need for RARP
Objectives
TCP/IP Protocol Suite 48
ARP and RARP - Position in TCP/IP protocol suite
TCP/IP Protocol Suite 49
ARP
ARP associates an IP address with its physical address. On a typical physical network,
such as a LAN, each device on a link is identified by a physical or station address that is
usually imprinted on the NIC.
TCP/IP Protocol Suite 50
ARP packet / Encapsulation of ARP
TCP/IP Protocol Suite 51
Four cases using ARP
TCP/IP Protocol Suite 52
An ARP request is broadcast;
an ARP reply is unicast.
Note:
TCP/IP Protocol Suite 53
ARP Request/Reply packet Example
TCP/IP Protocol Suite 54
Proxy ARP
TCP/IP Protocol Suite 55
RARP
RARP finds the logical address for a machine that only knows its
physical address.
TCP/IP Protocol Suite 56
The RARP request packets are
broadcast;
the RARP reply packets are unicast.
Note:
TCP/IP Protocol Suite 57
RARP packet / Encapsulation of RARP packet
TCP/IP Protocol Suite 58
Upon completion you will be able to:
Internet Protocol
• Understand the format and fields of a datagram
• Understand the need for fragmentation and the fields involved
• Understand the options available in an IP datagram
• Be able to perform a checksum calculation
• Understand the components and interactions of an IP package
Objectives
TCP/IP Protocol Suite 59
Position of IP in TCP/IP protocol suite
TCP/IP Protocol Suite 60
DATAGRAM
A packet in the IP layer is called a datagram, a variable-length packet consisting of
two parts: header and data. The header is 20 to 60 bytes in length and contains
information essential to routing and delivery.
TCP/IP Protocol Suite 61
Service type or differentiated services
The precedence subfield was designed, but
never used in version 4.
Types of service
TCP/IP Protocol Suite 62
Default types of service
TCP/IP Protocol Suite 63
The total length field defines the total
length of the datagram including the
header.
Note:
TCP/IP Protocol Suite 64
Figure 8.4 Encapsulation of a small datagram in an Ethernet frame
TCP/IP Protocol Suite 65
Protocols field
TCP/IP Protocol Suite 66
TTL field
•This filed is used to make limitation of movement of a packet in the
internet•After any hop in a router this filed is decremented one.•If TTL equals zero, the packet will be discarded.
TCP/IP Protocol Suite 67
FRAGMENTATION
The format and size of a frame depend on the protocol used by the
physical network. A datagram may have to be fragmented to fit theprotocol regulations.
TCP/IP Protocol Suite 68
Flags field
TCP/IP Protocol Suite 69
Detailed fragmentation example
TCP/IP Protocol Suite 70
CHECKSUM
The error detection method used by most TCP/IP protocols is called
the checksum. The checksum protects against the corruption that may
occur during the transmission of a packet. It is redundant information
added to the packet.
The topics discussed in this section include:
Checksum Calculation at the Sender
Checksum Calculation at the Receiver
Checksum in the IP Packet
TCP/IP Protocol Suite 71
To create the checksum the sender does the following:
❏ The packet is divided into k sections, each of n bits.
❏ All sections are added together using 1’s complement
arithmetic.
❏ The final result is complemented to make the
checksum.
Note:
TCP/IP Protocol Suite 72
Figure 8.22 Checksum concept
TCP/IP Protocol Suite 73
Figure 8.23 Checksum in one’s complement arithmetic
TCP/IP Protocol Suite 74
Upon completion you will be able to:
User Datagram
Protocol
• Be able to explain process-to-process communication
• Know the format of a UDP user datagram
• Be able to calculate a UDP checksum
• Understand the operation of UDP
• Know when it is appropriate to use UDP
• Understand the modules in a UDP package
Objectives
TCP/IP Protocol Suite 75
Figure 11.1 Position of UDP in the TCP/IP protocol suite
TCP/IP Protocol Suite 76
11.1 PROCESS-TO-PROCESS
COMMUNICATION
Before we examine UDP, we must first understand host-to-host
communication and process-to-process communication and the
difference between them.
The topics discussed in this section include:
Port Numbers
Socket Addresses
TCP/IP Protocol Suite 77
Figure 11.2 UDP versus IP
TCP/IP Protocol Suite 78
Figure 11.3 Port numbers
TCP/IP Protocol Suite 79
Figure 11.4 IP addresses versus port numbers
TCP/IP Protocol Suite 80
Figure 11.5 ICANN ranges
TCP/IP Protocol Suite 81
The well-known port numbers are
less than 1024.
Note:
TCP/IP Protocol Suite 82
Table 11.1 Well-known ports used with UDP
TCP/IP Protocol Suite 83
Socket address
TCP/IP Protocol Suite 84
USER DATAGRAM
UDP packets are called user datagrams and have a fixed-size header of
8 bytes.
TCP/IP Protocol Suite 85
UDP length =
IP length − IP header’s length
Note:
TCP/IP Protocol Suite 86
11.3 CHECKSUM
UDP checksum calculation is different from the one for IP and ICMP.
Here the checksum includes three sections: a pseudoheader, the UDP
header, and the data coming from the application layer.
The topics discussed in this section include:
Checksum Calculation at Sender
Checksum Calculation at Receiver
Optional Use of the Checksum
TCP/IP Protocol Suite 87
Figure 11.8 Pseudoheader for checksum calculation
TCP/IP Protocol Suite 88
Figure 11.9 Checksum calculation of a simple UDP user datagram
TCP/IP Protocol Suite 89
UDP OPERATION
UDP uses concepts common to the transport layer. These concepts will
be discussed here briefly, and then expanded in the next chapter on the
TCP protocol.
The topics discussed in this section include:
Connectionless Services
Flow and Error Control
Encapsulation and Decapsulation
Queuing
Multiplexing and Demultiplexing
TCP/IP Protocol Suite 90
Figure 11.10 Encapsulation and decapsulation
TCP/IP Protocol Suite 91
Figure 11.11 Queues in UDP
TCP/IP Protocol Suite 92
Figure 11.12 Multiplexing and demultiplexing
TCP/IP Protocol Suite 93
Upon completion you will be able to:
Transmission
Control Protocol
• Be able to name and understand the services offered by TCP
• Understand TCP’s flow and error control and congestion control
• Be familiar with the fields in a TCP segment
• Understand the phases in a connection-oriented connection
• Understand the TCP transition state diagram
• Be able to name and understand the timers used in TCP
• Be familiar with the TCP options
Objectives
TCP/IP Protocol Suite 94
TCP/IP protocol suite
TCP/IP Protocol Suite 95
12.1 TCP SERVICES
We explain the services offered by TCP to the processes at the
application layer.
The topics discussed in this section include:
Process-to-Process Communication
Stream Delivery Service
Full-Duplex Communication
Connection-Oriented Service
Reliable Service
TCP/IP Protocol Suite 96
well-known ports used by TCP
TCP/IP Protocol Suite 97
Stream delivery
TCP/IP Protocol Suite 98
Sending and receiving buffers
TCP/IP Protocol Suite 99
TCP segments
TCP/IP Protocol Suite 100
TCP FEATURES
To provide the services mentioned in the previous section, TCP has
several features that are briefly summarized in this section.
The topics discussed in this section include:
Numbering System
Flow Control
Error Control
Congestion Control
TCP/IP Protocol Suite 101
The bytes of data being transferred in
each connection are numbered by TCP.
The numbering starts with a randomly
generated number.
Note:
TCP/IP Protocol Suite 102
The value in the sequence number
field of a segment defines the number
of the first data byte contained
in that segment.
Note:
TCP/IP Protocol Suite 103
The value of the acknowledgment
field in a segment defines the number
of the next byte a party expects to
receive.
The acknowledgment number is
cumulative.
Note:
TCP/IP Protocol Suite 104
SEGMENT
A packet in TCP is called a segment
The topics discussed in this section include:
Format
Encapsulation
TCP/IP Protocol Suite 105
TCP segment format
TCP/IP Protocol Suite 106
Control field
TCP/IP Protocol Suite 107
Figure 12.7 Pseudoheader added to the TCP datagram
TCP/IP Protocol Suite 108
The inclusion of the checksum in
TCP is mandatory.
Note:
TCP/IP Protocol Suite 109
Encapsulation and decapsulation
TCP/IP Protocol Suite 110
A TCP CONNECTION
TCP is connection-oriented. A connection-oriented transport protocol
establishes a virtual path between the source and destination. All of the
segments belonging to a message are then sent over this virtual path. A
connection-oriented transmission requires three phases: connection
establishment, data transfer, and connection termination.
The topics discussed in this section include:
Connection Establishment
Data Transfer
Connection Termination
Connection Reset
TCP/IP Protocol Suite 111
Connection establishment using three-way handshaking
TCP/IP Protocol Suite 112
A SYN segment cannot carry data,
but it consumes one sequence
number.
Note:
TCP/IP Protocol Suite 113
A SYN + ACK segment cannot carry
data, but does consume one
sequence number.
Note:
TCP/IP Protocol Suite 114
An ACK segment, if carrying no
data, consumes no sequence number.
Note:
TCP/IP Protocol Suite 115
Data transfer
TCP/IP Protocol Suite 116
The FIN segment consumes one
sequence number if it does not carry
data.
Note:
TCP/IP Protocol Suite 117
Connection termination using three-way handshaking
TCP/IP Protocol Suite 118
The FIN + ACK segment consumes
one sequence number if it does not
carry data.
Note:
TCP/IP Protocol Suite 119
Half-close
TCP/IP Protocol Suite 120
STATE TRANSITION DIAGRAM
To keep track of all the different events happening during connection
establishment, connection termination, and data transfer, the TCP
software is implemented as a finite state machine. .
The topics discussed in this section include:
Scenarios
TCP/IP Protocol Suite 121
Table 12.3 States for TCP
TCP/IP Protocol Suite 122
State transition diagram
TCP/IP Protocol Suite 123
Common scenario
TCP/IP Protocol Suite 124
Three-way handshake
TCP/IP Protocol Suite 125
Simultaneous open
TCP/IP Protocol Suite 126
Simultaneous close
TCP/IP Protocol Suite 127
Denying a connection
TCP/IP Protocol Suite 128
Aborting a connection
TCP/IP Protocol Suite 129
FLOW CONTROL
Flow control regulates the amount of data a source can send before
receiving an acknowledgment from the destination. TCP defines a
window that is imposed on the buffer of data delivered from the
application program.
The topics discussed in this section include:
Sliding Window Protocol
Silly Window Syndrome
TCP/IP Protocol Suite 130
Sliding window
TCP/IP Protocol Suite 131
A sliding window is used to make
transmission more efficient as well as
to control the flow of data so that the
destination does not become
overwhelmed with data.
TCP’s sliding windows are byte
oriented.
Note:
TCP/IP Protocol Suite 132
Example 5
TCP/IP Protocol Suite 134
Example 7
TCP/IP Protocol Suite 137
ERROR CONTROL
TCP provides reliability using error control, which detects corrupted,
lost, out-of-order, and duplicated segments. Error control in TCP is
achieved through the use of the checksum, acknowledgment, and time-
out.
The topics discussed in this section include:
Checksum
Acknowledgment
Acknowledgment Type
Retransmission
Out-of-Order Segments
Some Scenarios
TCP/IP Protocol Suite 138
ACK segments do not consume
sequence numbers and are not
acknowledged.
Note:
TCP/IP Protocol Suite 139
In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
Note:
TCP/IP Protocol Suite 140
No retransmission timer is set for an
ACK segment.
Note:
TCP/IP Protocol Suite 141
Data may arrive out of order and be
temporarily stored by the receiving TCP,
but TCP guarantees that no out-of-order
segment is delivered to the process.
Note:
TCP/IP Protocol Suite 142
Normal operation
TCP/IP Protocol Suite 143
Lost segment
TCP/IP Protocol Suite 144
The receiver TCP delivers only
ordered data to the process.
Note:
TCP/IP Protocol Suite 145
Fast retransmission
TCP/IP Protocol Suite 146
Lost acknowledgment
TCP/IP Protocol Suite 147
Lost acknowledgment corrected by resending a segment
TCP/IP Protocol Suite 148
Lost acknowledgments may create
deadlock if they are not properly
handled.
Note:
TCP/IP Protocol Suite 149
با تشكر؟