SlideShare ist ein Scribd-Unternehmen logo
1 von 52
1
TCP/IPTCP/IP
2
A. What is TCP/IP?
• TCP/IP is a set of protocols developed to allow
cooperating computers to share resources across a
network
• TCP stands for “Transmission Control Protocol”
• IP stands for “Internet Protocol”
• They are Transport layer and Network layer
protocols respectively of the protocol suite
• The most well known network that adopted
TCP/IP is Internet – the biggest WAN in the world
3
• A protocol is a collection of rules and procedures
for two computers to exchange information
• Protocol also defines the format of data that is
being exchanged
What is a protocol?
4
Why TCP/IP is so popular?
• TCP/IP was developed very early
• Technologies were widely discussed and circulated
in documents called “Request for Comments”
(RFC) – free of charge
• Supported by UNIX operating system
5
TCP/IP Model
• Because TCP/IP was developed earlier than the
OSI 7-layer mode, it does not have 7 layers but
only 4 layers
OSI 7-layerTCP/IP Protocol Suite
FTP, SMTP, Telnet,
HTTP,…
TCP, UDP
IP, ARP, ICMP
Network Interface
6
• Application layer protocols define the rules when
implementing specific network applications
• Rely on the underlying layers to provide accurate
and efficient data delivery
• Typical protocols:
• FTP – File Transfer Protocol
• For file transfer
• Telnet – Remote terminal protocol
• For remote login on any other computer on the
network
• SMTP – Simple Mail Transfer Protocol
• For mail transfer
• HTTP – Hypertext Transfer Protocol
• For Web browsing
7
• TCP/IP is built on “connectionless” technology,
each datagram finds its own way to its destination
• Transport Layer protocols define the rules of
• Dividing a chunk of data into segments
• Reassemble segments into the original chunk
• Typical protocols:
• TCP – Transmission Control Protocol
• Provide further the functions such as reordering
and data resend
• UDP – User Datagram Service
• Use when the message to be sent fit exactly into a
datagram
• Use also when a more simplified data format is
required
8
• Network layer protocols define the rules of how to
find the routes for a packet to the destination
• It only gives best effort delivery. Packets can be
delayed, corrupted, lost, duplicated, out-of-order
• Typical protocols:
• IP – Internet Protocol
• Provide packet delivery
• ARP – Address Resolution Protocol
• Define the procedures of network address / MAC
address translation
• ICMP – Internet Control Message Protocol
• Define the procedures of error message transfer
9
Application Layer
Application
Transport
Network
Network Interface
10
SMTP
TCP
IP, ARP, ICMP
Network Interface
SMTP
TCP
IP, ARP, ICMP
Network Interface
SMTP ServerClient
Actual
Virtual
B. Example: SMTP
11
• The underlying layers have guaranteed accurate
data delivery
• We need to make a lot agreements with the server
in application layer before sending mail
1. Agree on how data is represented
• Binary or ASCII
2. Ensure the right recipient
• There may be 1000 users served by the server
3. Ensure the client has the right to send mail
• Some clients are not welcome
4. How to tell the server it is the end of the message
• All mail looks the same
:
12
• Example: SMTP
The following mail is to be sent:
Date: Fri, 18 Jan 02 13:26:31 EDT
From: enpklun@polyu.edu.hk
To: tchsun@eee.hku.hk
Subject: meeting
Let’s get together Monday at 1pm.
13
SMTP ServerClient
access port 25 of server
HELO polyu.edu.hk
MAIL From:
<enpklun@polyu.edu.hk>
220 eee.hku.hk SMTP Service
at 20 Jan 02 05:17:18 EDT
250 eee.hku.hk – Hello,
polyu.edu.hk
250 MAIL accepted
14
Client SMTP Server
Date: Fri, 18 Jan 02 13:26:31 EDT
From: enpklun@polyu.edu.hk
To: tchsun@eee.hku.hk
Subject: meeting
Let’s get together Monday at 1pm.
.
RCPT To:<tchsun@eee.hku.hk>
DATA
250 Recipient accepted
354 Start mail input;
end with .
15
• The agreement made in the SMTP protocol
• All messages use normal text
• All ASCII characters
• The responses all begin with numbers
• To indicate the status when receiving the command
• Some words are reserved words
• HELO, MAIL, RCPT…
• Mail ends with a line that contains only a period
• The information passed with the SMTP messages
• The recipient name
• The sender name
• The mail
16
C. Domain Name (mentioned before)
• Every computer has a network address
• e.g. 158.132.161.99
• To access a computer, we need to specify its
network address
• Human beings are weak in memorizing numbers
• We prefer computer name or domain name
• e.g. hkpu10.polyu.edu.hk
• Need a machine on the Internet to convert name to
number
17
Domain name hierarchy
Example:
hkpu10.polyu.edu.hk
Root domain name
other examples:
com – commercial company
org – general organization
net – major network centre
gov – government org.
mil – militrary group
edu – education org.
•The domain
within hk
•Note: edu.hk
is not the
same as edu
•The domain
within edu.hk
•One of the
educational
institutions in
H.K.
Computer name
18
• An organization needs to register its domain name
• e.g. PolyU has registered its name to the domain
of edu.hk
• Once a domain name is assigned, the organization
is free to assign other names belong to its domain
• e.g. we can have
hkpu10.polyu.edu.hk
smtp.polyu.edu.hk
mail.polyu.edu.hk
19
Client
Domain Name Server
(DNS) of polyu.edu.hk
Address of
www.yahoo.com
Where is
www.yahoo.com?
usually UDP
DNS of com
DNS of Yahoo.com
Where is
www.yahoo.com?
Address of
www.Yahoo.com
Where is
yahoo.com? Address of the
DNS of
Yahoo.com
Become
client
20
• Nevertheless, such a complicated procedure needs
not perform in most cases
• Client computers usually remember the answers
that it got before
• It reduces the loading to the root DNS
• To further reduce loading, there can be many root
DNS on the Internet
• e.g. there are a few “com” root DNS
21
Transport Layer
Application
Transport
Network
Network Interface
Message
Segments
h M h M h M
22
D. TCP and UDP
• TCP is a connection-oriented protocol
• Does not mean it has a physical connection between
sender and receiver
• TCP provides the function to allow a connection
virtually exists – also called virtual circuit
• TCP provides the functions:
• Dividing a chunk of data into segments
• Reassembly segments into the original chunk
• Provide further the functions such as reordering and
data resend
• Offering a reliable byte-stream delivery service
TCP – Transmission Control Protocol
23
Source Port Destination
Port
Sequence Number
Acknowledgement
Number
Checksum
Message Data
TCP
Dividing and Reassembly
Message
24
1 2 3
Sender
Timeout
retransmit
A1 A3
1 3
Recipient
2
A2
25
• A Typical Procedure
• Sender
• TCP divides a message into segments
• Add sequence no.
• Send the segments in sequence and wait for
acknowledgement
• If an acknowledgement for a segment is not received
for a certain period of time, resend it until an
acknowledgement is received
• Recipient
• When receiving segments, send the
acknowledgement with correct number
• Reassembly the segments back to the message
26
• A computer may perform a number of network
applications at the same time
• FTP + SMTP + HTTP, etc.
• Each computer has only one network address, how
can it serve so many applications at the same time?
Port Multiplexing
⇒ by port multiplexing
Network add:
158.132.161.99
Port 21 Port 25
Port 80
FTP SMTP
HTTP
27
Well-known Port Numbers
• Some port numbers are reserved for some
purposes
• Port 21: FTP – file transfer
• Port 25: SMTP – mail transfer
• Port 23: TELNET – remote login
• Port 80: HTTP – Web access
• These port numbers are well known to all
computers in the network
• E.g. whenever a client access port 25 of the server,
it means the client needs SMTP service
28
Client SMTP Server
Located by: network
address + TCP port
no.
Source Port
= 1357
Destination
Port = 25
Sequence Number
Acknowledgement
Number
Checksum
Message Data
SMTP port
= 1357
SMTP port
= 25
29
Client A SMTP + FTP Server
Client B
SMTP port
= 1357
FTP port
= 1361
Network address:
158.132.161.99
SMTP port
= 25
FTP port
= 21
30
Network Layer
Application
Transport
Network
Network Interface
Message
Segments
h M h M h M
h Mh h Mh h Mh
Datagrams / Packets
31
E. Network Addresses and
Subnets
• A header is added to each segment in the
Network layer
IP3
Total
Length
Time to
Live
Protocol Header
CheckSum
Source Address
Destination Address
Segment
Segment
32
• Total Length – Total length of a packet (up to
65535 bytes)
• Time to Live – How many times this packet can
be routed on the network (up to 255)
• Protocol – The transport layer protocol that
the packet belongs to
• TCP: 6
• UDP: 17
• ICMP: 1
• Source address – the network address of the
computer that sends the data
• Destination address – the network address of
the computer that the data is sending to
33
• (Already mentioned)
• Each computer (host) must have a unique
network address (or IP address for TCP/IP suite)
• Each IP address is 32-bit long (four bytes)
• The four-byte address is written out as a.b.c.d
• e.g. Byte 1 Byte 2 Byte 3 Byte 4
158 132 161 99
• IP addresses are hierarchical
• network I.D. and host I.D.
• Each Network I.D. on the Internet needs to be
registered to the Internet Assigned Number
Authority
34
Net I.D.
Class A – for very large network
Host I.D.0
1 bit 7 bits 24 bits
• Only 27
(63) networks can belong to this class
• Each network, there are 224
hosts or computers
• Very few class A networks in the world
• e.g. Arpanet – the earliest packet switched
WAN (started 40 years ago)
35
Net I.D.
Class B – for medium size network
Host I.D.0
2 bits 14 bits 16 bits
• 214
(16384) networks can belong to this class
• Each network, there are 216
(65536) hosts or
computers
• Polyu’s address belongs to this group
• e.g. 158.132.14.1
1
1001 1110 1000 0100 0000 1110 0000 0001
Network I.D. Host I.D.
36
Class C – for small network
Net I.D. Host I.D.0
3 bits 21 bits 8 bits
• 221
networks can belong to this class
• Each network, there are only 28
(256) hosts or
computers
11
37
Class D – for multicast network
Group no.0
4 bits 28 bits
• Packets are addressed to a multicast group
• Not often supported on Internet
111
38
Special Addresses
• Host I.D. = all ‘1’s ⇒ Directed broadcast
“Broadcast to all hosts in the network or
subnetwork”, not assigned
• Host I.D. = all ‘0’s ⇒ “This network”, not
assigned
• Network I.D. = 127 is reserved for loopback and
diagnostic purposes, not assigned
• Network I.D. + Host I.D. = all ‘1’s ⇒ Limited
broadcast
“Broadcast to all hosts in the current network”,
not assigned
39
Subnets
• A class B address can have 65536 hosts
• Difficult to manage
• Usually subdivide into a few small subnets
• Subnetting can also help to reduce broadcasting
traffic
All traffic to
158.132.0.0
158.132.0.0
Total 65536 hosts
Router Router
All traffic to
158.132.0.0
158.132.1.0
158.132.2.0
158.132.3.0
Each subnet 256 hosts
40
Subnet Mask
• How does the router know which subnet a packet
should go?
• For each interface of the router, a subnet mask is
provided to redefine which part of the address is
Net ID and which part is Host ID
• Become classless addressing
A subnet mask: 255.255.255.0
1111 1111.1111 1111. 1111 1111. 0000 0000
‘1’s Net ID ‘0’s Host ID
41
Router
A packet with
destination address
158.132.1.10
S0
E0 S1
S2
S0 S1 S2
Subnet 158.132.1.0 158.132.2.0 158.132.3.0
Mask 255.255.255.0 255.255.255.0 255.255.255.0
Routing Table
158.132. 1. 10
AND 255.255.255. 0
158.132. 1. 0
158.132.1.10
1001 1110.1000 0100.0000 0001.0000
1010
AND 1111 1111.1111 1111.1111 1111.0000 0000
1001 1110.1000 0100.0000 0001.0000
Advantage: easy to compute
42
F. Routing
• How a packet finds its way to a computer in a
network?
• By using Routers
• Routing is the selection of a path to guide a
packet from the source to the destination
• Criteria in selecting a path may be:
• Shortest path
• Quickest path
• Cheapest path
43
Hong Kong
158.132.161.99
U.S.
212.64.123.98router
Internet
The red path is the
shortest path
44
• Each router has a table that records the
estimated distance to all other routers
• If a router knows the entire network topology,
the shortest path can be calculated
• To achieve this, routers broadcast Link State
Advertisement to all other routers periodically
• By means of routing protocol
• Each router knows the exact topology, and
then calculates the shortest path
• In practice, it is not possible for a router to all
paths. Only the nearer ones are kept
• Hence can give wrong estimation
45
Host A
158.132.148.66
Default gateway: Router C
Host B
160.64.123.98
Router C
S0
T1
T1
S1
T0
S1
S1
T0
S0
T0
T0
Router A
Subnet
160.64.123.0
Router B
Routing Table
Subnet
158.132.166.0
S1 158.132.166.0
255.255.255.0
Direct
T1 160. 64. 0. 0
255.255. 0. 0
Forward
Subnet
160.64.124.0
Routing Table
S0
S0
S1
160. 64.124.0
255.255.255.0
160. 64.123.0
255.255.255.0
Direct
Direct
46
1. Host A wants to send a packet to Host B with address
160.64.123.98
2. Host A checks that 160.64.123.98 is not in the same
network
3. Send packet to default gateway (Router C)
4. Default gateway finds that it cannot provide the best
route for the packet, inform Host A to send the
packet to Router A next time
5. Router C sends the packet to Router A
6. Router A checks from the table the packet should
forward to Router B
7. Router B receives the packet and checks in its table
the packet should directly deliver to subnet
160.64.123.0
8. Host B (160.64.123.98) receives the packet
47
Data Link and
Physical Layers
Application
Transport
Network
Network Interface
Message
Segments
h M h M h M
h Mh h Mh h Mh
Packets
h Mh h Mhh h
Frames
48
G. Ethernet Encapsulation and
ARP
• An IP packet should be encapsulated into a
frame for transmission by data link layer
• e.g. if Ethernet (or IEEE 802.3) is used:
Preamble Des. Add Sour. Add Length IP Packet FCS
7
Bytes
2/6
Bytes
2/6
Bytes
2
Bytes
46 - 1500 Bytes 4
Bytes
1
Byte
IEEE 802.3 Frame
49
• Only the hardware address (MAC address) is
unique to a host
• Need to convert a network address to MAC
address
Ethernet
Ethernet
Frame
Ethernet address = ?
Packet
Destination IP = 158.132.148.132Source IP =
158.132.148.66
Packet
50
ARP – Address Resolution Protocol
1. Broadcast: Who has got IP address
158.132.148.132? What’s your
Ethernet address?
2. Reply: I do. My Ethernet address is
00-60-8C-41-37-52
Case 1
Ethernet Frame3.
Ethernet address = 00-60-8C-41-37-52
51
ARP – Address Resolution Protocol
Case 2
1. Broadcast: Who has got IP address
158.132.148.132? What’s your
Ethernet address?
2. Reply: The IP you indicated is not in your network.
You can give the packet to me first. My MAC address
is 00-60-8C-12-34-56
Router
3.
Ethernet Frame
Ethernet address = 00-60-8C-12-34-56
52
ARP Cache
• Will have a heavy traffic if so many ARP
broadcast messages are generated
• Each host will have a cache to store the
mappings (from IP to MAC address) that were
obtained before
• An entry will only be kept in the cache for a
limited amount of time (say, 2 minutes)
IP Address MAC Address
158.132.148.80 00-60-8C-27-35-9A
158.132.148.28 02-60-8C-1A-37-49

