Title: TCP, UDP, IP
1Chapter 4
TCP, UDP, IP
2TCP/IP Protocol Suite
- De-facto standard for open system
interconnection. - Provide highest degree of interoperability.
- Usually resides in O/S, shared by all application
programs running on the machine.
3An Internet According to TCP/IP
4TCP/IP and the OSI Model
5RFC (Request for Comments)
- Documentation for TCP/IP Protocols
- Available on-line from
- - Network Information Center, www.nic.mil
- - other mirror sites
- Examples
- - IP, RFC 760
- - TCP, RFC 761
- - FTP, RFC 959
- - HTTP, RFC 2068
6IP (Internet Protocol)
- Described in RFC 760.
- Responsible for communication at the computer
level (i.e. host-to-host communication). - Best-try datagram (or connectionless) service.
- Data transferred across the Internet (datagram)
is self-contained, individually-addressed. - IP is independent of underlying network
technologies. - IP address is used to determine the source and
destination of a datagram. - Operate in layer 3 (network layer) of the OSI
model.
7IP Datagram
8- VER
- Defines version of the IP.
- HLEN (Header length)
- Defines the length of the datagram header in
4-btye words. - TOS (Type of Service)
- For specifying special handling of the packet
Replaced by Differentiated Services to handle the
shortcomings of Integrated Services. - Total Length
- Defines the total length (header plus data) of
the IP datagram in bytes. - Identification, Flags, Fragmentation offset
- These fields are related to fragmentation and
reassembly of an IP diagram.
9- Time To Live (TTL)
- Defines the maximum time for which a datagram is
allowed to be in transit across the Internet.
But, in practice, it counts hops. - Protocol
- Defines the higher-level protocols that uses the
services of the IP layer - e.g. TCP (6), UDP(17), OSPF(89).
- Checksum
- It covers only the header, not the data.
- Source IP address
- Defines the IP address of the source.
- Destination IP address
- Defines the IP address of the destination.
- Option
- Used for network testing and debugging.
10Example of checksum calculation
11Maximum Transmission Unit ( MTU)
12Fragmentation example
13Internet Address
14Internet Classes
15IP Address Range
16Private Address
- Address ranges defined for use within private
intranets - Can be used without registration
- Class A
- 10.0.0.0 to 10.255.255.255
- Class B
- 172.16.0.0 to 172.31.255.255
- Class C
- 192.168.0.0 to 192.168.255.255
17Network and Host Addresses
18A Network with Two Levels of Hierarchy
19A Network with Three Levels of Hierarchy
20Subnetwork Address
- Allow standard class address to be further
subdivided for routing within an organization. - Subnet mask is used to divide a network into
subnets. - Cannot define all 0s or all 1s as a host
number - - all 0s is the subnetid
- - all 1s is the subnet broadcast address
21 Example 1
- Determine the netid, subnetid, hostid, subnet
broadcast address of the following IP address - 10.84.60.5 / 255.240.0.0
- Answer
- netid 10
- subnetid 10.80.0.0
- hostid 4.60.5
- subnet broadcast 10.95.255.255
22 Example 2
- With the following subnet assignment, list all
available subnet addresses - 192.60.20.0 / 255.255.255.224
-
- Answer
- 192.60.20.32, 192.60.20.64
- 192.60.20.96, 192.60.20.128
- 192.60.20.160, 192.60.20.192
23Transport Layer Process-to-Process Delivery
24Port numbers
25IP addresses versus port numbers
26Socket address
IANA ranges
27Well-known ports used by TCP
28Well-known ports used by UDP
29TCP (Transmission Control Protocol)
- Described in RFC 761.
- Responsible for delivery of the message to the
appropriate program (process-to-process
communication). - Provide a reliable, end-to-end, byte stream (data
pipe) over an unreliable internetwork. - Operate in layer 4 (transport layer) of the OSI
model. - Default segment size 556 bytes (20 536).
- Error-detection by CHECKSUM field.
- Flow-control by Sequence No., Acknowledgement No.
and Window Size.
30TCP Segment Format
31- Source port address
- Defines the port number of the application
program in the sending host. - Destination port address
- Defines the port number of the application
program in the receiving host. - Sequence number
- Defines the number assigned to the first byte of
data contained in the segment. - Acknowledgement number
- Defines the byte number that the sender of the
segment is expecting to receive from the other
party. -
- Header length
- Indicates the number of 4-byte words in the TCP
header.
32- Reserved
- Reserved for future use.
- Control bits
- One or more of these bits can be set at a time.
These bits enable flow control, connection
establishment and termination, and the mode of
data transfer in TCP. - Windows size
- Defines the size of window in bytes.
- Checksum
- Used to detect errors over the entire segment
(header plus data). - Urgent pointer
- It is used when the segment contains urgent data.
The number is added to the sequence number to
obtain the number of the last urgent byte in the
data section of the segment. - Options
- Up to 40 bytes of option information.
33Description of flags in the control field
34Example 1
Imagine a TCP connection is transferring a file
of 6000 bytes. The first byte is numbered 10010.
What are the sequence numbers for each segment if
data are sent in five segments with the first
four segments carrying 1000 bytes and the last
segment carrying 2000 bytes?
Solution
The following shows the sequence number for each
segment Segment 1 gt sequence number
10,010 (range 10,010 to 11,009) Segment 2
gt sequence number 11,010 (range 11,010 to
12,009) Segment 3 gt sequence number
12,010 (range 12,010 to 13,009) Segment
4 gt sequence number 13,010 (range 13,010 to
14,009) Segment 5 gt sequence number
14,010 (range 14,010 to 16,009)
35Three-step connection establishment
36Four-step connection termination
37Sliding 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. TCPs sliding windows are
byte-oriented. - In TCP, the sender window size is totally
controlled by the receiver window value (the
number of empty locations in the receiver
buffer). However, the actual window size can be
smaller if there is congestion in the network.
38Lost segment
39Lost acknowledgment
40UDP (User Datagram Protocol)
- Described in RFC 768.
- UDP is a connectionless, unreliable protocol that
has no flow and error control. It uses port
numbers to multiplex data from the application
layer. - The calculation of checksum and its inclusion in
the user datagram are optional. - UDP is a convenient transport-layer protocol for
applications that provide flow and error control.
It is also used by multimedia applications.
41UDP Datagram Format
42Why UDP?
- Simple
- Less overhead, 8 bytes header in UDP vs 20 bytes
header in TCP - No acknowledgement, therefore much less delay in
communication. - Less computer resources requirement, e.g.
buffers.
43Common UDP Applications
- Characteristics of UDP applications
- single packet based transaction (request, reply
or update) - distributed servers
- no pre-determined server
- loss of packets does not affect service
- Examples SNMP, BOOTP, DNS, DHCP, RIP