Networking (Mcan 204) Unit 3
Networking (Mcan 204) Unit 3
Internetworking
Internetworking concept,IPv4 & IPv6 Addressing, IPv4 &
IPv6 Protocol, Transition from IPv4 to IPv6, Address
Mapping, Error Reporting, Multicasting, Unicast Routing
Protocols, Distance Vector Routing, Link State Routing,
Path Vector Routing, Multicasting Routing Protocols,
Transmission Control Protocol, User Datagram Protocol
Internetworking concept
1. Internetworking refers to a collection of interconnected packet switching and
broadcast networks connected by bridges, switches or routers that functions as a
single large network.
2. It refers to the industry, products, and procedures that meet the challenge of creating
and administering internetworks.
3. In this concept some different kinds of network technologies that can be
interconnected by routers and other networking devices to create an internetwork.
4. Internetwork as abbreviated as Internet. However Internet is the largest internetwork
in the world.
Internetworking concept
Internetworking started as a way to connect disparate types of networking technology,
but it became widespread through the developing need to connect two or more local
area networks via some sort of wide area network.
The first two interconnected networks were the ARPANET and the NPL network via
Peter Kirstein's group at University College London. The network elements used to
connect individual networks in the ARPANET, the predecessor of the Internet, were
originally called gateways, but the term has been deprecated in this context, because of
possible confusion with functionally different devices. Research at NPL confirmed
establishing a common host protocol would be more reliable and efficient. By 1973-74,
researchers in the United States, the United Kingdom and France had worked out an
approach to internetworking where the differences between network protocols were
hidden by using a common internetwork protocol, and instead of the network being
responsible for reliability, as in the ARPANET, the hosts became responsible, as
demonstrated in the CYCLADES network.
Today the interconnecting gateways are called routers. The definition of an internetwork
today includes the connection of other types of computer networks such as personal
area networks.
Internetworking concept
To build an internetwork, the following are needed:- A standardized scheme to address
packets to any host on any participating network; a standardized protocol defining
format and handling of transmitted packets; components interconnecting the
participating networks by routing packets to their destinations based on standardized
addresses.
Another type of interconnection of networks often occurs within enterprises at the Link
Layer of the networking model, i.e. at the hardware-centric layer below the level of the
TCP/IP logical interfaces. Such interconnection is accomplished with network bridges
and network switches. This is sometimes incorrectly termed internetworking, but the
resulting system is simply a larger, single subnetwork, and no internetworking protocol,
such as Internet Protocol, is required to traverse these devices.
The Internet Protocol is designed to provide an unreliable packet service across the
network. The architecture avoids intermediate network elements maintaining any state
of the network. To transfer data reliably, applications must utilize an appropriate
Transport Layer protocol, such as Transmission Control Protocol (TCP), which provides a
reliable stream. Some applications use a simpler, connection-less transport protocol,
User Datagram Protocol (UDP), for tasks which do not require reliable delivery of data or
that require real-time service, such as video streaming or voice chat.
IPV4 ADDRESSES
19.5
IPv4 Address
• The IPv4 addresses are unique and universal.
• An IPv4 address is 32 bits long.
– The address space of IPv4 is 232 (4,294,967,296)
– Notation.
• Binary notation
• Dotted-decimal notation
19.6
Example 19.1
Change the following IPv4 addresses from binary notation to dotted-decimal notation.
Solution
We replace each group of 8 bits with its equivalent decimal number (see Appendix B)
19.7
Example 19.2
Change the following IPv4 addresses from dotted-decimal notation to binary notation.
Solution
We replace each decimal number with its binary equivalent (see Appendix B).
19.8
Example 19.3
Solution
19.10
Example 19.4
c. 14.23.120.8
d. 252.5.15.111
Solution
address.
19.12
Structure of IPv4 Address
• Consists of Net ID and Host ID.
- These parts are of varying length
- Depend on the class of the address
• Mask
– 32-bit number of contiguous 1’s followed by contiguous 0’s.
– To help to find the net ID and the host ID.
19.13
Use of IPv4 Address
• Subnetting
– Divide a large address block into smaller sub-
groups.
– Use of flexible net mask.
• Supernetting
– Exhausted class A and B address space
– Huge demand for class B address space
– To combine several contiguous address spaces into
a larger single address space
19.14
Subnetting
19.15
19.15
Use of IPv4 Address
• Address Depletion
– The flaws are combined with the fast growth of
Internet led to the near depletion of the available
addresses.
19.16
Classful Network Architecture
Class Higher bits NET ID bits HOST ID bits No. of No. of hosts Range
networks per network
0.0.0.0 to
A 0 8 24 2 7
2 24 127.255.255.
255
128.0.0.0 to
B 10 16 16 2 14
2 16 191.255.255.
255
192.0.0.0 to
C 110 24 8 2 21
2 8 223.255.255.
255
Restriction
– The address in a block must be contiguous, one after another.
– The number of addresses in a block must be a power of 2 (1,2,4,8…..).
– The first address must be evenly divisible by the number of addresses.
Tips:
– In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n, in which x.y.z.t defines one of the addresses and
the /n defines the mask.
– The first address in the block can be found by setting the rightmost 32 − n bits to 0s.
– The last address in the block can be found by setting the rightmost 32 − n bits to 1s.
– The number of addresses in the block can be found by using the formula
232−n.
19.18
Example 19.5
Figure 19.3 shows a block of addresses, in both binary and dotted-decimal notation,
We can see that the restrictions are applied to this block. The addresses are contiguous.
4
The number of addresses is a power of 2 (16 = 2 ), and the first address is divisible by
16. The first address, when converted to a decimal number, is 3,440,387,360, which
19.19
Figure 19.3 A block of 16 addresses granted to a small organization
19.20
Example 19.6
Solution
or
205.16.37.32.
19.21
Example 19.7
Solution
or
205.16.37.47
19.22
Example 19.8
Solution
19.23
Example 19.9
Another way to find the first address, the last address, and the number of addresses is to represent the
mask as a 32-bit binary (or 8-digit hexadecimal) number. This is particularly useful when we are writing
a program to find these pieces of information. In Example 19.5 the /28 can be represented as
Find
19.24
Example 19.9 (continued)
Solution
a. The first address can be found by ANDing the
given addresses with the mask. ANDing here is
done bit by bit. The result of ANDing 2 bits is 1 if
both bits are 1s; the result is 0 otherwise.
19.25
Example 19.9 (continued)
addresses with the complement of the mask. Oring here is done bit by bit. The result of
ORing 2 bits is 0 if both bits are 0s; the result is 1 otherwise. The complement of a
19.26
Example 19.9 (continued)
19.27
Special Addresses
• Network address
– The first address in a block is normally not
assigned to any device; it is used as the network
address that represents the organization to the
rest of the world.
• Broadcast address
– The last address in a block is used for broadcasting
to all devices under the network.
19.28
Routing in IPv4
• A router has two addresses
– An address through which the device inside of the
router can be accessed.
– Another address belongs to the granted block
(sub-network).
Sub
Sub
Internet
Internet network
network
19.29
Hierarchy of IPv4 Addressing
• Each address in the block can be considered as
a two-level hierarchical structure: the leftmost
n bits (prefix) define
the network; the rightmost 32 − n bits define
the host.
• Why Hierarchy?
19.30
Figure 19.5 levels of hierarchy of a telephone network
19.31
Two Level of Hierarchy
19.32
Three Level of Hierarchy
19.33
Three Level of Hierarchy
19.34
Addressing Allocation
19.35
Figure 19.9 An example of address allocation and distribution by an ISP
19.36
Example 19.10
The ISP needs to distribute these addresses to three groups of customers as follows:
b. The second group has 128 customers; each needs 128 addresses.
Design the subblocks and find out how many addresses are still available after these
allocations.
19.37
Example 19.10 (continued)
Solution
Group 1
For this group, each customer needs 256 addresses. This means that 8 (log2 256) bits
are needed to define each host. The prefix length is then 32 − 8 = 24. The addresses are
19.38
Example 19.10 (continued)
Group 2
For this group, each customer needs 128 addresses. This means that 7 (log2 128) bits
are needed to define each host. The prefix length is then 32 − 7 = 25. The addresses are
19.39
Example 19.10 (continued)
Group 3
For this group, each customer needs 64 addresses. This means that 6 (log 264) bits are
needed to each host. The prefix length is then 32 − 6 = 26. The addresses are
19.41
Figure 19.10 A NAT implementation
19.42
Figure 19.11 Addresses in a NAT
19.43
Figure 19.12 NAT address translation
19.44
NAT: Network Address Translation
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345 4
S: 128.119.40.186, 80
19.46
Figure 19.13 An ISP and NAT
19.47
IPV6 ADDRESSES
19.48
IPv6 Address
• An IPv6 address is 128 bits long (16-byte).
• Hexadecimal Colon Notation
• Abbreviation
19.49
Figure 19.15 Abbreviated IPv6 addresses
19.50
Example 19.11
Solution
We first need to align the left side of the double colon to the left of the original pattern
and the right side of the double colon to the right of the original pattern to find how
19.51
Structure of IPv6 Address
• Type prefix
– For categorization,
– Variable length,
– No partial conflict among the different prefix
19.52
Type prefixes for IPv6 addresses
19.53
Type prefixes for IPv6 addresses
19.54
Unicast Addresses
• For a single computer
• Two types of unicast addresses
– Geographically based
– Provider-based
• Fields
– Type ID (3-bit), Registry ID (5-bit), Provider ID (16-bit), Subscriber ID (24-bit),
Subnet ID (32-bit), Node ID (48-bit)
19.55
Multicast address in IPv6
• For a group of hosts
• To deliver packets to each member
19.56
Anycast Addresses
• For a group of nodes
• Packet is delivered to only one of the members of the anycast
group(nearest on or the one with the shortest route
• Used to assign an anycast address to all routers of an ISP that covers a
large area in the Internet.
• No block is assigned
19.57
Figure 19.18 Reserved addresses in IPv6
19.58
Local addresses in IPv6
• to use IPv6 without connecting to the global
Internet.
19.59
INTERNETWORKING
In this section, we discuss internetworking, connecting
networks together to make an internetwork or an internet.
20.60
20-1 INTERNETWORKING
20.61
Network Layer
• Need
– A frame has no routing info.
– DL layer has no routing info.
– For a router with 3+ NIC’s,
• how to deliver a packet through multiple links.
• How to find a next hop router
• Responsibility
– Host-to-host delivery
– For routing packets through the router and switches.
20.62
Links between two hosts
20.63
Network layer in an internetwork
20.64
Network Layer
• Source
– Creating a packet from the upper layer.
• The header contains source and destination IP addresses.
– Checking the routing table to find the routing info (eg. Outgoing interface,
or machine address of the next hop)
– If the packet is larger than MTU, fragment it.
• Note that it is different from L4 segmentation/reassembly
• Router
– Routing the packet by consulting the routing table for each incoming
packet and find the i/f that the packet must be sent to.
• Destination
– Address verification.
– For fragmented frames, wait for all fragmentations then reassemble them
before delivering the packet to the upper layer.
20.65
Network layer at the source, router, and
destination
20.66
Packet Switching
• Data transmitted in small packets
– Typically less than 1500 bytes (why?)
– Longer messages split into series of packets
– Each packet contains a portion of user data plus some
control info
• Control info
– Routing (addressing) info
• Packets are received, stored briefly (buffered) and past on to
the next node
– Store and forward
Use of Packets
Switching Technique
• Why?
20.75
IPv4
The Internet Protocol version 4 (IPv4) is the delivery
mechanism used by the TCP/IP protocols.
20.77
IPv4 datagram format
20.78
IPv4 Header
• Variable length: 20-60 byte (multiple of 4)
• Contains routing information
20.79
IPv4 Format
• Version (4-bit): currently 4.
• Header length (4-bit): the length of the IP header in 4-byte unit.
• Type of Services(TOS):
– This field was not used earlier because of the lack of standard
– DiffServ uses this field for differentiate packet types.
• Total length
– to defines the total length of the datagram including the header in bytes.
– 16-bit number, the maximum IP size is limited to 216 bytes, or 64 Kbytes.
– Total length of data = total length – header length
20.80
IPv4 Format
• Identification
– A source node gives a unique ID to each packet.
– Identification, Flags, Fragmentation offset fields are used for fragmentation (will be covered
later)
• Time to Live (TTL)
– A packet has a limited lifetime in the network to avoid zombie packets.
– Designed to hold a timestamp, and decreased by each router. A packet is discarded by a
router if TTL is zero.
– Revised to hold the maximum number of hops the packet can travel thru the network. Each
router decrements it by one.
• Protocol
– To define payload protocol type
– 1 for ICMP
– 2 for IGMP
– 6 for TCP
– 17 for UDP
– 89 for OSPF
20.81
IPv4 Format
• Header checksum
– An IP header is slightly modified by each router. At least TTL field.
– The checksum must be re-calculated by routers which is a kind of
general computers with more than one network interface.
– The checksum must be efficiently calculated with no need of special
hardware.
• Source address: is the IPv4 address of the source.
• Destination address: is the IPv4 address of the destination.
• Options
– Variable length
– For new protocols
• Padding
– To make the header a multiple of 32-bit words
20.82
Note
20.83
Figure 20.7 Encapsulation of a small datagram in an Ethernet frame
20.84
Figure 20.8 Protocol field and encapsulated data
20.85
Table 20.4 Protocol values
20.86
Example 20.1
Solution
The HLEN value is 8, which means the total
number of bytes in the header is 8 × 4, or 32 bytes.
The first 20 bytes are the base header, the next 12
bytes are the options.
20.88
Example 20.3
Solution
The HLEN value is 5, which means the total
number of bytes in the header is 5 × 4, or 20 bytes
(no options). The total length is 40 bytes, which
means the packet is carrying 20 bytes of data (40 −
20).
20.89
Example 20.4
20.91
MTUs for some networks
20.92
Fragmentation of IP
• The source node usually does not fragment the packet.
Instead, L4 will segment the data into a size that can fit into
L3 and L2 of the source.
• But, there is a possibility that a packet travel thru a link
whose MTU is smaller than one of the source node.
– Then, the packet must be fragmented to go forward the next hop.
– Each fragment has its own header mostly repeated from the
original packet.
– A fragmented packet can be further fragmented into even smaller
packet.
– Fragmented packets will be re-assembled only by the final
destination.
20.93
Fields for Fragmentation
• Identification
– The source host generates the unique ID
• Flags (3-bits)
– Unused bit
– DF bit (Don’t Fragment)
• 1 – force the router not to fragment the packet. If the packet length is greater than the MTU,
the router will discard the packet and send an error message to the source
– MF bit (More Fragment)
• 1 – tell the destination whether or not more fragments follow
• Offset
– Unit of 8-byte
– Between the beginning of the packet to be fragmented and the beginning of the
fragment
• Intelligent Router (Switch) uses these fields for efficiency.
– PPD (Partial Packet Discard)
– EPD (Early Packet Discard)
20.94
Flags (3 bits) used in fragmentation
20.95
Fragmentation example
20.96
Detailed fragmentation example
20.97
1060
20.98
Example 20.5
20.99
Example 20.6
Solution
Because the M bit is 1, it is either the first
fragment or a middle one. Because the offset value
is 0, it is the first fragment.
20.101
Example 20.8
Solution
To find the number of the first byte, we multiply the
offset value by 8. This means that the first byte
number is 800. We cannot determine the number of
the last byte unless we know the length.
20.102
Example 20.9
20.103
IPv4 Checksum
20.104
Example 20.10
20.105
Example of checksum calculation in IPv4
20.106
IPv6
The network layer protocol in the TCP/IP protocol suite
is currently IPv4. Although IPv4 is well designed, data
communication has evolved since the inception of IPv4
in the 1970s. IPv4 has some deficiencies that make it
unsuitable for the fast-growing Internet.
20.107
IPv6: Advantages
20.109
Format of an IPv6 datagram
Priority
Protocol
20.110
Next header codes for IPv6
Priorities for congestion-controlled traffic
20.112
Priorities for noncongestion-controlled traffic
20.113
Comparison between IPv4 and IPv6 packet headers
20.114
Extension header types
Table 20.10 Comparison between IPv4 options and IPv6 extension headers
20.116
TRANSITION FROM IPv4 TO IPv6
20.118
Dual stack
20.120
Figure 20.21 Header translation strategy
20.121
Header translation
Network Layer:
Address Mapping,
Error Reporting,
and Multicasting
ADDRESS MAPPING
21.124
Figure 21.1 Mapping Logical to Physical Address
ARP (address resolution protocol)
21.125
21.126
Note
21.127
Figure 21.2 ARP packet
21.128
21.129
Figure 21.3 Encapsulation of ARP packet
21.130
Figure 21.4 Four cases using ARP
21.131
Note
21.132
Example 21.1
Solution
Figure 21.5 shows the ARP request and reply packets.
Note that the ARP data field in this case is 28 bytes, and
that the individual addresses do not fit in the 4-byte
boundary. That is why we do not show the regular 4-byte
boundaries for these addresses.
21.133
Figure 21.5 Example 21.1, an ARP request and reply
21.134
Figure 21.6 Proxy ARP
21.135
Reverse Address Resolution Protocol (ARP)
21.137
Figure 21.7 BOOTP client and server on the same and different networks
21.138
Note
21.139
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address from network server
when it joins network
Can renew its lease on address in use
Allows reuse of addresses (only hold address while connected an “on”
Support for mobile users who want to join network (more shortly)
DHCP overview:
– host broadcasts “DHCP discover” msg
– DHCP server responds with “DHCP offer” msg
– host requests IP address: “DHCP request” msg
– DHCP server sends address: “DHCP ack” msg
DHCP client-server scenario
A DHCP 223.1.2.1
223.1.1.1
server
223.1.1.2
223.1.1.4 223.1.2.9
B
223.1.1.3 223.1.3.27
223.1.2.2
E arriving DHCP
client needs
223.1.3.2
223.1.3.1 address in this
network
DHCP client-server scenario
DHCP server: 223.1.2.5 arriving
DHCP discover
client
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
time Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
ICMP
The IP protocol has no error-reporting or error-
correcting mechanism. The IP protocol also lacks a
mechanism for host and management queries. The
Internet Control Message Protocol (ICMP) has been
designed to compensate for the above two deficiencies.
It is a companion to the IP protocol.
Topics discussed in this section:
Types of Messages
Message Format
Error Reporting and Query
Debugging Tools
21.143
Figure 21.8 General format of ICMP messages
21.144
Note
21.145
Figure 21.9 Error-reporting messages
21.146
Note
21.147
Figure 21.10 Contents of data field for the error messages
21.148
Figure 21.12 Query messages
21.149
Figure 21.13 Encapsulation of ICMP query messages
21.150
Example 21.2
21.151
Figure 21.14 Example of checksum calculation
21.152
Example 21.3
21.154
Figure 21.15 The traceroute program operation
21.155
“Real” Internet delays and routes
3 probes 3 probes
3 probes
Traceroute Commands
193
INTRA- AND INTERDOMAIN
ROUTING
Routing inside an autonomous system is referred to as intradomain
routing. Routing between autonomous systems is referred to as
interdomain routing.
194
Figure Autonomous systems
195
Figure Popular routing protocols
196
DISTANCE VECTOR ROUTING
In distance vector routing, the least cost route between any two nodes is
the route with minimum distance. In this protocol each node maintains a
vector (table) of minimum distances to every node. The table at each node
also guides the packets to the desired node by showing the next stop in the
route (next-hop routing.
Initialization
Sharing
Updating
When to Share
Two-Node Loop Instability
Three-Node Instability
197
Figure Distance vector routing tables
198
Figure Initialization of tables in distance vector routing
199
In distance vector routing, each node
shares its routing table with its
immediate neighbors periodically and
when there is a change.
200
Figure Updating in distance vector routing
201
Figure Two-node instability
202
Figure Three-node instability
203
RIP
The Routing Information Protocol (RIP) is an intradomain routing
protocol used inside an autonomous system. It is a very simple protocol
based on distance vector routing.
205
RIP uses the services of UDP on
well-known port 520.
Each router floods this info (via a Link State Packet) to other
routers periodically (when there is a change in the topology,
or every 60 to 120 minutes).
209
Figure 14.17 Dijkstra algorithm
210
Figure 14.18 Example of formation of shortest path tree
214
Figure Types of links
215
Figure Point-to-point link
216
Figure Transient link
217
Figure Stub link
218
Figure Example of an AS and its graphical representation in OSPF
219
Table Link types, link identification, and link data
Initialization
Sharing
Updating
224
BGP
Border Gateway Protocol (BGP) is an interdomain routing protocol using
path vector routing. It first appeared in 1989 and has gone through four
versions.
225
Figure Internal and external BGP sessions
227
Figure BGP packet header
228
Figure Open message
229
Figure Update message
230
BGP supports classless addressing and
CIDR.
231
Figure Keepalive message
232
Figure Notification message
233
Table Error codes
234
BGP uses the services of TCP
on port 179.
235
Chapter 14
INTRODUCTION
MULTICAST ROUTING
MULTICAST TREES
MULTICAST ROUTING PROTOCOLS
DVMRP
MOSPF
CBT
PIM
MBONE
236
Figure 14-1
237
Figure 14-2
Multicasting
In multicast routing,
the router may forward the
received packet
through several of its interfaces.
238
Figure 14-3
239
Application of Multicasting
• Access to Distributed Databases
• Information Dissemination: e.g. multicast
software updates to customers
• News Delivery
• Teleconferencing, Web Seminars
• Distant Learning
240
14.3 Multicast Routing
Objectives
• Every member receives EXACTLY ONE copy of the packet
• Non-members receive nothing
• No loops in route
• Optimal path from source to each destination.
Terminology
• Spanning Tree: Source is the root, group members are the
leaves.
• Shortest Path Spanning Tree: Each path from root to a leaf
is the shortest according to some metric
241
14.3 Multicast Trees
• Source-Based Tree:
– For each combination of (source , group), there is a shortest
path spanning tree.
– Approach 1: DVMRP; an extension of unicast distance vector
routing (e.g. RIP)
– Approach 2: MOSPF; an extension of unicast link state
routing (e.g. OSPF)
• Group-Share Tree
– One tree for the entire group
– Rendezvous-Point Tree: one router is the center of the
group and therefore the root of the tree.
• CBT and PIM-SP protocols.
242
Figure 14-4
243
14.5 Distance Vector Multicast Routing
Protocol - DVMRP
• No pre-defined route from source to destination.
Tree is gradually created by successive routers along
the path.
• Uses shortest path (fewest hops)
• Prevent loops: apply Reverse Path Forwarding (RFP)
• Prevent Duplication: apply Reverse Path
Broadcasting (RPB)
• Multicast with dynamic membership: apply Reverse
Path Multicasting (RPM) with pruning, grafting, and
lifetime.
244
Figure 14-5
245
Figure 14-6
246
Figure 14-7
• The router with the shortest path to the source becomes the
designated parent of a network
• A Router forwards packets only to its designated child networks
247
RPB creates a shortest path
broadcast tree from the source
to each destination.
It guarantees that each destination
receives one and only
one copy of the packet.
248
Figure 14-8
249
14.6
MOSPF
250
Figure 14-9
251
14.7
Core-Based Tree
CBT
252
Figure 14-10
253
Figure 14-11
Sending a multicast packet to
the rendezvous router
254
In CBT, the source sends the
multicast packet (encapsulated in a
unicast packet) to the core router.
The core router decapsulates the
packet and forwards it
to all interested hosts.
255
Chapter 23
Process-to-Process Delivery:
UDP, TCP, and SCTP
23.256
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
23-1 PROCESS-TO-PROCESS DELIVERY
23.258
Figure 23.1 Types of data deliveries
23.259
Figure 23.2 Port numbers
23.260
Figure 23.3 IP addresses versus port numbers
23.261
Figure 23.4 IANA ranges
23.262
Figure 23.5 Socket address
23.263
Figure 23.6 Multiplexing and demultiplexing
23.264
Figure 23.7 Error control
23.265
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP suite
23.266
23-2 USER DATAGRAM PROTOCOL (UDP)
23.268
Example 23.1
23.269
Example 23.1 (continued)
SNMP uses two port numbers (161 and 162), each for a
different purpose, as we will see in Chapter 28.
23.270
Figure 23.9 User datagram format
23.271
Note
UDP length
= IP length – IP header’s length
23.272
Figure 23.10 Pseudoheader for checksum calculation
23.273
Example 23.2
23.274
Figure 23.11 Checksum calculation of a simple UDP user datagram
23.275
Figure 23.12 Queues in UDP
23.276
23-3 TCP
23.278
Figure 23.13 Stream delivery
23.279
Figure 23.14 Sending and receiving buffers
23.280
Figure 23.15 TCP segments
23.281
Note
The bytes of data being transferred in each connection are numbered by TCP.
The numbering starts with a randomly generated number.
23.282
Example 23.3
23.283
Note
The value in the sequence number field of a segment defines the
number of the first data byte
contained in that segment.
23.284
Note
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.
23.285
Figure 23.16 TCP segment format
23.286
Figure 23.17 Control field
23.287
Table 23.3 Description of flags in the control field
23.288
Figure 23.18 Connection establishment using three-way handshaking
23.289
Note
A SYN segment cannot carry data, but it consumes one sequence number.
23.290
Note
A SYN + ACK segment cannot
carry data, but does consume one
sequence number.
23.291
Note
An ACK segment, if carrying no data, consumes no sequence number.
23.292
Figure 23.19 Data transfer
23.293
Figure 23.20 Connection termination using three-way handshaking
23.294
Note
The FIN segment consumes one sequence number if it does
not carry data.
23.295
Note
The FIN + ACK segment consumes
one sequence number if it
does not carry data.
23.296
Figure 23.21 Half-close
23.297
Figure 23.22 Sliding window
23.298
Note
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.
23.299
Example 23.4
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to A.
23.300
Example 23.5
Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
23.301
Example 23.6
23.302
Figure 23.23 Example 23.6
23.303
Note
23.305
Note
In modern implementations, a retransmission occurs if the retransmission timer
expires or three duplicate ACK segments have arrived.
23.306
Note
No retransmission timer is set for an ACK segment.
23.307
Note
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.
23.308
Figure 23.24 Normal operation
23.309
Figure 23.25 Lost segment
23.310
Note
The receiver TCP delivers only ordered data to the process.
23.311
Figure 23.26 Fast retransmission
23.312
23-4 SCTP
23.314
Table 23.4 Some SCTP applications
23.315
Figure 23.27 Multiple-stream concept
23.316
Note
An association in SCTP can involve multiple streams.
23.317
Figure 23.28 Multihoming concept
23.318
Note
SCTP association allows multiple IP addresses for each end.
23.319
Note
In SCTP, a data chunk is numbered using a TSN.
23.320
Note
To distinguish between different streams, SCTP uses an SI.
23.321
Note
To distinguish between different data chunks belonging to the same stream, SCTP
uses SSNs.
23.322
Note
TCP has segments; SCTP has packets.
23.323
Figure 23.29 Comparison between a TCP segment and an SCTP packet
23.324
Note
In SCTP, control information and data information are carried in separate chunks.
23.325
Figure 23.30 Packet, data chunks, and streams
23.326
Note
Data chunks are identified by three items: TSN, SI, and SSN.
TSN is a cumulative number identifying the association; SI defines the stream; SSN
defines the chunk in a stream.
23.327
Note
In SCTP, acknowledgment numbers are used to acknowledge only data chunks;
control chunks are acknowledged by other control chunks if necessary.
23.328
Figure 23.31 SCTP packet format
23.329
Note
In an SCTP packet, control chunks come before data chunks.
23.330
Figure 23.32 General header
23.331
Table 23.5 Chunks
23.332
Note
A connection in SCTP is called an association.
23.333
Note
No other chunk is allowed in a packet carrying an INIT or INIT ACK chunk.
A COOKIE ECHO or a COOKIE ACK chunk can carry data chunks.
23.334
Figure 23.33 Four-way handshaking
23.335
Note
In SCTP, only DATA chunks
consume TSNs;
DATA chunks are the only chunks
that are acknowledged.
23.336
Figure 23.34 Simple data transfer
23.337
Note
The acknowledgment in SCTP defines the cumulative TSN, the TSN of the last data
chunk received in order.
23.338
Figure 23.35 Association termination
23.339
Figure 23.36 Flow control, receiver site
23.340
Figure 23.37 Flow control, sender site
23.341
Figure 23.38 Flow control scenario
23.342
Figure 23.39 Error control, receiver site
23.343
Figure 23.40 Error control, sender site
23.344