Weitere ähnliche Inhalte

Was ist angesagt? (20)

TCP/IP Network ppt
TCP/IP Network pptTCP/IP Network ppt
TCP/IP Network ppt
 
Introduction to Data-Link Layer
Introduction to Data-Link LayerIntroduction to Data-Link Layer
Introduction to Data-Link Layer
 
Tcp
TcpTcp
Tcp
 
Internet Protocols
Internet ProtocolsInternet Protocols
Internet Protocols
 
TCP and UDP
TCP and UDP TCP and UDP
TCP and UDP
 
Osi reference model
Osi reference modelOsi reference model
Osi reference model
 
IP addressing and Subnetting PPT
IP addressing and Subnetting PPTIP addressing and Subnetting PPT
IP addressing and Subnetting PPT
 
Network Layer
Network LayerNetwork Layer
Network Layer
 
MAC & IP addresses
MAC & IP addressesMAC & IP addresses
MAC & IP addresses
 
Osi model vs TCP/IP
Osi model vs TCP/IPOsi model vs TCP/IP
Osi model vs TCP/IP
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Tcp/ip model
Tcp/ip  modelTcp/ip  model
Tcp/ip model
 
Networking devices
Networking devicesNetworking devices
Networking devices
 
Transport layer
Transport layer Transport layer
Transport layer
 
