Đang tải... (xem toàn văn)
Mô hình TCP/IP (Transmission Control Protocol/Internet Protocol) hay còn gọi là bộ giao thức Internet là một mô hình khái niệm và một tập hợp các giao thức truyền thông được sử dụng trong mạng Internet và các hệ thống mạng máy tính tương tự. Nó đóng vai trò như một ngôn ngữ chung cho phép các thiết bị khác nhau giao tiếp và trao đổi thông tin với nhau trên mạng.
Trang 1Chương 1: Tổng quan về mô hình truyền thông
Nguyễn Thanh Đăng, bài giảng Mạng và Truyền dữ liệu, ÐHCN Tp.HCM, 2016.
Trang 2Chương 1: Tổng quan về mô hình truyền thông
Trang 31.1 Các thành phần chính của mạng máy tính.
n
Trang 41.1 Các thành phần chính của mạng máy tính.
n
Trang 61.2 Mô hình OSI.
Các công việc liên quan quá trình gửi 1 bức thư
Trang 71.2 Mô hình OSI.
n
Trang 81.2 Mô hình OSI.
n
Trang 91.2 Mô hình OSI.
Mô hình OSI 7 lớp: gồm 7 lớp riêng biệt nhưng có liên hệ với nhau, mỗi lớp nhằm định nghĩa một phân đoạn trong quá trình di chuyển thông tin qua mạng.
Trang 101.2 Mô hình OSI.
Chức năng mỗi lớp trong mô hình OSI:
a)Lớp vật lý (Physical layer):Lớp vật lý chịu trách
nhiệm cho việc di chuyển các bit riêng lẻ từ 1 hop
(nút) đến nút kế tiếp Lớp này liên quan đến các đặc tính cơ, điện của giao diện thiết bị và môi trường
truyền.
Trang 111.2 Mô hình OSI.
Trang 131.2 Mô hình OSI.
b)Lớp liên kết dữ liệu (Data link layer): Lớp liên kết dữ liệu chịu trách nhiệm chuyển các frame từ 1 hop (nút) đến hop khác.
Trang 141.2 Mô hình OSI.
Nhiệm vụ
Break L3 (Network) data into reasonable size (Frame)
Truyền khung/frame từ nút đến nút trong một mạng
Guarantee Node-to-Node delivery (Frame Error Free)
Service
Tạo khung (thêm header & trailer)
Định địa chỉ vật lý (MAC address: 12 digit hexadecimal (e.g 080BF0AFDC09))
Same sender network:source & destination address
Outside sender network: source & connecting devices (bridge, router, gateway) address
Điều khiển lưu lượng:frame acknowledgement, inform buffer size, etc.
Kiểm soát lỗi:error detection and error correction
Điều khiển truy cập: checking accessibility (ex Multipoint connection)
Trang 151.2 Mô hình OSI.
Phân phối hop đến hop
Trang 161.2 Mô hình OSI.
c) Lớp mạng (Network layer): Lớp mạng chịu trách nhiệm phân phối các gói tin riêng rẽ từ host nguồn đến host đích.
Trang 17 Logical (Network) address (header):IP address
Định tuyến các gói tin đi qua thiết bị liên mạng
Router || Gateway
Trang 181.2 Mô hình OSI.
Phân phối từ nguồn đến đích
Trang 191.2 Mô hình OSI.
d)Lớp giao vận (Transport layer): Lớp giao vận chịu trách nhiệm phân phối message từ một quá
trình/process đến quá trình khác.
Trang 201.2 Mô hình OSI.
Nhiệm vụ
Đảm bảo phân phối toàn bộ từ nguồn đến đích cuối cùng
Service
Service-point addressing:Port address (16 bits: 0 – 65,535 ports)
Each application is assigned a specific port address
Segmentation and Reassembly
Source:segment L5 data into small segments
Destination:reassembly small segments into a whole message
Điều khiển kết nối
Không kết nối/Connectionless
Hướng kết nối/Connection-oriented
Kiểm soát lỗi: dò và sửa sai toàn bộ message
Điều khiển luồng
Trang 211.2 Mô hình OSI.
e)Lớp phiên (Session layer): Lớp phiên chịu trách nhiệm điều khiển và đồng bộ dialog.
Trang 22 Traffic control & direction control
Đồng bộ thông điệp/Message synchronization
Adding checkpoints (synchronization points) in the message stream
Trang 231.2 Mô hình OSI.
f) Lớp trình diễn (Presentation layer): Lớp trình diễn chịu trách nhiệm biên dịch, nén và mã hóa
Trang 24 Ex ASCII -> non ASCII system
Mã hóa (privacy & security)
Đối với các thông tin nhạy cảm: login-password, thẻ tín dung, tài khoản ngân hàng, thông tin cá nhân
Nén
Ex Zip, Gif, JPEG
Trang 251.2 Mô hình OSI.
g) Lớp ứng dụng (Application layer): Lớp ứng dụng chịu trách nhiệm cung cấp các dịch vụ đến người sử dụng
Trang 26 Network Virtual Terminal
Truyền , truy xuất và quản lý file/File transfer, access, and management (FTAM)
Dịch vụ mail
Truy cập WWW
Trang 271.2 Mô hình OSI.
Giao tiếp giữa các lớp trong mô hình OSI
Trang 281.2 Mô hình OSI.
Trao đổi dữ liệu sử dụng mô hình OSI
Trang 291.3 Mô hình TCP/IP
The layers in theTCP/IP protocol suitedo not exactlymatch those in the OSI model The original TCP/IPprotocol suite was defined as having four layers:host-to-network,internet,transport, andapplication.However, when TCP/IP is compared to OSI, we cansay that the TCP/IP protocol suite is made of fivelayers:physical,data link,network,transport, and
application.
Trang 301.3 Mô hình TCP/IP
Trang 311.3 Mô hình TCP/IP
Network Access
Trang 321.3 Mô hình TCP/IP
a) Physical and Data Link Layers:
At the physical and data link layers, TCP/IP does not define any specific protocol It supports all the standard and proprietary protocols A network in a TCP/IP
internetwork can be a local-area network or a wide-area network
b) Network Layer:
At the network layer (or, more accurately, the
internetwork layer), TCP/IP supports the Internetworking Protocol lP, in turn, uses four supporting protocols:
ARP, RARP, ICMP, and IGMP
Trang 331.3 Mô hình TCP/IP
c) Transport Layer:
Traditionally the transport layer was represented in
TCP/IP by two protocols· TCP and UDP IP is a host protocol, meaning that it can deliver a packet from one physical device to another UDP and TCP are
host-to-transport level protocols responsible for delivery of a message from a process (running program) to another process A new transport layer protocol, SCTP, has been devised to meet the needs of some newer applications.
Trang 341.3 Mô hình TCP/IP
h
Trang 351.3 Mô hình TCP/IP
UDP protocol:
The User Datagram Protocol (UDP) is called a
connectionless, unreliable transport protocol It does not add anything to the services of lP except to
provide process-toprocess communication instead of host-to-host communication Also, it performs very limited error checking.
Trang 36 Provides limited error checking
Provides best-effort delivery
Has no data-recovery features
UDP Characteristics
Trang 371.3 Mô hình TCP/IP
Well-Known Ports for UDP
Trang 381.3 Mô hình TCP/IP
Well-Known Ports for UDP
Trang 401.3 Mô hình TCP/IP
Checksum
-The UDP checksum includes three sections: a
pseudoheader, the UDP header, and the data coming from the application layer.
-The pseudoheader is the part of the header of the lP
packet in which the user datagram is to be encapsulated with some fields filled with Os
Trang 411.3 Mô hình TCP/IP
Pseudoheader for checksum calculation
Trang 421.3 Mô hình TCP/IP
Example 23.2
Figure 23.11 shows the checksum calculation for a very small user datagram with only 7 bytes of data Because the number of bytes of data is odd, padding is added for checksum calculation The pseudoheader as well as the padding will be dropped when the user datagram is
delivered to lP.
Trang 431.3 Mô hình TCP/IP
User
Trang 441.3 Mô hình TCP/IP
UDP Operation
-Connectionless Services: each user datagram sent by
UDP is an independent datagram There is no connection establishment and no connection termination
-Flow and Error Control:UDP is a very simple,
unreliable transport protocol There is no flow control and hence no window mechanism The receiver may overflow with incoming messages 44
Trang 451.3 Mô hình TCP/IP
-Encapsulation and Decapsulation: To send a message
from one process to another, the UDP protocol encapsulates and decapsulates messages in an lP datagram.
-Queuing:
Trang 461.3 Mô hình TCP/IP
Use of UDP:
- UDP is suitable for a process that requires simple response communication with little concern for flow and error control It is not usually used for a process such as FfP that needs to send bulk data.
request UDP is suitable for a process with internal flow and error control mechanisms For example, the Trivial File Transfer
Ptotocol (TFTP) process includes flow and error control It can easily use UDP.
Trang 471.3 Mô hình TCP/IP
- UDP is a suitable transport protocol for multicasting
Multicasting capability is embedded in the UDP software but not in the TCP software.
- UDP is used for management processes.
- UDP is used for some route updating protocols such as Routing Information Protocol (RIP)
Trang 481.3 Mô hình TCP/IP
TCP (Transmission Control Protocol) protocol: TCP is a connection-oriented protocol; it creates a virtual connection between two TCPs to send data In
addition, TCP uses flow and error control mechanisms at the transport level Therefore, TCP is called a
connection-oriented, reliable transport protocol It
adds connection-oriented and reliability features to the services of lP
Trang 491.3 Mô hình TCP/IPTCP Characteristics
Transport layer of the TCP/IP stack
Access to the network layer for applications
Trang 501.3 Mô hình TCP/IP
TCP Services
Process-to-Process Communication: Like UDP, TCP
provides process-to-process communication using port numbers
Trang 511.3 Mô hình TCP/IP
Well-known ports used by TCP
Trang 521.3 Mô hình TCP/IP
Stream Delivery Service: TCP, unlike UDP, is a
stream-oriented protocol TCP allows the sending
process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of
bytes TCP creates an environment in which the two processes seem to be connected by an imaginary
"tube“ that carries their data across the Internet
Trang 531.3 Mô hình TCP/IP
Stream delivery
Trang 541.3 Mô hình TCP/IP
Sending and Receiving Buffers: Because the
sending and the receiving processes may not write or read data at the same speed, TCP needs buffers for
storage There are two buffers, the sending buffer and the receiving buffer, one for each direction
Trang 551.3 Mô hình TCP/IP
Sending and receiving buffers
Trang 56datagrams and transmitted This entire operation is transparent to the receiving process
Trang 571.3 Mô hình TCP/IP
TCP segments
Trang 581.3 Mô hình TCP/IP
Full-Duplex Communication: TCP offers full-duplex
service, in which data can flow in both directions at the same time Each TCP then has a sending and
receiving buffer, and segments move in both directions.
Trang 601.3 Mô hình TCP/IP
Reliable Service: TCP is a reliable transport protocol
It uses an acknowledgment mechanism to checkthe safe and sound arrival of data
'I'CP Features
Numbering System:
-Byte Number: The bytes of data being transferred in
each connection are numbered by TCP The numbering starts with a randomly generated number 60
Trang 611.3 Mô hình TCP/IP
-Sequence Number: The value in the sequence number
field of a segment defines the number of the first data byte contained in that segment
-Acknowledgment Number: 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
Trang 621.3 Mô hình TCP/IP
Flow Control : The receiver of the data controls the
amount of data that are to be sent by the sender This is done to prevent the receiver from being
overwhelmed with data The numbering system allows TCP to use a byte-oriented flow control
Error Control
Congestion Control
Trang 631.3 Mô hình TCP/IP
Segment
Format:
Trang 641.3 Mô hình TCP/IP
Control field
Trang 651.3 Mô hình TCP/IP
A TCP Connection
Connection Establishment: TCP transmits data in full-duplex mode When two TCPs in two machines are connected, they are able to send segments to each other simultaneously This implies that each party
must initialize connnunication and get approval from the other party before any data are transferred
Trang 661.3 Mô hình TCP/IP
Establishing a Connection
Trang 671.3 Mô hình TCP/IP
-Three Way Handshaking: The connection establishment in TCP is called three way handshaking
Trang 691.3 Mô hình TCP/IP
Data Transfer
Trang 701.3 Mô hình TCP/IP
Connection Termination
Connection termination using three-way handshaking
Trang 721.3 Mô hình TCP/IP
Flow Control: TCP uses a sliding window to handle
flow control The sliding window protocol used by TCP, however, is something between the Go-Back-Nand Selective Repeat sliding window.
Trang 731.3 Mô hình TCP/IP
Flow Control
Trang 741.3 Mô hình TCP/IPTCP Acknowledgment
Trang 751.3 Mô hình TCP/IPFixed Windowing
Trang 761.3 Mô hình TCP/IP
Sliding window: 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 sliding windows are byte oriented
Trang 771.3 Mô hình TCP/IP
TCP Sliding Windowing
Trang 781.3 Mô hình TCP/IP
Some points about TCP sliding windows:
-The size of the window is the lesser of rwnd and cwnd.
-The source does not have to send a full window's worth of data.-The wmdow can be opened or closed by the receiver, but shouW not be shrunk.
-The destination can send an acknowledgment at any time as long as it does not result in a shrinking window.
- The receiver can temporarily shut down the window; the sender, however, can always send a segment of 1 byte after the window is shut down
78
Trang 79What is the value of the receiver window (rwnd) for host Aif the receiver, host B, has a buffer size of 5000 bytes and1000 bytes of received and unprocessed data?
Example 23.4
The value of rwnd = 5000 − 1000 = 4000 Host B canreceive only 4000 bytes of data before overflowing itsbuffer Host B advertises this value in its next segment to A.
Trang 801.3 Mô hình TCP/IP
TCP Sequence and Acknowledgment Numbers
Trang 811.3 Mô hình TCP/IP
Error Control
Checksum:
-Each segment includes a checksum field which is used
to check for a corrupted segment If the segment is
corrupted, it is discarded by the destination TCP and is considered as lost
-TCP uses a 16-bit checksum that is mandatory in every
Trang 821.3 Mô hình TCP/IP
Acknowledgment: TCP uses acknowledgments to
confirm the receipt of data segments Control segments that carry no data but consume a sequence number are also acknowledged ACK segments
are never acknowledged.
Retransmission: In modent implementations, a
retransmissimt occur s if the retransmission timer
expires or three duplicate ACK segments have arrived.
Trang 831.3 Mô hình TCP/IP
Out-of-Order Segments: 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.
Trang 841.3 Mô hình TCP/IP
Congestion Control: Congestion control refers to
techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion,
after it has happened Congestion control involves two
factors that measure the performance of a network:
delay and throughput
Trang 851.3 Mô hình TCP/IP
Congestion Window:
Congestion Policy: TCP's general policy for handling
congestion is based on three phases: slow start, congestion avoidance, and congestion detection In the slow-start
phase, the sender starts with a very slow rate of
transmission, but increases the rate rapidly to reach a
threshold When the threshold is reached, the data rate is reduced to avoid congestion Finally if congestion is
detected, the sender goes back to the slow-start or
congestion avoidance phase based on how the congestion
Trang 871.3 Mô hình TCP/IP
d) Application Layer:
The application layer in TCP/IP is equivalent to the
combined session, presentation, and application layers in the OSI model Many protocols are defined at this layer.
Trang 881.3 Mô hình TCP/IP
Mapping Layer 3 to Layer 4
Trang 891.3 Mô hình TCP/IP
Mapping Layer 4 to Applications
Trang 911.3 Mô hình TCP/IP
Relationship of layers and addresses in TCP/IP:
Trang 92- The physical addresses have authority over the
network (LAN or WAN) The size and format of these addresses vary depending on the network For
example, Ethernet
uses a 6-byte (48-bit) physical address that is imprinted on the network interface card (NIC).
Trang 931.3 Mô hình TCP/IP
-Ví dụ: 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 10is the sender, and the computer with physical address 87is the receiver.
Trang 941.3 Mô hình TCP/IP
Logical Addresses:
-Logical addresses are necessary for universal communicationsthat are independent of underlying physical networks Physicaladdresses are not adequate in an internetwork environmentwhere different networks can have different address formats Auniversal addressing system is needed in which each host canbe identified uniquely, regardless of the underlying physicalnetwork.
- A logical address in the Internet is currently a 32-bit address that can uniquely define a host connected to the Internet No two
publicly addressed and visible hosts on the Internet can have the
same lP address.