Escolar Documentos
Profissional Documentos
Cultura Documentos
Distributed
Information Systems
LEC T UR E 9 – N E T WORKING BAS I CS : OS I MODE L
BA S E D ON AG R AWA L A N D S HA R MA , P ROS PEC T P R ESS
Agenda
1. Networking overview
2. Physical layer
3. Data link layer
4. Network layer
5. Transport layer
6. Application layer
7. Wide area networks
2
1. Networking overview
• Definition
• Utility of computer networking
• Technology milestones
• Packetization
• Layering
• TCP/ IP model
• OSI model
• Principles of Internet protocols
3
Typical data network
ISP network
Optical fiber
Campus network
Home
network
Web server
Unique features of computer
networks
• Common set of technologies support all networked computer
applications
◦ Email, IM, browsing, client-server etc
◦ Therefore, any laptop can perform all these functions
6
Packetization overview
• Packetization is
◦ breaking down user data into small segments
◦ packaging these segments appropriately so that they can be delivered and
reassembled across the network
7
Packets analogy
Packet Letter
• Ease of transport
11
Layering
• Arranging functionality in a hierarchical manner, such that
◦ lower layers provide functions and services that support the functions and
services of higher layers
12
Layering examples
• Example (software) Analysts,
regulators,
◦ Similarly, computer applications shareholders
Worker
Machines,
tools, work
13
Advantages of layering
• Specializes technology development
• Separation of functionality
◦ Simplification in upgrades
◦ Change from IPv4 to IPv6 does not require change in email clients or
browsers
14
Layering in data
communication
16
Typical packet structure
• These and other related datacomm tasks are accomplished by adding
additional required information to information packets
◦ Packet header
◦ Organized in a layered structure
◦ Routers and end stations use this header information to handle packets
appropriately
17
Important header information
Networking task Header information
Signaling None
Typical packet structure
• A typical packet contains
◦ Information sent from the layers above
◦ and
◦ Additional information (called headers) specific to the functions of each layer
◦ At a high level, looks like this:
User commands
Error check
Destination
Sequence
address
number
User data
19
5-layered TCP/ IP stack
• Modern computer networks implement layering in 5 layers
• Called the TCP/ IP stack
◦ After the core set of technologies
◦ TCP
◦ IP
20
Layer names and tasks
Layer Layer name Networking task Header information
number
5 Application Specify user needs User commands
• Multiple applications could use the Internet, including those not yet
conceived
– This translates to multiple applications using the same TCP/ IP services for
connectivity
22
Principles of Internet protocols
• Standardized message block to serve any application
-- Baran 1964
◦ Simplifies design of network equipment
◦ All network traffic can be processed in a cookie-cutter manner by routers,
irrespective of application
23
TCP/ IP technologies by layer
Application Application
Application Application Application Application Application layer layer
layer layer layer layer layer
SIP NFS/ SMB
HTTP SMTP FTP SSH IM (File & printer
(VoIP) sharing)
Transport Transport
layer layer
TCP UDP
Network
layer
IP
24
A typical computer network
Legend
Peer
in g po
int
Wireless link
Campus backbone
Optical fiber
Department LAN
Wireless SONET
router
link
(DNS
and Home PC Web server
DHCP
server)
Router
25
Standards reference
• Internet technology standards are publicly available as
Requests For Comment (RFCs)
◦ http://www.ietf.org/rfc.html
• Highly recommended standards
◦ Email: http://www.ietf.org/rfc/rfc0821.txt
◦ HTTP: http://www.ietf.org/rfc/rfc2616.txt
◦ TCP: http://www.ietf.org/rfc/rfc0793.txt
◦ IP: http://www.ietf.org/rfc/rfc0791.txt
◦ TCP/ IP tutorial: http://www.ietf.org/rfc/rfc1180.txt
◦ Domain names: http://www.ietf.org/rfc/rfc1034.txt
26
2. Physical layer
• Functions of the Physical Layer
• Physical media and their properties
• Signals and their properties
• Importance of binary signals
• Signal representation of data
• Multiplexing
27
Physical layer service
definition
• Provide transparent transmission of a bit stream over a circuit built
from some physical communications medium
• ATIS Telecom glossary
◦ http://www.atis.org/glossary/default.aspx
◦ Earlier versions
◦ Federal Standard 1037C
◦ http://www.its.bldrdoc.gov/fs-1037
◦ ANS T1.523-2001, Telecom Glossary 2000
◦ http://www.atis.org/tg2k/
28
The need for signals
• Data cannot be transmitted
◦ E.g. How will you send a word document over a long distance?
Physical layer
data to signal
transforms
Physical layer
+5V
Signal representation of data
-5V
1 0 0 0 1 1 0 0
Ethernet cable
30
Special feature of the Physical Layer
• Physical layer interacts with nature
– Layer where we are at the mercy of nature
– Depend upon wires, optical fibers or air to transmit signals
• Signal transmitting properties of chosen media are important
• Signals generated by physical layer comply with properties of the medium
• E.g. voltages with copper, light with fiber
31
Physical media and their
properties
• The physical medium is the transmission path along which a signal
propagates
– e.g.: a wire pair, coaxial cable, optical fiber, radio path
• Media are chosen for their special properties that enable efficient
transmission (movement) of signals
– e.g.: most plastics cannot be used as physical media because they do not
efficiently conduct electricity, light, heat or other forms of energy
– Common media are copper wire and optical fiber
32
Copper wire as physical
medium
• Copper is a very good conductor of electricity and is relatively
abundantly available
33
Categories of UTP cables
Cat 3 cable
Cat 5 cable
34
Cable connectors
• Cat5e cables end in RJ 45 connectors
Conductor identification Color code Use
Pair 1 White-Blue/ Blue -
Pair 2 White-Orange/ Orange Transmit data
Pair 3 White-Green/ Green Receive data
Pair 4 White-Brown/ Brown -
PAIR 3
1 2 3 4 5 6 7 8
W-O O W-G BL W-BL G W-BR BR
35
Optical fiber as physical
medium
• Optical fiber is a thin strand of glass that guides light along its length
◦ Can carry large volumes of data over long distances
◦ Weighs much less than copper
◦ Hence dominant in long distance communications
Switch
Copper cables
Cladding
Core
Coating
Strengthening
fibers
38
Data vs. Signals
• Data:
◦ Representation of facts in a formalized manner suitable for
communication, interpretation, or processing by humans or by
automatic means
◦ e.g.: thoughts in humans or numbers in computer spreadsheets
• Signal:
◦ Detectable transmitted energy that can be used to carry information
or
◦ A time-dependent variation of a characteristic of a physical
phenomenon, used to convey information
◦ e.g.: voice in humans or wire voltage in computer networks
39
Impact of noise on signals
Transmitted signal Received signal
Signal value
Signal value
1 2 3 4 1 2 3 4
• The received signal can get seriously affected by noise. The receiver has to be
able to interpret the result correctly for reliable data transmission
40
Need for binary signals
• Computer systems use binary 2-level signal transmitted
representation for all data
Signal value
◦ Helps reliable reception in the
presence of noise 1 2 3 4
Data = 0 3-level
Datasignal
=1 transmitted
Data = 2 Data = 0
Signal value
1 2 3 4
Bit period
41
Binary signals 2-level signal + noise
• Detection rule for 2 level signal
(binary)
Signal value
◦ If amplitude < first gridline,
data = 0 1 2 3 4
else data = 1
• Detection rule for 3 level signal
(ternary)
◦ If amplitude < first gridline, Bit period
else data = 2
1 2 3 4
42
Shannon’s theorem (not for tests)
• How much data can you send over a medium?
◦ Defined by the Shannon-Hartley theorem
𝑆
◦ 𝐶 = 𝐵. 𝑙𝑜𝑔2 (1 + )
𝑁
◦ C is the channel capacity in bits/ second
◦ B is the channel bandwidth in Hertz
◦ S and N are the signal and noise levels in Watts
◦ S/N ratio commonly known as the signal-to-noise ratio (SNR)
Hertz
• Unit of frequency
◦ One cycle per second
• Phone line
◦ Sends signals in frequency range 0Hz – 3,400 Hz
◦ Bandwidth = 3,400 – 0 = 3,400 Hz
Signaling
• Sending data as signals
• Consider sending the word “Hello”
• How to send letters h, e, l, l, o on the wire
◦ Sender side
◦ Step 1: Encode letters as binary numbers
◦ Step 2: Modulate carrier signal with binary numbers
◦ Receiver side
◦ Step 3: Demodulate signal into binary numbers
◦ Step 4: Decode binary numbers as letters
45
ASCII code for binary
representation of data
• Standard method to convert characters to binary is ASCII code
◦ Numbers 0-127 represent common characters
◦ http://www.asciitable.com
◦ Decimal to binary conversion shown later (with IP addresses), just accept for
now
46
Unicode
• Used to represent characters in almost all languages
◦ Including over 75,000 Chinese characters
h e l l o
0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1
48
Receiver operation
• The receiver keeps track of bit periods
◦ If a wave is received during the bit period, it is interpreted as 1, otherwise 0
51
Functions of the Data-Link
layer
• ATIS Telecom glossary 2007
◦ Transfer data between devices on the same network
◦ Detect and possibly correct errors that may occur in the Physical Layer
52
Ethernet
• Most common data link layer technology for end users
• Patented in 1977
◦ But, basis of current end user networks
◦ Easily understood
54
Ethernet operation
• A typical end-user network looks like this:
PC A PC B
Wireless laptop
Ethernet network
PC A PC B
B Data Data B
Wireless laptop
Ethernet network
56
Ethernet data transmission
• When PC A wants to send data to PC B, it first adds B’s address before
the data
◦ Like putting a letter in an envelope and putting a To: address on top
◦ This is our first example of packetizing
57
Broadcast in Ethernet
• Signal is transmitted to all stations connected to the wire
– Ethernet operation is based on broadcast
– Signal is transmitted to all stations connected to the wire
– All computers on the network get the packet
– But only B opens it
• Note that the receipt process is different from the mail system
– Ethernet packets go to every computer on the network
– But mail only goes to the intended receiver
58
Packet receipt in Ethernet
Receive and
PC A PC B
process
Data B
Ignore
B Data
Wireless laptop
Ethernet network
Data B
Data B
Ignore
Ignore
File server Network printer
59
Ethernet data reception
• In broadcast, the network does not direct the packet to its correct
destination
– Instead, the packet is simply sent to every computer on the network
• Packet is sure to reach its destination
• Greatly simplifies the technology
• But increases the processing load on each computer on the network
– So, Ethernet cannot be indefinitely large
60
CSMA/ CD - collision
• What if multiple senders want to send data at the same time?
• The outcome is called a collision
• The solution to this problem is called
Carrier Sense Multiple Access with Collision Detection (CSMA/ CD)
61
CSMA/ CD - collision
PC A PC B
A Data
Data B
Wireless laptop
Ethernet network
63
Error detection
• As the packet moves from source to destination, it can get errors
◦ Just as cars can get flat tires from driving
64
Error correction in human
communication
• Some human error-correction techniques
◦ Receiver reads back on telephone
◦ credit card number, phone number etc.
◦ Not reliable in computer networks because of possible error-cancellation
◦ Redundant data
◦ Don’t just say tomorrow
◦ Say tomorrow, Thursday, Nov. 16, 2000
◦ Sender contact information
◦ For clarification if necessary
65
Error correction in computer
communication
• The general approach to error detection in data communications is to
add some meta-data to the original data
◦ The meta-data is generated from the data itself
◦ The receiver can re-compute the meta-data and compare the result with
the meta-data sent by the sender
66
Ethernet frames with CRC
Wireless access point
PC A PC B
67
Ethernet frame structure
• Previous sections show destination address and CRC fields in Ethernet
• Other information also necessary
– E.g.
• source address – destination for replies
• start of frame – alert receiver about packet arrival
• frame length – inform receiver about packet end
68
Ethernet frame structure
Destination
Length/ Type
Preamble
address
address
Source Data from IP layer
FCS
SFD
and
Padding
LSB b0 b1 b2 b3 b4 b5 b6 b7 MSB
69
Ethernet fields
• Preamble: Allows receiver to synchronize with sender
◦ 10101010 10101010 10101010 10101010 10101010 10101010 10101010
◦ Bit pattern produces a periodic waveform in the medium when encoded by
the physical layer using Manchester encoding
70
Ethernet fields
• Address
◦ 48 bits in length
◦ All 1’s in the destination address is pre-defined to be the broadcast address
on the LAN
◦ Addresses may be universally administered
◦ Assigned by manufacturer
◦ http://standards.ieee.org/faqs/OUI.html
◦ Or locally administered
◦ Assigned by network administrator
71
Ethernet address
representation
72
Ethernet address
• Address
3 Bytes 3 Bytes
LSB b0 b1 b2 b3 b4 b5 b6 b7 MSB
73
Ethernet address
representation
• Hexadecimal notation
◦ Address broken up into 12 4-bit blocks
◦ Each 4-bit block is represented as a hexadecimal digit 0-f
74
Ethernet address
representation
• Example Note: Globally unique
0000 0000 0001 0101 1100 0101 0101 0111 0001 1101 0001 1010
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0 0 1 5 c 5 5 7 1 d 1 a
75
Switched Ethernet - state of
the market
• Hubs vs. switches
• Hubs send data out to all computers
– Old technology, but useful for network diagnostics
• Switches only send the data to the intended destination
– This speeds up the network, at extremely low cost
– The map of computers connected to each port is called the forwarding table
– forwarding table of the switch is initially empty
– By reading the source addresses of incoming frames, switches learn the addresses of the
computers connected to each port
76
From Ethernet to the outside world
Internet
Carrier router
Ethernet LAN
Hub/
Switch
File/ DHCP/ DNS
server
Printer
PCs
77
Next chapter
• Ethernet can reliably send data between computers on one network
• To get bigger networks, we connect networks together
• The network layer figures out how to find the correct path from source
to destination through these networks
◦ Without broadcasting
◦ Called point-to-point
Summary
• Why broadcast?
• Why CSMA/ CD?
• Why CRC?
• Why Switches over hubs?
79
4. Network layer
• Functions of network layer
• Internet protocol (IP)
• IP Header
• IP Addresses
• CIDR notation
• Obtaining IP addresses
• IP version 6
80
Functions of the Network layer
• Transfer variable length data packets from a source network to a
destination network via one or more networks
◦ Can optionally maintain different qualities of service
81
PC
user
IP data
IP destination =
Web server’s IP
address
IP source = PC
Data Link 1
DL destination = R1's
DL address
DL source = PC’s DL
address
(R1)
Router 1
IP data
IP destination =
Web server’s IP
address
IP source = PC
Data Link 2
DL destination = R2's
DL address
DL source = R1's DL
address
(R2)
Router 2
IP data
IP destination =
Web server’s IP
address
IP source = PC
Data Link 3
DL destination = R3's
DL address
DL source = R2's DL
address
(R3)
Router 3
IP data
IP destination =
Web server’s IP
address
IP source = PC
Data Link 4
DL destination = Web
server’s DL address
DL source = R3's DL
address
Functions of the Network layer
82
Web
server
Routing and road trips
• Consider a long distance road trip
• The source and final destination are like network layer addresses
84
IP packet within data link
frame
layer Header
layer FCS
Data-Link
Data-Link
IP Data passed to IP from Transport
Header layer
Data
from IP
layer to
data link
layer
IP Header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Header
Version Type of service Total length
length
Identification Flags Fragment offset
Source address
Destination address
Options Padding
86
IP Addresses
• An address is a unique label that helps locate an entity on a network
• 32-bit values in source and destination address fields
• Every communication interface on every computer on the Internet has
an IP address
• Unlike MAC (Ethernet) addresses, IP addresses are assigned by
network administrators
◦ Provides flexibility in addressing
87
Binary numbers overview
• Binary numbers are extremely important in data communications
◦ IP addresses use binary numbers
88
Using binary numbers
• The most important use of binary numbers in this class is to assign
computer addresses
◦ In this chapter, we focus on assigning computers with a unique label
◦ Using the label to locate the device is covered in the chapters on subnetting and routing
◦ You should be able to determine the maximum number of addresses
possible given the number of binary digits (bits) available for labeling/
addressing
89
Binary numbers as labels
Bits Labels Number of Formula for
labels label count
1 0, 1 ID: 0 ID: 1
2 21
90
Converting from decimal to binary
•Used to compute subnet sizes, broadcast addresses etc.
– You should be comfortable with binary numbers with up to 8 digits
•One technique is to fill-in-the-blanks
– Start with template below
– Place 1 in the leftmost-possible position
– Subtract place-value and repeat until subtraction yields 0
128 64 32 16 8 4 2 1
91
Place values
3 5 8 Digit
100 10 1 Decimal (Base 10)
(102) (101) (100) Place value
1 0 1 Digit
4 2 1 Binary (Base 2)
(22) (21) (20) Place value
Converting from decimal to binary
e.g.: 13310
◦ 128 is less than 133
◦ Hence place 1 over 128, remainder is 133 – 128 = 5
1
128 64 32 16 8 4 2 1
94
Converting from binary to decimal
• Use the same template as before
• Add the place values corresponding to the
locations that have 1 in the number
• E.g.: 111000112
1 1 1 0 0 0 1 1
128 64 32 16 8 4 2 1
1 0 0 1 1 0 1 1
128 64 32 16 8 4 2 1
97
Dotted decimal notation
• IP addresses are written in dotted decimal notation
◦ 32 bit addresses broken into 4 blocks of 8 bits each
◦ Each block converted to decimal representation
◦ Decimals are separated by dots
◦ E.g.. 192.168.1.5
98
IP Addresses (dotted decimal notation)
• Examples
192 . 168 . 1 5
99
IP addresses – structure
• IP addresses are not assigned at random like MAC addresses
– Or even on first-come-first-serve basis
• IP addresses have a structure
– Split into network part and host part
• The first few address bits define the organization to which the address
belongs
– Remaining bits are unique to the computer (host) within the organization
100
IP Addresses - structure
• Network part identifies the network (autonomous
system) to which the address belongs
◦ Most commonly associated with telecom carriers
◦ Also, with large organizations such as state universities
• Host part identifies the host within the network
• Host part is generally broken further into subnets
◦ Subnet ID
◦ Host ID
◦ Covered in subnetting chapter
101
IP addresses - structure
Network/ Organization part of IP address Host part of IP address
Full address 11 Sago St. 13 Sago St. 15 Sago St. 17 Sago St.
Computer address
Computer
addresses
0.0.14.11 0.0.14.13 0.0.14.15 0.0.14.17
Network address: 131.91.0.0
131.91.0.0
103
IP addresses – structure
• Or zip codes
◦ 3 36 47
◦ State group Region Delivery address (PO)
• Visualization at http://benfry.com/zipdecode
104
Special IP Addresses
• 255.255.255.255
◦ Broadcast on local network to which the host is connected
• 0.0.0.0
◦ Default route
• 127.0.0.1
◦ This computer, or localhost
• Reusable addresses
◦ Discussed in support services chapter
105
Obtaining IP addresses
• Regional registries
– IP addresses distributed around the globe
• American Registry for Internet Numbers
– North America and parts of the Caribbean
• RIPE Network Coordination Centre (RIPE NCC)
– Europe, the Middle East and Central Asia
• Asia-Pacific Network Information Centre (APNIC)
– Asia and the Pacific region
• Latin American and Caribbean Internet Address Registry (LACNIC)
– Latin America and parts of the Caribbean region
• African Network Information Centre (AfriNIC)
– Africa
106
Obtaining IP addresses
• Registries prefer allocating large address pools to large carriers
– Simplifies routing
• RFC 2050
– Sec 2.1: ISPs who exchange routing information with other ISPs at multiple
locations and operate without default routing may request space directly
from the regional registry in its geographical area
• Most organizations will obtain IP addresses from these carriers (ISPs)
107
Obtaining IP addresses
• Requesting initial allocation from ARIN
– http://www.arin.net/registration/guidelines/ipv4_initial_alloc.html
• ARIN allocation pre-requisites
– http://www.arin.net/policy/nrpm.html#four
• Assigned network addresses
– RFC 790 (1981)
– http://www.iana.org/assignments/ipv4-address-space (current)
108
IP version 6
• Current version of IP is 4
◦ IPv4 has one major limitation
◦ Running out of IP addresses
◦ Problem particularly acute outside U.S.
◦ Total IPv4 address pool
◦ 232 = 4,294,967,296 (about 4 billion)
◦ Approx 1 IP address per person
◦ But allocation is not very efficient
◦ Could run out of addresses at about 15% utilization
109
IP version 6 overview
• IPv6 defined in RFC 2460
• Primarily expands source and destination address fields
• Also simplifies packet processing at routers
◦ Eliminates header checksum
◦ Modern networks assumed to be fairly robust
110
IP version 6 address pool
• IP version 6 is mainly intended to eliminate shortage of IP addresses
◦ Total address pool = 2128 addresses =
◦ 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses (340 * 1036)
111
IP version 6 header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Source address
Destination address
112
IP version 6 header fields
• Version
◦ 6
• Traffic class
◦ Similar to IPv4 TOS field
◦ Allows sender to specify service priority for data
• Flow label
◦ Allows sender to label a few packets for special handling
113
IP version 6 header fields
• Payload length
◦ Length of data in packet
◦ Similar to total length field in IPv4
• Next header
◦ Transport layer user of IP
◦ Same as protocol field in IPv4
◦ Specified in RFC 1700
• Hop limit
◦ Same as TTL field of IPv4
114
IPv6 addressing example - USF
115
IPv6 addressing example - USF
• Arrived after numerous iterations
◦ First 8 bits in host part are currently reserved
◦ i.e. unused
◦ future-proofing
◦ Remaining bits
◦ First distributed among branch campuses
◦ Each institution partitions available bits according to its needs
116
IPv6 address notation - hex
• 128 bits written as 8 blocks of 4 hex characters each
◦ Each hex character represents 4 bits
◦ Ref: Ethernet chapter
◦ 8*4*4 = 128
◦ E.g. 2001:abcd:2346:1234:a1b5:fedc:0011:35ac
117
IPv6 address compaction rules
• Leading zeros in an individual 16-bit field must be omitted, e.g.
◦ 2001:0db8:aaaa:0000:0000:0000:eeee:0001
◦ Must be written as
◦ 2001:db8:aaaa:0000:0000:0000:eeee:1
118
IPv6 address compaction rules
• :: indicates successive blocks of 0 fields
◦ Can only appear once in an address
◦ Must be used to its maximum capability
119
IPv6 address compaction rules
• When there is a tie for possible uses of ::
◦ First possible occurrence of :: must be used
120
Summary
• Functions of IP
• Why different parts of IP addresses
• Why CIDR
• Obtaining IP addresses
• IP version 6
5. Transport layer
• Need for TCP
• TCP functions
– Segmentation
– Reliability
– Flow-control
– Multiplexing
– Connection establishment
• TCP Header
• UDP
122
The need for a Transport layer
• The network layer (IP) sends packets of data to their correct
destinations with best effort
– Packets may get lost in transit
• Therefore, network layer is not adequate for most applications to
work correctly
• The maximum packet size in IP is 65,536 bytes
– What happens if the application wants to send a file of size 5,000,000
bytes?
– Need to break files into smaller blocks at the sender end and re-assemble these blocks into the
file at the receiving end
• Port addressing
◦ Distinguish between applications on computers
123
The Transport layer in the
stack
Other
Application
http smtp sip application
layer
protocols
Transport
Transport layer
layer
Network
IP
layer
Data Link
Local network
layer
Transport Control Protocol
(TCP)
• These (and other related jobs) are performed by the Transport layer
– TCP (Transmission Control Protocol) is the most popular protocol at the
transport layer
– For simpler tasks, another protocol – UDP is also defined
• TCP is a highly reliable host-to-host transport layer protocol over
packet switched networks
– Defined in RFC 793 (Sep 1981)
125
Transport layer - reference
• TCP
◦ RFC 793 (Sep 1981)
• UDP
◦ RFC 768 (Aug 1980)
126
TCP – Overview of operation
• At the sending end, the application creates the data to be sent and
passes it to its TCP module for transmission
◦ TCP fragments the data, adds sequence numbers to the fragments and
hands them off to IP
• At the receiving end, TCP collects all fragments from IP, reassembles
them into the original data and passes it to the receiving application
127
TCP functions
• TCP provides a reliable application-to-application communication
service over a network of arbitrary complexity and unreliability
◦ Applications (such as browsers and email) simply pass the data to be
transferred to TCP and leave all communication complexities to TCP
128
TCP functions
• TCP corrects for all possible imperfections of IP
• Therefore TCP has to perform many tasks
– Segmentation
– Reliability
– Multiplexing
– Flow-control
– Connection establishment
129
TCP functions - segmentation
• TCP allows IP to transfer arbitrarily large data blocks
◦ Accomplished by breaking data into segments
◦ A sequence number is assigned to each datagram
◦ Sequence numbers help receiver order datagrams even when received out
of order
130
Sequence numbers
Application layer data
To transport layer
transmission
transmission
To IP for
To IP for
To IP for
Sequence number of a TCP sequence number of the previous segment
=
segment + length of previous segment
131
TCP functions - reliability
• TCP recovers from network damage to data
• Basic mechanism
◦ Receiver sends a positive acknowledgment (ACK) if all goes well
◦ If the ACK is not received within a timeout interval, the sender retransmits
the data
132
Sequence numbers and
reliability
Sender Receiver
TCP segment 1
TCP segment 2
TCP segment 2
133
TCP functions - reliability
• Datagrams may get seriously damaged during transmission
◦ If datagrams are further fragmented by IP, some IP fragments may get lost
during transmission
◦ These errors cannot be detected by Ethernet
◦ Such damage is corrected by adding a checksum to each datagram and
comparing it at the receiver
◦ Damaged datagrams are discarded and retransmitted by sender since no ACK is received
134
TCP functions - multiplexing
• Modern computers are capable of multi-tasking
◦ Including simultaneous communication tasks
• TCP supports multiplexing by providing multiple port addresses within
each host
◦ one communication channel per port
• A network address and port address together is called a socket
◦ A pair of sockets uniquely identifies each connection
135
Port addresses and
multiplexing
Windows file share
131.247.95.252
Port 445 (smb)
Port
56244
ru n Gate B25 to
wa
y Lansing, MI
Airport code
GSO
Gate B26 to
Phoenix, AZ
cable
Computer address:
216.149.56.68
Port 1857
IM to MSN
137
TCP port assignment
• On the sender side, the operating system assigns one of the free ports
to an application that requires network connectivity
138
Standard ports
• Standard ports
– Assigned by IANA: Internet Assigned Numbers Authority
• To see list
– In Windows:
• C:/Windows/System32/drivers/etc/services
– In UNIX/ Linux
• /etc/services
139
Standard ports
• Typically ports 1 – 1023 are reserved for defined services
– Applications may use the remaining port numbers 1024 – 65535
• Common ports
– 80 : web (http)
– 25 : email (smtp)
– 443: SSL (https)
– 445: microsoft-ds (smb)
140
etc\services file
141
Viewing ports usage with
netstat
144
V. simple flow control
mechanism
Sender Receiver
TCP segment 1
TCP segment 2
145
TCP functions – flow control
• Flow control mechanism shown earlier is called stop-and-wait
– Sender waits for ACK before sending next datagram
• Very slow
146
TCP flow control with window
size
Sender Receiver
ize 700
Window S
TCP segment 1
147
Sliding window
• Flow control is the regulation by the receiver of the amount of data
the sender may send
• Creates a “sliding window” at the sender
• Packets that have received permission for transmission are within the
window
• Window slides as receiver acknowledges packets or modifies window
size
148
Sliding window
Sender Receiver
Seg 1 Seg 2
SN = 1 SN = 301
ACK 601; Window Size 900
Len = 300 Len = 300
Seg 13 Seg 2 Seg 3 Seg 4 Seg 5 Seg 6
SN = 1 SN = 301 SN = 601 SN = 901 SN = 1201 SN = 1501 More data
Len = 300 Len = 300 Len = 300 Len = 300 Len = 300 Len = 300
Segments
Segments permitted
Segments successfully waiting
for transmission
transmitted for
“SENT window”
permission
Seg 3 Seg 4 Seg 5
SN = 601 SN = 901 SN = 1201
Len = 300 Len = 300 Len = 300
149
TCP Header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Sequence number
Acknowledgment number
U A P R S F
Data offset Reserved R
G
C
K
S
H
S
T
Y
N
I
N
Window
Options Padding
150
TCP header fields
• Port addresses have 16 bits
◦ 216 possible ports
151
User Datagram Protocol (UDP)
• Defined in RFC 768 (1980)
• Many applications do not need TCP, e.g..
152
UDP Header
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
153
Summary
• Why segmentation
• Why sequence numbers
• Why sliding window
• Why port numbers
• Why three-way handshake
• Why UDP
6. Application layer
• Overview of the application layer
• Overview of the Web
155
Application layer overview
• The application layer specifies
◦ End-user activity supported by the protocol
◦ Commands to accomplish protocol functions
156
Application layer in TCP/ IP
stack
User User User User
TCP
IP
Local network
157
Application vs. lower layers
• Unlike lower layers, each supported end-user task has a different
application layer protocol associated with it
◦ SMTP for email, HTTP for web
◦ All use TCP or UDP for data transfer
158
Application protocols
evolution
• These days, HTTP is more popular than these protocols
• New applications are emerging or have become popular
◦ Voice over IP
◦ Instant messaging
◦ Bit-torrent
159
HTTP
• The web is the lay person’s interpretation of the Internet
– Most common service to retrieve information from the Internet
– Uses HTTP
• Any user can access a huge amount of interesting and/ or useful
information across the world using the web
– Coupons/ Comparison shopping
– Facebook/ MySpace
– Assignments
160
Web structure
• The web consists of pages linked to each other through hyperlinks
• Pages are linked to each other through hyperlinks form a web of pages
◦ Linked pages can be anywhere in the world
◦ Hence the name: world wide web
161
Web structure
162
Web pages
• Web pages are written in hypertext markup language (HTML)
163
Web page example
<html>
<head>
<title>HTML 101</title>
</head>
<body>
<h1>Welcome to html page at
<a href = “www.usf.edu”>USF</a> </h1>
<p>Please check back later</p>
</body>
</html>
164
The HTTP protocol
• Defined in RFC 2616 (1999)
• General purpose protocol for data transfer
• Based on request/ response
• Client sends request to server
• Server responds with status code, meta-information and data
• HTTP transaction for web page example is shown
165
HTTP example
166
HTTP features
• Web transfers contain meta information about the data being
transferred
◦ Client knows the data type of the data being transferred – txt/pdf/ jpg etc
167
Content-encoding for
compression
168
URLs
• Web pages are accessed by URLs
◦ Uniform Resource Locator
◦ RFC 1738, 1994
• Syntax
◦ protocol://host [:port ]/[abs_path[?query]]
• Examples
◦ http://www.usf.edu:8080/acad_calendar.html
◦ http://www.usf.edu:8080/grades?fName=joe
◦ http://www.google.com/search?q=usf
169
URL defaults
• To simplify access to web pages, web servers recognize defaults
– http://www.usf.edu is the same as http://www.usf.edu:80/index.asp
• Other default files include index.html, index.php
170
Anatomy of a web request
(chapter 7)
8
hop
Web page sent in response to request
(chapter 4)
(chapter 6)
Router
172