Integrated services digital network (isdn)
Integrated services digital network (isdn)Integrated services digital network (isdn)
Integrated services digital network (isdn)
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategy
 
Telnet
TelnetTelnet
Telnet
 
Ports & sockets
Ports  & sockets Ports  & sockets
Ports & sockets
 
Classes of ip addresses
Classes of ip addressesClasses of ip addresses
Classes of ip addresses
 
OSI reference model
OSI reference modelOSI reference model
OSI reference model
 

Andere mochten auch (20)

TCP/IP Basics
TCP/IP BasicsTCP/IP Basics
TCP/IP Basics
 
FEGTS IP training - TCP/IP Introduction
FEGTS IP training - TCP/IP IntroductionFEGTS IP training - TCP/IP Introduction
FEGTS IP training - TCP/IP Introduction
 
More on Tcp/Ip
More on Tcp/IpMore on Tcp/Ip
More on Tcp/Ip
 
Network infrastructure - TCP/IP
Network infrastructure - TCP/IPNetwork infrastructure - TCP/IP
Network infrastructure - TCP/IP
 
The secret of TCP/IP and how it affects your PBX
The secret of TCP/IP and how it affects your PBXThe secret of TCP/IP and how it affects your PBX
The secret of TCP/IP and how it affects your PBX
 
