CCM 4300 Lecture 7
Computer Networks, Wireless and Mobile
Communications
Dr Shahedur Rahman
[email protected]
Room: T115
Recap of Last Session
Described different types of routing protocols
Explained Ethernet and its frame structure
Explained in details CSMA/CD and Token
Passing
Session Content
Virtual Circuit and Datagram
Internet Protocol
Addressing
TCP
UDP
Application protocol
3
Lesson objectives
At the completion of this lesson you should be
able to
understand the basics concepts of Virtual
Circuit and Datagram
understand the IP protocol
describe the basics of the TCP and UDP
protocol
Where are we?
4
Application Layer
3
Transport Layer
2
Internet Layer
Defines the datagram and handles
the routing of data
Network Access Layer
5
The Internet Network layer
Host, router network layer functions:
Application layer: FTP, Telnet, DNS, SMTP, POP, SNMP, etc
Transport layer: TCP, UDP
Network
layer
IP protocol
addressing conventions
datagram format
packet handling conventions
Routing protocols
path selection
RIP, OSPF, BGP
routing
table
ICMP protocol
error reporting
router signaling
Network access layer
6
The Internet Network layer - cont
||| Heart and soul of the Internet Protocol, the IP of TCP/IP.
||| Transfers user messages from source to destination host.
||| Connectionless datagram service.
||| Performs fragmentation and re-assembly of datagrams.
||| Relies on routers and switches.
||| Integral part is Internet Control Message Protocol (ICMP)
- uses an IP datagram to carry messages about the
state of communication environment
7
Network layer functions
||| transport packet from sending to
application
transport
receiving hosts
network
data link
||| network layer protocols in
physical
every host, router
Three important functions:
||| path determination: route taken by
packets from source to destination
Routing algorithms
||| switching: move packets from
routers input to appropriate router
output
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
application
transport
network
data link
physical
||| call setup: some network architectures require
router call setup along path before data flows
8
Network service model
Q: What service model
for channel
transporting packets
from sender to receiver?
guaranteed bandwidth?
preservation of inter-packet
timing (no jitter)?
loss-free delivery?
in-order delivery?
congestion feedback to
sender?
The most important
abstraction provided
by network layer:
? ?
?
virtual circuit
or
datagram?
Virtual circuits
source-to-dest path behaves much like
telephone circuit
performance-wise
network actions along source-to-dest path
||| call setup, teardown for each call before data can flow
||| each packet carries VC identifier (not destination host ID)
||| every router on source-dest. paths maintain state for
each passing connection
- transport-layer connection only involved two end systems
||| link, router resources (bandwidth, buffers) may be
allocated to VC
- to get circuit-like perf.
10
Datagram or VC network: why?
Datagram
||| data exchange among computers
- elastic service, no strict timing req.
||| smart end systems (PCs)
- can adapt, perform control, error
recovery
- simple inside network, complexity at
edge
||| many link types
- different characteristics
- uniform service difficult
VC network
||| evolved from telephony
||| human conversation:
- strict timing, reliability
requirements
- need for guaranteed service
||| dumb end systems
- telephones
- complexity inside network
11
IPv4 Addresses
||| IP address: 32-bit identifier for host, router interface
32 Bits
Class B
Network ID
Host ID
w. x. y. z.
Example:
131.107.3.24 =
10000011 01101011 00000011 00011000
131
107
24
||| Interface: connection between host, router and physical link
routers typically have multiple interfaces
IP addresses associated with interface, not host, router
12
IP Addresses - cont
||| class-full addressing:
class
Large Networks A
0 network
Medium-sized B
10
Small networks C
110
1110
1.0.0.0 to
127.255.255.255
host
network
128.0.0.0 to
191.255.255.255
host
network
multicast address
host
192.0.0.0 to
223.255.255.255
224.0.0.0 to
239.255.255.255
32 bits
13
IP Addresses - cont
Number
of Networks
Number of Hosts
per Network
Range of
Network IDs
(First Octet)
Class A
126
16,777,214
1 126
Class B
16,384
65,534
128 191
Class C
2,097,152
254
192 223
14
IP Addresses - cont
Router
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.3.1
223.1.3.27
223.1.2.9
223.1.2.2
223.1.3.2
15
Addressing Guidelines
||| Network ID Cannot Be 127
- 127 is reserved for loopback functions (A zone that
enables the server to direct traffic to itself. The host
number is almost always 127.0.0.1.)
||| Network ID and Host ID Cannot Be 255 (All Bits Set to 1)
- 255 is a broadcast address
||| Network ID and Host ID Cannot Be 0 (All Bits Set to 0)
- 0 means this network only
||| Host ID Must Be Unique to the Network
16
IP datagram format
32 bits
||| Version - 4bits
- Current version is 4
||| Internet Header Length (IHL) - 4bits
- To determine the beginning of data .
||| Type of Service (TOS) - 8bits
- first of 3 bits are used to indicate 1 of
8 levels of priority (e.g. ftp, http, etc)
||| Total length - 16 bits
- length of IP datagram
- The size of data is computed from
the total length field and IHL .
- theoretical 65,535 bytes since 16bit
ver
IHL
TOS
16-bit identifier
time to
live
upper
layer
flgs
length
fragment
offset
Internet
checksum
32 bit source IP address
32 bit destination IP address
Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
17
IP datagram format - cont
32 bits
||| Identification - 16 bits
- to identify all fragments of a
datagram.
||| Flags - 3 bits
- 2 bits - to control fragmentation
- 1 bit - unused
||| Fragment Offset - 13 bits
- Used in a fragmented datagram to
indicate the position that the fragment
occupies. Measured in 64 bit units.
ver
IHL
TOS
16-bit identifier
time to
live
flags
upper
layer
length
fragment
offset
Internet
checksum
32 bit source IP address
32 bit destination IP address
Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
18
IP datagram format - cont
||| Time To Live (TTL) - 8 bits
- prevents datagrams to get routed in a
loop .
- If its set to 0 , a router should discard
the datagram.
||| Protocol - 8 bits
- The transport layer protocol carried by
this datagram: 17 - UDP
6 - TCP, 1 ICMP
||| Header checksum - 16 bits
It protects only the header and not the
data;
recalculated every time it passes
through a router.
||| Options allows an IP header to be
extended, used rarely.
||| Data: Max. 65,535 (32 bit) bytes in
length.
32 bits
ver
IHL
TOS
16-bit identifier
time to
live
flags
upper
layer
length
fragment
offset
Header
checksum
32 bit source IP address
32 bit destination IP address
Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
19
IP Fragmentation & Reassembly
||| network links have MTU
(max.transfer size) - largest possible
link-level frame.
different link types, different
MTUs
LANs generally 1500 bytes
WANs generally 576 bytes
||| large IP datagram divided
(fragmented) within net
one datagram becomes
several datagrams
reassembled only at final
destination
IP header bits used to identify,
order related fragments
fragmentation:
in: one large datagram
out: 3 smaller datagrams
reassembly
20
Where are we?
4
Application Layer
3
Transport Layer
Provides end-to-end data delivery
services
Internet Layer
1
Network Access Layer
21
The Internet Transport layer
||| Provides end-to-end data delivery services
||| The two most important protocols
Transmission Control Protocol (TCP)
- reliable data delivery service with end-to-end
error correction and detection
User Datagram Protocol (UDP)
- low-overhead, connectionless datagram
||| Applications programmers can choose whichever service is
more appropriate for their specific applications
22
TCP segment structure
32 bits
Ports individually identify
processes /applications. (e.g.
well know ports FTP 21, HTTP
80, IRC (Internet Relay Chat)
194
ACK: ACK #
valid
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
source port #
dest port #
sequence number
acknowledgement number
head not
UAP R S F
len used
checksum
rcvr window size
ptr urgent data
Options (variable length)
application
data
(variable length)
23
TCP segment structure
32-bit sequence no field and 32-bit acknowledgement no field used to
implement a reliable data transfer service
16-bit receiver window field used for flow control
4-bit header length field specifies the length of the TCP header in 32-bit
words. This can be of variable length due to TCP options field
The optional and variable-length options field used to negotiate the
maximum segment size (MSS)
Flag field contains 6 bits
ACK bit used to indicate that the value carried in the
acknowledgement field is valid
RST, SYN, and FIN used for connection setup and teardown
PSH used to indicate, when set, to pass the data to the upper layer
immediately
URG used by the sending side to mark the data as urgent. The
location of the last byte of this urgent data is indicated by the 16-bit
urgent data pointer field
Note: PSH, URG, and the urgent data pointer are not used in practice.
24
TCP connection management
SYN
FIN
Initiates a
connection
Open
SYN +
ACK
time
Accepts and
acknowledges
FIN
ACK
Acknowledges
and begins tx
4. Data flow begins
application
transport
Network
Network
access
3. ACK
2. SYN + ACK
1. SYN
ACK
Three-way
Threehandshake
Close
ACK
4. Receive data
3. ACK
application
2. SYN + ACK transport
Network
1. SYN
Network
access
25
TCP seq. #s and ACKs
Seq. #s:
byte stream
number of first
byte in segments
data
ACKs:
seq # of next byte
expected from other
side
cumulative ACK
Host A
User
types
C
Host B
host ACKs
receipt of
C, echoes
back C
host ACKs
receipt
of echoed
C
time
simple telnet scenario
26
TCP characteristics
||| A message is transmitted and then a positive
acknowledgement is being waited for
||| If the positive acknowledgement does not arrive in
certain period of time, the message is retransmitted
||| Messages are numbered in sequence so that no one is
being lost or duplicated
||| Messages are delivered at the destination in the same
order they were sent by the source
27
TCP characteristics - cont
||| If data stream too large, the TCP protocol will split it
into several fragments and it makes sure that all the
fragments arrive correctly at the other end for
reassembly
||| TCP can be viewed as forming a library of routines
that many applications can use when they need
reliable network communication with an application
on another computer
||| TCP provides also flow control and congestion
control
28
User Datagram Protocol (UDP)
||| no frills, bare bones
Internet transport protocol
||| best effort service, UDP
segments may be:
- lost
- delivered out of order to
application
||| connectionless:
- no handshaking between
UDP sender, receiver
- each UDP segment
handled independently of
others
Why is there a UDP?
||| no connection establishment
(which can add delay)
||| simple: no connection state
at sender, receiver
||| small segment header
(8bytes)
||| no congestion control: UDP
can blast away as fast as
desired
29
User Datagram Protocol (UDP) cont
||| often used for streaming
multimedia apps
- loss tolerant
Length, in
bytes of UDP
- rate sensitive
segment,
||| reliable transfer over UDP:
including
add reliability at application
header
layer
- application-specific error
recover!
32 bits
source port #
dest port #
length
checksum
Application
data
(message)
UDP segment format
30
User Datagram Protocol (UDP) cont
application
transport
Network
Network
access
1. Send data
application
transport
2. Receive data Network
Network
access
31
UDP checksum
Goal: detect errors (e.g., flipped bits) in
transmitted segment
Sender:
||| treat segment contents as
sequence of 16-bit integers
||| checksum: addition (1s
complement sum) of
segment contents
||| sender puts checksum
value into UDP checksum
field
Receiver:
||| compute checksum of received
segment
||| check if computed checksum
equals checksum field value:
- NO - error detected
- YES - no error detected.
32
Question?
You are mapping out the transmission of packets from one station to another
(TCP is used). Packets 1-10 are sent. Packets arrived in the following order:
3,4,2,5,1,8,7,10,9. What packets will be acknowledged and what, if any, will
need to be retransmitted?
A.
Packets 5 and 10 will be acknowledged, and 6 will need to be transmitted
B.
Packet 5 will be acknowledged and 6-10 will need to be retransmitted
C.
Packets 1-5 and 7-10 will be acknowledged, and 6 will need to be
retransmitted.
D.
All will be acknowledged and none will need to be retransmitted since 6
can be created based on information in the other packets.
Answer B: The highest packet received will be acknowledged. None of the
packets above 6 can be acknowledged until 6 has been received since only an
acknowledgement was sent for 5 that tells that the sending stations 1-5 were
received and something has happened after that; therefore it will resend 6-10.
33
Where are we?
4
Application Layer
Consists of applications and
processes that use the network
Transport Layer
2
Internet Layer
1
Network Access Layer
34
Application and application-layer protocols
||| Application: communicating,
distributed processes
running in network hosts in user
space
exchange messages to
implement application
e.g., email, ftp, Web
||| Application-layer protocols
one piece of an application
define messages exchanged by
apps and actions taken
use communication services
provided by lower layer
protocols (TCP, UDP)
e.g., http defines how
messages are passed between
browser and web server
application
transport
network
data link
physical
application
transport
network
data link
physical
application
transport
network
data link
physical
35
Summary
Virtual Circuit and Datagram
Internet Protocol
Addressing
TCP
UDP
Application protocol
36