網路建構實習課

Download Report

Transcript 網路建構實習課

網路建構實習課
期末複習
6/10
Chapter 8
Internet Protocol
Objectives
Upon completion you will be able to:
• 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
Figure 8.1
Position of IP in TCP/IP protocol suite
8.1 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.
Figure 8.2
IP datagram
Table 8.2 Default types of service
Note:
The total length field defines the total
length of the datagram including the
header.
Figure 8.4
Encapsulation of a small datagram in an Ethernet frame
Figure 8.5
Multiplexing
Table 8.4 Protocols
8.3 OPTIONS
The header of the IP datagram is made of two parts: a fixed part and a
variable part. The variable part comprises the options that can be a
maximum of 40 bytes.
The topics discussed in this section include:
Format
Option Types
Figure 8.10
Option format
Figure 8.11 Categories of options
8.5 IP PACKAGE
We give an example of a simplified IP software package to show its
components and the relationships between the components. This IP
package involves eight modules.
The topics discussed in this section include:
Header-Adding Module
Processing Module
Queues
Routing Table
Forwarding Module
MTU Table
Fragmentation Module
Reassembly Table
Reassembly Module
Figure 8.26
IP components
Chapter 9
Internet Control Message
Protocol
Objectives
Upon completion you will be able to:
• Be familiar with the ICMP message format
• Know the types of error reporting messages
• Know the types of query messages
• Be able to calculate the ICMP checksum
• Know how to use the ping and traceroute commands
• Understand the modules and interactions of an ICMP package
Figure 9.1
Position of ICMP in the network layer
Figure 9.2
ICMP encapsulation
9.1 TYPES OF MESSAGES
ICMP messages are divided into error-reporting messages and query
messages. The error-reporting messages report problems that a router or
a host (destination) may encounter. The query messages get specific
information from a router or another host.
Figure 9.3
ICMP messages
Table 9.1 ICMP messages
9.2 MESSAGE FORMAT
An ICMP message has an 8-byte header and a variable-size data section.
Although the general format of the header is different for each message
type, the first 4 bytes are common to all.
Figure 9.4
General format of ICMP messages
9.3 ERROR REPORTING
IP, as an unreliable protocol, is not concerned with error checking and
error control. ICMP was designed, in part, to compensate for this
shortcoming. ICMP does not correct errors, it simply reports them.
The topics discussed in this section include:
Destination Unreachable
Source Quench
Time Exceeded
Parameter Problem
Redirection
Note:
ICMP always reports error messages
to the original source.
Figure 9.5
Error-reporting messages
Note:
The following are important points about ICMP
error messages:
❏ No ICMP error message will be generated in response
to a datagram carrying an ICMP error message.
❏ No ICMP error message will be generated for a
fragmented datagram that is not the first fragment.
❏ No ICMP error message will be generated for a
datagram having a multicast address.
❏ No ICMP error message will be generated for a
datagram having a special address such as 127.0.0.0 or
0.0.0.0.
Figure 9.6
Contents of data field for the error messages
Figure 9.7
Destination-unreachable format
Note:
Destination-unreachable messages
with codes 2 or 3 can be created only
by the destination host.
Other destination-unreachable
messages can be created only by
routers.
Note:
A router cannot detect all problems
that prevent the delivery of a packet.
Note:
There is no flow-control mechanism in
the IP protocol.
Figure 9.8
Source-quench format
Note:
A source-quench message informs the
source that a datagram has been
discarded due to congestion in a router
or the destination host.
The source must slow down the
sending of datagrams until the
congestion is relieved.
Note:
One source-quench message is sent for
each datagram that is discarded due to
congestion.
Note:
Whenever a router decrements a
datagram with a time-to-live value to
zero, it discards the datagram and
sends a time-exceeded message to the
original source.
Note:
When the final destination does not
receive all of the fragments in a set
time, it discards the received fragments
and sends a time-exceeded message to
the original source.
Figure 9.9
Time-exceeded message format
Figure 9.11 Redirection concept
Note:
A host usually starts with a small
routing table that is gradually
augmented and updated. One of the
tools to accomplish this is the
redirection message.
Figure 9.12
Redirection message format
Note:
A redirection message is sent from a
router to a host on the same local
network.
9.4 QUERY
ICMP can also diagnose some network problems through the query
messages, a group of four different pairs of messages. In this type of
ICMP message, a node sends a message that is answered in a specific
format by the destination node.
The topics discussed in this section include:
Echo Request and Reply
Timestamp Request and Reply
Address-Mask Request and Reply
Router Solicitation and Advertisement
Figure 9.13
Query messages
Note:
An echo-request message can be sent
by a host or router. An echo-reply
message is sent by the host or router
which receives an echo-request
message.
Note:
Echo-request and echo-reply messages
can be used by network managers to
check the operation of the IP protocol.
Note:
Echo-request and echo-reply messages
can test the reachability of a host. This
is usually done by invoking the ping
command.
Figure 9.14
Echo-request and echo-reply messages
Figure 9.15
Timestamp-request and timestamp-reply message format
Note:
The timestamp-request and timestampreply messages can be used to
synchronize two clocks in two
machines if the exact one-way time
duration is known.
9.7 ICMP PACKAGE
To give an idea of how ICMP can handle the sending and receiving of
ICMP messages, we present our version of an ICMP package made of
two modules: an input module and an output module.
The topics discussed in this section include:
Input Module
Output Module
Figure 9.21
ICMP package
Chapter 11
User Datagram
Protocol
Objectives
Upon completion you will be able to:
• 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
Figure 11.1 Position of UDP in the TCP/IP protocol suite
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
Figure 11.2 UDP versus IP
Figure 11.3 Port numbers
Figure 11.4 IP addresses versus port numbers
Figure 11.5 ICANN ranges
Table 11.1 Well-known ports used with UDP
Figure 11.6 Socket address
11.2 USER DATAGRAM
UDP packets are called user datagrams and have a fixed-size header of 8
bytes.
Figure 11.7 User datagram format
Note:
UDP length =
IP length − IP header’s length
11.4 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
Figure 11.10 Encapsulation and decapsulation
Figure 11.11 Queues in UDP
11.6 UDP PACKAGE
To show how UDP handles the sending and receiving of UDP packets,
we present a simple version of the UDP package. The UDP package
involves five components: a control-block table, input queues, a controlblock module, an input module, and an output module.
The topics discussed in this section include:
Control-Block Table
Input Queues
Control-Block Module
Input Module
Output Module
Figure 11.13 UDP design
Chapter 12
Transmission
Control Protocol
Objectives
Upon completion you will be able to:
• 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
Figure 12.1
TCP/IP protocol suite
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
Table 12.1 Well-known ports used by TCP
Figure 12.2
Stream delivery
Figure 12.3
Sending and receiving buffers
Figure 12.4
TCP segments
12.2 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
Note:
The bytes of data being transferred in
each connection are numbered by TCP.
The numbering starts with a randomly
generated number.
Example 2
Suppose a TCP connection is transferring a file of 5000 bytes.
The first byte is numbered 10001. What are the sequence
numbers for each segment if data is sent in five segments, each
carrying 1000 bytes?
Solution
The following shows the sequence number for each segment:
Segment 1 ➡ Sequence Number: 10,001 (range: 10,001 to 11,000)
Segment 2 ➡ Sequence Number: 11,001 (range: 11,001 to 12,000)
Segment 3 ➡ Sequence Number: 12,001 (range: 12,001 to 13,000)
Segment 4 ➡ Sequence Number: 13,001 (range: 13,001 to 14,000)
Segment 5 ➡ Sequence Number: 14,001 (range: 14,001 to 15,000)
12.3 SEGMENT
A packet in TCP is called a segment
The topics discussed in this section include:
Format
Encapsulation
Figure 12.5
TCP segment format
Figure 12.6
Control field
Table 12.2 Description of flags in the control field
I
Figure 12.8
Encapsulation and decapsulation
12.4 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
Figure 12.9
Connection establishment using three-way handshaking
Figure 12.10
Data transfer
Note:
The FIN segment consumes one
sequence number if it does not carry
data.
Figure 12.11 Connection termination using three-way handshaking
Note:
The FIN + ACK segment consumes
one sequence number if it does not
carry data.
12.7 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 timeout.
The topics discussed in this section include:
Checksum
Acknowledgment
Acknowledgment Type
Retransmission
Out-of-Order Segments
Some Scenarios
12.8 CONGESTION CONTROL
Congestion control refers to the mechanisms and techniques to keep the
load below the capacity.
The topics discussed in this section include:
Network Performance
Congestion Control Mechanisms
Congestion Control in TCP
Figure 12.30
Router queues
12.9 TCP TIMERS
To perform its operation smoothly, most TCP implementations use at
least four timers.
The topics discussed in this section include:
Retransmission Timer
Persistence Timer
Keepalive Timer
TIME-WAIT Timer
Figure 12.37
TCP timers
12.11 TCP PACKAGE
We present a simplified, bare-bones TCP package to simulate the heart of
TCP. The package involves tables called transmission control blocks, a
set of timers, and three software modules.
The topics discussed in this section include:
Transmission Control Blocks (TCBs)
Timers
Main Module
Input Processing Module
Output Processing Module
Figure 12.51
TCP package
祝大家期末考順利