TCP/IP – Transmission Control Protocol/ Internet Protocol
TCP/IP – Transmission Control Protocol/ Internet ProtocolTCP/IP – Transmission Control Protocol/ Internet Protocol
TCP/IP – Transmission Control Protocol/ Internet Protocol
 
TCP Model
TCP ModelTCP Model
TCP Model
 
Security problems in TCP/IP
Security problems in TCP/IPSecurity problems in TCP/IP
Security problems in TCP/IP
 
TCP/IP basics
TCP/IP basicsTCP/IP basics
TCP/IP basics
 
Tcp
TcpTcp
Tcp
 
Himanshupptx
HimanshupptxHimanshupptx
Himanshupptx
 
Presentation1
Presentation1Presentation1
Presentation1
 
tcpip
tcpiptcpip
tcpip
 
TCP/IP Training Basic Concepts.
TCP/IP Training Basic Concepts.TCP/IP Training Basic Concepts.
TCP/IP Training Basic Concepts.
 
Introduction to TCP/IP
Introduction to TCP/IPIntroduction to TCP/IP
Introduction to TCP/IP
 
Tcp ip
Tcp ipTcp ip
Tcp ip
 
Ip Spoofing
Ip SpoofingIp Spoofing
Ip Spoofing
 
My ppt..priya
My ppt..priyaMy ppt..priya
My ppt..priya
 
I P S P O O F I N G
I P  S P O O F I N GI P  S P O O F I N G
I P S P O O F I N G
 
Programming TCP/IP with Sockets
Programming TCP/IP with SocketsProgramming TCP/IP with Sockets
Programming TCP/IP with Sockets
 

Ähnlich wie TCP/IP

Ähnlich wie TCP/IP (20)

tcp ip protocols.ppt
tcp ip protocols.ppttcp ip protocols.ppt
tcp ip protocols.ppt
 
tcp-140613123317-phpapp01.pptx
tcp-140613123317-phpapp01.pptxtcp-140613123317-phpapp01.pptx
tcp-140613123317-phpapp01.pptx
 
Networking basics PPT
Networking basics PPTNetworking basics PPT
Networking basics PPT
 
Ch 2: TCP/IP Concepts Review
Ch 2: TCP/IP Concepts ReviewCh 2: TCP/IP Concepts Review
Ch 2: TCP/IP Concepts Review
 
Chapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.pptChapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.ppt
 
Chapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.pptChapter 9 TCP IP Reference Model.ppt
Chapter 9 TCP IP Reference Model.ppt
 
SOHO Network Setup Tutorial
SOHO Network Setup Tutorial SOHO Network Setup Tutorial
SOHO Network Setup Tutorial
 
Computer network coe351- part2- final
Computer network coe351- part2- finalComputer network coe351- part2- final
Computer network coe351- part2- final
 
Tcp ip
Tcp ipTcp ip
Tcp ip
 
Overview of tcp ip
Overview of tcp ipOverview of tcp ip
Overview of tcp ip
 
Small office Home office , network setup in details
Small office Home office , network setup in detailsSmall office Home office , network setup in details
Small office Home office , network setup in details
 
Computer network coe351- part3-final
Computer network coe351- part3-finalComputer network coe351- part3-final
Computer network coe351- part3-final
 
ADDRESSING PADA TCP IP
ADDRESSING PADA TCP IPADDRESSING PADA TCP IP
ADDRESSING PADA TCP IP
 
Web Engineering Lecture2
Web Engineering Lecture2 Web Engineering Lecture2
Web Engineering Lecture2
 
Overview of TCP IP
Overview of TCP IPOverview of TCP IP
Overview of TCP IP
 
Tcp ip
Tcp ipTcp ip
Tcp ip
 
Lecture set 7
Lecture set 7Lecture set 7
Lecture set 7
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 
tcpip.ppt
tcpip.ppttcpip.ppt
tcpip.ppt
 

Mehr von Syed Zaid Irshad

Mehr von Syed Zaid Irshad (20)

Operating System.pdf
Operating System.pdfOperating System.pdf
Operating System.pdf
 
DBMS_Lab_Manual_&_Solution
DBMS_Lab_Manual_&_SolutionDBMS_Lab_Manual_&_Solution
DBMS_Lab_Manual_&_Solution
 
Data Structure and Algorithms.pptx
Data Structure and Algorithms.pptxData Structure and Algorithms.pptx
Data Structure and Algorithms.pptx
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Professional Issues in Computing
Professional Issues in ComputingProfessional Issues in Computing
Professional Issues in Computing
 
Reduce course notes class xi
Reduce course notes class xiReduce course notes class xi
Reduce course notes class xi
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xii
 
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
 
C Language
C LanguageC Language
C Language
 
Flowchart
FlowchartFlowchart
Flowchart
 
Algorithm Pseudo
Algorithm PseudoAlgorithm Pseudo
Algorithm Pseudo
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
ICS 2nd Year Book Introduction
ICS 2nd Year Book IntroductionICS 2nd Year Book Introduction
ICS 2nd Year Book Introduction
 
Security, Copyright and the Law
Security, Copyright and the LawSecurity, Copyright and the Law
Security, Copyright and the Law
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
Data Communication
Data CommunicationData Communication
Data Communication
 
Information Networks
Information NetworksInformation Networks
Information Networks
 
Basic Concept of Information Technology
Basic Concept of Information TechnologyBasic Concept of Information Technology
Basic Concept of Information Technology
 
Introduction to ICS 1st Year Book
Introduction to ICS 1st Year BookIntroduction to ICS 1st Year Book
Introduction to ICS 1st Year Book
 
Using the set operators
Using the set operatorsUsing the set operators
Using the set operators
 

Kürzlich hochgeladen

multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Configuration of IoT devices - Systems managament
Configuration of IoT devices - Systems managamentConfiguration of IoT devices - Systems managament
Configuration of IoT devices - Systems managamentBharaniDharan195623
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxNiranjanYadav41
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate productionChinnuNinan
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 

Kürzlich hochgeladen (20)

multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Configuration of IoT devices - Systems managament
Configuration of IoT devices - Systems managamentConfiguration of IoT devices - Systems managament
Configuration of IoT devices - Systems managament
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptx
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate production
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 

TCP/IP

  • 2. 2 A. What is TCP/IP? • TCP/IP is a set of protocols developed to allow cooperating computers to share resources across a network • TCP stands for “Transmission Control Protocol” • IP stands for “Internet Protocol” • They are Transport layer and Network layer protocols respectively of the protocol suite • The most well known network that adopted TCP/IP is Internet – the biggest WAN in the world
  • 3. 3 • A protocol is a collection of rules and procedures for two computers to exchange information • Protocol also defines the format of data that is being exchanged What is a protocol?
  • 4. 4 Why TCP/IP is so popular? • TCP/IP was developed very early • Technologies were widely discussed and circulated in documents called “Request for Comments” (RFC) – free of charge • Supported by UNIX operating system
  • 5. 5 TCP/IP Model • Because TCP/IP was developed earlier than the OSI 7-layer mode, it does not have 7 layers but only 4 layers OSI 7-layerTCP/IP Protocol Suite FTP, SMTP, Telnet, HTTP,… TCP, UDP IP, ARP, ICMP Network Interface
  • 6. 6 • Application layer protocols define the rules when implementing specific network applications • Rely on the underlying layers to provide accurate and efficient data delivery • Typical protocols: • FTP – File Transfer Protocol • For file transfer • Telnet – Remote terminal protocol • For remote login on any other computer on the network • SMTP – Simple Mail Transfer Protocol • For mail transfer • HTTP – Hypertext Transfer Protocol • For Web browsing
  • 7. 7 • TCP/IP is built on “connectionless” technology, each datagram finds its own way to its destination • Transport Layer protocols define the rules of • Dividing a chunk of data into segments • Reassemble segments into the original chunk • Typical protocols: • TCP – Transmission Control Protocol • Provide further the functions such as reordering and data resend • UDP – User Datagram Service • Use when the message to be sent fit exactly into a datagram • Use also when a more simplified data format is required
  • 8. 8 • Network layer protocols define the rules of how to find the routes for a packet to the destination • It only gives best effort delivery. Packets can be delayed, corrupted, lost, duplicated, out-of-order • Typical protocols: • IP – Internet Protocol • Provide packet delivery • ARP – Address Resolution Protocol • Define the procedures of network address / MAC address translation • ICMP – Internet Control Message Protocol • Define the procedures of error message transfer
  • 10. 10 SMTP TCP IP, ARP, ICMP Network Interface SMTP TCP IP, ARP, ICMP Network Interface SMTP ServerClient Actual Virtual B. Example: SMTP
  • 11. 11 • The underlying layers have guaranteed accurate data delivery • We need to make a lot agreements with the server in application layer before sending mail 1. Agree on how data is represented • Binary or ASCII 2. Ensure the right recipient • There may be 1000 users served by the server 3. Ensure the client has the right to send mail • Some clients are not welcome 4. How to tell the server it is the end of the message • All mail looks the same :
  • 12. 12 • Example: SMTP The following mail is to be sent: Date: Fri, 18 Jan 02 13:26:31 EDT From: enpklun@polyu.edu.hk To: tchsun@eee.hku.hk Subject: meeting Let’s get together Monday at 1pm.
  • 13. 13 SMTP ServerClient access port 25 of server HELO polyu.edu.hk MAIL From: <enpklun@polyu.edu.hk> 220 eee.hku.hk SMTP Service at 20 Jan 02 05:17:18 EDT 250 eee.hku.hk – Hello, polyu.edu.hk 250 MAIL accepted
  • 14. 14 Client SMTP Server Date: Fri, 18 Jan 02 13:26:31 EDT From: enpklun@polyu.edu.hk To: tchsun@eee.hku.hk Subject: meeting Let’s get together Monday at 1pm. . RCPT To:<tchsun@eee.hku.hk> DATA 250 Recipient accepted 354 Start mail input; end with .
  • 15. 15 • The agreement made in the SMTP protocol • All messages use normal text • All ASCII characters • The responses all begin with numbers • To indicate the status when receiving the command • Some words are reserved words • HELO, MAIL, RCPT… • Mail ends with a line that contains only a period • The information passed with the SMTP messages • The recipient name • The sender name • The mail
  • 16. 16 C. Domain Name (mentioned before) • Every computer has a network address • e.g. 158.132.161.99 • To access a computer, we need to specify its network address • Human beings are weak in memorizing numbers • We prefer computer name or domain name • e.g. hkpu10.polyu.edu.hk • Need a machine on the Internet to convert name to number
  • 17. 17 Domain name hierarchy Example: hkpu10.polyu.edu.hk Root domain name other examples: com – commercial company org – general organization net – major network centre gov – government org. mil – militrary group edu – education org. •The domain within hk •Note: edu.hk is not the same as edu •The domain within edu.hk •One of the educational institutions in H.K. Computer name
  • 18. 18 • An organization needs to register its domain name • e.g. PolyU has registered its name to the domain of edu.hk • Once a domain name is assigned, the organization is free to assign other names belong to its domain • e.g. we can have hkpu10.polyu.edu.hk smtp.polyu.edu.hk mail.polyu.edu.hk
  • 19. 19 Client Domain Name Server (DNS) of polyu.edu.hk Address of www.yahoo.com Where is www.yahoo.com? usually UDP DNS of com DNS of Yahoo.com Where is www.yahoo.com? Address of www.Yahoo.com Where is yahoo.com? Address of the DNS of Yahoo.com Become client
  • 20. 20 • Nevertheless, such a complicated procedure needs not perform in most cases • Client computers usually remember the answers that it got before • It reduces the loading to the root DNS • To further reduce loading, there can be many root DNS on the Internet • e.g. there are a few “com” root DNS
  • 22. 22 D. TCP and UDP • TCP is a connection-oriented protocol • Does not mean it has a physical connection between sender and receiver • TCP provides the function to allow a connection virtually exists – also called virtual circuit • TCP provides the functions: • Dividing a chunk of data into segments • Reassembly segments into the original chunk • Provide further the functions such as reordering and data resend • Offering a reliable byte-stream delivery service TCP – Transmission Control Protocol
  • 23. 23 Source Port Destination Port Sequence Number Acknowledgement Number Checksum Message Data TCP Dividing and Reassembly Message
  • 24. 24 1 2 3 Sender Timeout retransmit A1 A3 1 3 Recipient 2 A2
  • 25. 25 • A Typical Procedure • Sender • TCP divides a message into segments • Add sequence no. • Send the segments in sequence and wait for acknowledgement • If an acknowledgement for a segment is not received for a certain period of time, resend it until an acknowledgement is received • Recipient • When receiving segments, send the acknowledgement with correct number • Reassembly the segments back to the message
  • 26. 26 • A computer may perform a number of network applications at the same time • FTP + SMTP + HTTP, etc. • Each computer has only one network address, how can it serve so many applications at the same time? Port Multiplexing ⇒ by port multiplexing Network add: 158.132.161.99 Port 21 Port 25 Port 80 FTP SMTP HTTP
  • 27. 27 Well-known Port Numbers • Some port numbers are reserved for some purposes • Port 21: FTP – file transfer • Port 25: SMTP – mail transfer • Port 23: TELNET – remote login • Port 80: HTTP – Web access • These port numbers are well known to all computers in the network • E.g. whenever a client access port 25 of the server, it means the client needs SMTP service
  • 28. 28 Client SMTP Server Located by: network address + TCP port no. Source Port = 1357 Destination Port = 25 Sequence Number Acknowledgement Number Checksum Message Data SMTP port = 1357 SMTP port = 25
  • 29. 29 Client A SMTP + FTP Server Client B SMTP port = 1357 FTP port = 1361 Network address: 158.132.161.99 SMTP port = 25 FTP port = 21
  • 31. 31 E. Network Addresses and Subnets • A header is added to each segment in the Network layer IP3 Total Length Time to Live Protocol Header CheckSum Source Address Destination Address Segment Segment
  • 32. 32 • Total Length – Total length of a packet (up to 65535 bytes) • Time to Live – How many times this packet can be routed on the network (up to 255) • Protocol – The transport layer protocol that the packet belongs to • TCP: 6 • UDP: 17 • ICMP: 1 • Source address – the network address of the computer that sends the data • Destination address – the network address of the computer that the data is sending to
  • 33. 33 • (Already mentioned) • Each computer (host) must have a unique network address (or IP address for TCP/IP suite) • Each IP address is 32-bit long (four bytes) • The four-byte address is written out as a.b.c.d • e.g. Byte 1 Byte 2 Byte 3 Byte 4 158 132 161 99 • IP addresses are hierarchical • network I.D. and host I.D. • Each Network I.D. on the Internet needs to be registered to the Internet Assigned Number Authority
  • 34. 34 Net I.D. Class A – for very large network Host I.D.0 1 bit 7 bits 24 bits • Only 27 (63) networks can belong to this class • Each network, there are 224 hosts or computers • Very few class A networks in the world • e.g. Arpanet – the earliest packet switched WAN (started 40 years ago)
  • 35. 35 Net I.D. Class B – for medium size network Host I.D.0 2 bits 14 bits 16 bits • 214 (16384) networks can belong to this class • Each network, there are 216 (65536) hosts or computers • Polyu’s address belongs to this group • e.g. 158.132.14.1 1 1001 1110 1000 0100 0000 1110 0000 0001 Network I.D. Host I.D.
  • 36. 36 Class C – for small network Net I.D. Host I.D.0 3 bits 21 bits 8 bits • 221 networks can belong to this class • Each network, there are only 28 (256) hosts or computers 11
  • 37. 37 Class D – for multicast network Group no.0 4 bits 28 bits • Packets are addressed to a multicast group • Not often supported on Internet 111
  • 38. 38 Special Addresses • Host I.D. = all ‘1’s ⇒ Directed broadcast “Broadcast to all hosts in the network or subnetwork”, not assigned • Host I.D. = all ‘0’s ⇒ “This network”, not assigned • Network I.D. = 127 is reserved for loopback and diagnostic purposes, not assigned • Network I.D. + Host I.D. = all ‘1’s ⇒ Limited broadcast “Broadcast to all hosts in the current network”, not assigned
  • 39. 39 Subnets • A class B address can have 65536 hosts • Difficult to manage • Usually subdivide into a few small subnets • Subnetting can also help to reduce broadcasting traffic All traffic to 158.132.0.0 158.132.0.0 Total 65536 hosts Router Router All traffic to 158.132.0.0 158.132.1.0 158.132.2.0 158.132.3.0 Each subnet 256 hosts
  • 40. 40 Subnet Mask • How does the router know which subnet a packet should go? • For each interface of the router, a subnet mask is provided to redefine which part of the address is Net ID and which part is Host ID • Become classless addressing A subnet mask: 255.255.255.0 1111 1111.1111 1111. 1111 1111. 0000 0000 ‘1’s Net ID ‘0’s Host ID
  • 41. 41 Router A packet with destination address 158.132.1.10 S0 E0 S1 S2 S0 S1 S2 Subnet 158.132.1.0 158.132.2.0 158.132.3.0 Mask 255.255.255.0 255.255.255.0 255.255.255.0 Routing Table 158.132. 1. 10 AND 255.255.255. 0 158.132. 1. 0 158.132.1.10 1001 1110.1000 0100.0000 0001.0000 1010 AND 1111 1111.1111 1111.1111 1111.0000 0000 1001 1110.1000 0100.0000 0001.0000 Advantage: easy to compute
  • 42. 42 F. Routing • How a packet finds its way to a computer in a network? • By using Routers • Routing is the selection of a path to guide a packet from the source to the destination • Criteria in selecting a path may be: • Shortest path • Quickest path • Cheapest path
  • 44. 44 • Each router has a table that records the estimated distance to all other routers • If a router knows the entire network topology, the shortest path can be calculated • To achieve this, routers broadcast Link State Advertisement to all other routers periodically • By means of routing protocol • Each router knows the exact topology, and then calculates the shortest path • In practice, it is not possible for a router to all paths. Only the nearer ones are kept • Hence can give wrong estimation
  • 45. 45 Host A 158.132.148.66 Default gateway: Router C Host B 160.64.123.98 Router C S0 T1 T1 S1 T0 S1 S1 T0 S0 T0 T0 Router A Subnet 160.64.123.0 Router B Routing Table Subnet 158.132.166.0 S1 158.132.166.0 255.255.255.0 Direct T1 160. 64. 0. 0 255.255. 0. 0 Forward Subnet 160.64.124.0 Routing Table S0 S0 S1 160. 64.124.0 255.255.255.0 160. 64.123.0 255.255.255.0 Direct Direct
  • 46. 46 1. Host A wants to send a packet to Host B with address 160.64.123.98 2. Host A checks that 160.64.123.98 is not in the same network 3. Send packet to default gateway (Router C) 4. Default gateway finds that it cannot provide the best route for the packet, inform Host A to send the packet to Router A next time 5. Router C sends the packet to Router A 6. Router A checks from the table the packet should forward to Router B 7. Router B receives the packet and checks in its table the packet should directly deliver to subnet 160.64.123.0 8. Host B (160.64.123.98) receives the packet
  • 47. 47 Data Link and Physical Layers Application Transport Network Network Interface Message Segments h M h M h M h Mh h Mh h Mh Packets h Mh h Mhh h Frames
  • 48. 48 G. Ethernet Encapsulation and ARP • An IP packet should be encapsulated into a frame for transmission by data link layer • e.g. if Ethernet (or IEEE 802.3) is used: Preamble Des. Add Sour. Add Length IP Packet FCS 7 Bytes 2/6 Bytes 2/6 Bytes 2 Bytes 46 - 1500 Bytes 4 Bytes 1 Byte IEEE 802.3 Frame
  • 49. 49 • Only the hardware address (MAC address) is unique to a host • Need to convert a network address to MAC address Ethernet Ethernet Frame Ethernet address = ? Packet Destination IP = 158.132.148.132Source IP = 158.132.148.66 Packet
  • 50. 50 ARP – Address Resolution Protocol 1. Broadcast: Who has got IP address 158.132.148.132? What’s your Ethernet address? 2. Reply: I do. My Ethernet address is 00-60-8C-41-37-52 Case 1 Ethernet Frame3. Ethernet address = 00-60-8C-41-37-52
  • 51. 51 ARP – Address Resolution Protocol Case 2 1. Broadcast: Who has got IP address 158.132.148.132? What’s your Ethernet address? 2. Reply: The IP you indicated is not in your network. You can give the packet to me first. My MAC address is 00-60-8C-12-34-56 Router 3. Ethernet Frame Ethernet address = 00-60-8C-12-34-56
  • 52. 52 ARP Cache • Will have a heavy traffic if so many ARP broadcast messages are generated • Each host will have a cache to store the mappings (from IP to MAC address) that were obtained before • An entry will only be kept in the cache for a limited amount of time (say, 2 minutes) IP Address MAC Address 158.132.148.80 00-60-8C-27-35-9A 158.132.148.28 02-60-8C-1A-37-49