IP Packet - CSIE -NCKU

Download Report

Transcript IP Packet - CSIE -NCKU

Using the Internet from Home:
Standards at Higher Layers
Chapter 2
Revision 1: August 2000
Copyright 2001 Prentice Hall
Part A: Basic Concepts
Message organization and timing
Standards

Standards are rules of operation that are
followed by most or all vendors

Standards allow hardware and software
from different vendors to work together

Competition among vendors brings lower
prices and feature-rich products
3
4
Messages

Standards work through message
exchange
App
Message
HTTP
App
Trans
TCP
Trans
Int
IP
Int
IP
Int
DL
PPP
DL
?
DL
Phy
Modem
Phy
?
Phy
User PC
Router
Webserver
5
Message Structure

Message is a long string of bits
– Show 32 bits or some other number per line
– Begins with Bit 0
– In this example,
• First line has bits 0 through 31
• Second line has bits 32 through 63
TCP Segment
Bit 0
Source Port # (16)
Destination Port # (16)
Sequence Number (32 bits)
Acknowledgement Number (32 bits)
Hdr Len
Reserved (6)
(4)
Flags (6)
Window Size (16)
More fields follow …..
Bit 31
6
Message Structure

Message is a long string of bits
– Divided logically into sections called fields
(source port field is bits 0 to 15, …)
TCP Segment
Bit 0
Source Port # (16)
Bit 31
Destination Port # (16)
Sequence Number (32 bits)
Acknowledgement Number (32 bits)
Hdr Len
Reserved (6)
(4)
Flags (6)
TCP Checksum (16)
Window Size (16)
Urgent Pointer (16)
Options (if any)
Data Field
PAD
7
Message Structure

Message is a long string of bits
– IP Packet message structure:
Bit 0
Version
(4)
Bit 31
Hdr Len
(4)
TOS (8)
Indication (16 bits)
Time to Live (8)
Total Length in bytes (16)
Flags (3)
Protocol (8)
Fragment Offset (13)
Header Checksum (16)
Source IP Address
Destination IP Address
Options (if any)
Data Field
PAD
Octets

Lengths are often given in groups of eight
bits called octets
– In computer science, a group of eight bits is
called a byte
– Same meaning but different names
8
9
Message Structure

Header Fields
– Initial fields in a message
– Before the data field
– Source and destination address, error handling
information, etc.
– Like address and greeting in a written letter
Header Fields
Data Field
Header Field
10
Message Structure

Data Field
– The information to be delivered to the peer
process on the other system
– Usually far longer than the header and trailer
• Just as body of letter usually is far longer
than the opening and closing
Data Field
Trailer Fields
(if there are any)
Header
Fields
11
Message Structure

Trailer Fields
– Fields following the data field
– Usually only present at the data link layer
Data Field
Trailer Fields
(if there are any)
Header
Fields
12
Message Structures

Not All Fields are Always Present
– Header alone may be sufficient in a supervisory
message
– Header plus data field for delivering data
– Sometimes all three
Header
Trailer
Data Field
Header
Data Field
Header
Message Time Diagrams

13
Standards also govern message timing
– When each side may transmit
– For example, webserver may not send an
HTTP response message until it receives a
request
Browser
Webserver
HTTP Request
Message
Time
HTTP Response
Message
Standards for Telephone Webserver Access
Layer
Standard
Application
HyperText Transport Protocol
(HTTP)
Transmission Control Protocol
(TCP)
Internet Protocol (IP);
Messages are packets
Point-to-Point Protocol (PPP);
Messages are frames
Modem, telephone standards
Transport
Internet
Data Link
Physical
14
15
Protocols

A protocol is a standard for communication
between peer processes, that is, processes
at the same layer, but on different
machines
– E.g., HTTP: Browser and webserver application
programs are at the same layer but on different
machines
App
Message
HTTP
App
16
Protocols

A protocol is a standard for communication
between peer processes, that is, processes
at the same layer, but on different
machines
– TCP, IP, and PPP all have “protocol” as their
final “P;” they are all protocols
– TCP (Transmission Control Protocol) is the
protocol governing communication between
transport layer processes on two hosts
Trans
Message
TCP
Trans
Part B: Layered Communication
Layers work together
Encapsulation and Deencapsulation
18
Indirect Communication

Application programs on different
machines cannot communicate directly
– They are on different machines!
Browser
HTTP Request
Web App
Trans
Trans
Int
Int
DL
DL
Phy
Phy
User PC
Webserver
Layer Cooperation on the Source Host

Application layer process passes HTTPrequest to transport layer process
Application
HTTP Request
Transport
Internet
Data Link
User PC
Physical
19
Layer Cooperation on the Source
HostV

Transport layer makes TCP segments
– HTTP message is the data field
– Adds TCP header fields shown earlier
– Transport process “encapsulates” HTTP request
within a TCP segment
TCP Segment
HTTP Request
TCP-H
Data
Field
TCP
Header
20
21
Encapsulation

Encapsulation is delivering a message in
the data field of another message
– TCP encapsulates HTTP request messages
– Can also encapsulate other types of messages
TCP Segment
HTTP Request
TCP-H
Data
Field
TCP
Header
Layer Cooperation on the Source Host

Transport layer process passes the TCP
segment down to the internet layer process
Application
Transport
TCP segment
Internet
Data Link
User PC
Physical
22
Layer Cooperation on the Source Host

Internet Layer Process Encapsulates TCP
Segment within an IP packet
– An IP packet to deliver a TCP segment has a
TCP segment in its data field
Data IP Packet
TCP segment
IP-H
Data
Field
IP
Header
23
Layer Cooperation on the Source Host

The internet layer process passes the IP
packet to the data link layer process
– Internet layer messages are called packets
Application
Transport
Internet
IP packet
Data Link
User PC
Physical
24
Layer Cooperation on the Source Host

Data Link Layer Encapsulates IP Packet Within a
PPP Frame
– Data link layer messages are called frames
– Data PPP frame has IP packet in data field
PPP Frame Encapsulating an IP Packet
PPP-T
IP packet
PPP-H
25
Layer Cooperation on the Source Host

The data link layer process passes the PPP frame
to the physical layer process, which delivers it to
the physical layer process on the first router, one
bit at a time (no message at the physical layer)
Application
Transport
Internet
Data Link
User PC
PPP frame
Physical (10110 …)
To first
router
26
Layer Cooperation on the Source Host

Recap: Adding Headers and Trailers:
Application
HTTP msg
Transport
HTTP msg
TCP-H
Internet
HTTP msg
TCP-H IP-H
HTTP msg
TCP-H IP-H PPP-H
Data Link
User PC
PPP-T
Physical
27
Layer Cooperation on the Source Host

Encapsulation in Layering
– Whenever a process at Layer N (the
application, transport, internet, or data link
layer) creates a message,
– That Layer N process passes the message
down to the next-lower-layer process, the
process at layer N-1
– The N-1 process encapsulates the Layer N
message by placing it in the data field of a
Layer N-1 message and adding headers and
perhaps trailers to create the full Layer N-1
Message
28
Layer Cooperation on the Source Host

Small but important detail on naming

Layer 3 (internet) messages are called
packets
– IP message is a packet

Layer 2 (data link) messages are called
frames
– PPP message is called a frame
29
Layer Cooperation: Destination Host

Destination host reverses processes on the
sending host
– Delivers HTTP message to the webserver
application program
Application
Transport
Internet
Data Link
User PC
Physical
Webserver
30
Layer Cooperation: Destination Host

Successively pass up layer messages
Data link layer program
processes the data link frame’s
header and trailer,
deencapsulates the IP packet,
and passes the IP packet to the
next higher layer, the internet
layer
IP-Packet
DL-Frame (protocol unknown)
containing IP packet in data field
Final Router
Physical
Application
Transport
Internet
Data Link
Webserver
31
Layer Cooperation: Destination Host

Successively pass up layer messages
– Other layers pass successive data fields
(containing next-layer messages) up to the next
higher layer
HTTP msg
TCP segment
IP-Packet
DL-Frame (protocol unknown)
Final Router
Physical
Application
Transport
Internet
Data Link
Webserver
32
Layer Cooperation: Destination Host

Successively pass up layer messages
– Other layers process headers & trailers, pass
up message in data field
Application
HTTP msg
HTTP msg
TCP
segment
HTTP seg
TCP-H
IP Packet
HTTP msg
TCP-H IP-H
PPP-T
HTTP msg
TCP-H IP-H PPP-H
Data Link
Physical
Webserver
Final Router
Transport
Internet
33
Indirect Communication

Two processes on different machines
cannot communicate directly with one
another because they are physically
separated

So they communicate indirectly, using
cooperation with lower layers
34
35
The First Router

First router receives an IP packet
(encapsulated in a frame) in one port
(interface)

Must make a router forwarding decision:
select the port to use to send it back out
B
B?
D?
Router A
D
Packet
C?
C
Layer Cooperation on the First Router

So far, we have only looked at hosts
– But deencapsulation and encapsulation also
occur on EACH router

Frame arrives at a port on the first router
– Port’s data link layer process receives the PPP
frame containing an IP packet
Internet
PPP Frame
Data Link
Data Link
First Router
36
Layer Cooperation on the First Router

Incoming Data Link Process on the Router
– Deencapsulates the IP packet from the PPP
frame
– Passes the IP packet to the router’ internet
layer process
First Router
Internet
IP Packet
Data Link
Data Link
Incoming Port on First Router
37
Layer Cooperation on the First Router

Routers only have physical, data link, and
internet layer processes
– So internet layer process is the highest-layer
process on a router for router forwarding
– Internet layer process decides where to send
the packet next: another router or the
destination host
Internet
Data Link
Data Link
First Router
38
Layer Cooperation on the First Router

Internet layer process passes IP packet to
data link layer process on the selected
output port that will carry the IP packet to
the next router or the destination host
First Router
Internet
Data Link
IP Packet
Data Link
Selected Output Port on First Router
39
Layer Cooperation on the First Router

40
The data link and physical layer process on
the selected port sends the frame
encapsulating the IP packet onto the next
router (or destination host)
Internet
Internet
Data Link
Data Link
Frame
Selected Output Port
On First Router
Physical
Layer
Input Port
On Next Router
(Or Destination Host)
Layer Cooperation on the First Router

Notes

For router forwarding, routers only use
physical, data link, and internet processes

Routers First Receive Frames
– Receiving interface deencapsulates the IP
packet, passes the packet to the internet layer
process

Routers Then Send Frames Out
– On a different output interface (port)
– This requires encapsulating of the IP packet in
a data link layer frame
41
Part C: Other Important TCP/IP
Standards
Domain Name System (DNS)
Autoconfiguration Protocols
Domain Name System (DNS)

Only IP addresses are official
– e.g., 128.171.17.13
– These are 32-bit binary numbers
– Only they fit into the 32-bit destination and
source address fields of the IP headers
IP Packet
32-bit Source and Destination Addresses (110011...)
43
Domain Name System (DNS)

Users typically only know host names
– e.g., voyager.cba.hawaii.edu
– More easily remembered, but
– Will not fit into the address fields of an IP
packet
IP Packet
NO
voyager.cba.hawaii.edu
44
Domain Name System (DNS)

User’s computer sends a DNS host the
target host’s host name in a DNS Request
message

DNS host returns the target host’s IP
address in DNS Response message
User PC
Internet
Layer
Process
Voyager.cba.
hawaii.edu
128.171.17.13
DNS
Host
45
Domain Name System (DNS)

Subtlety
– Organizations or ISPs have local DNS hosts
– These hosts must know only local host names
and IP addresses
– For other host names, local DNS host passes
request to another DNS host
User PC
Internet
Layer
Process
Local
DNS
Host
Remote
DNS
Host
46
Domain Name System (DNS)

Subtlety
– Remote DNS host passes information back to
the local DNS host
– Local DNS host passes information back to
user PC
– Browser only talks to local DNS host
User PC
Internet
Layer
Process
Local
DNS
Host
Remote
DNS
Host
47
Domain Names

Internet uses hierarchical naming
– A domain is a collection of resources managed
by an organization

Generic top level domains (gTLD) by type
of organization
– .com
– .edu

for commercial organizations
for educational institutions
National top level domains (nTLDs) by
country
– .UK
– .AU
United Kingdom
Australia
48
Domain Names

Organizations are given second-level
domain names
–
–
–
–
–

Microsoft.com
Hawaii.edu
JAIMS.org
panko.com
Whitehouse.gov
Also can have second-level domains for
products (nameofnewmovie.com)
49
Domain Names

Organizations can create lower-level
domain names
– cba.hawaii.edu (for the College of
Business Administration)

The lowest level domain name is the host
name for an individual host or router
– www.cba.hawaii.edu
– www.microsoft.com
– www.panko.com
50
Autoconfiguration

Every computer attached to the Internet is
a host
– Including desktop PCs

Every host must have an IP address

Some hosts, such as routers and
webservers, get permanent IP addresses
– So that they can be found easily
51
Autoconfiguration

User PCs do not need permanent IP
addresses
– They only need to be found within a use
session
– They usually are given temporary IP
addresses each time they use the
Internet
– They may get a different IP address
each time they use the Internet
52
53
Autoconfiguration

Request-Response Cycle
– User software requests IP address for the user
PC in Autoconfiguration Request message
– Autoconfiguration Response message contains
temporary IP address to use in current session
Autoconfiguration
Request
User PC
Autoconfiguration
Host
Temporary
IP Address in
Autoconfiguration Response
Autoconfiguration

Most popular autoconfiguration protocol is
DHCP
– Dynamic Host Configuration Protocol
– Built into Windows after Win 3.1
– Supplies host with temporary IP address

DHCP can give more information too
– Usually gives IP address of a default gateway
(Microsoft terminology for router)
– Can give IP address of a local DNS host
– Can give other information
54
Part D:
Internet Setup in Microsoft Windows
Windows Layering
Bindings
Adding Adapters, Protocols, and Clients
TCP/IP Configuration
Windows Layering vs. TCP/IP-OSI
MS Windows
TCP/IP-OSI
Clients and Services Application
Protocols
Transport
Internet
Adapters
Data Link
Physical
56
Windows Layering vs. TCP/IP-OSI

Clients and Services
– For file service
– Clients set up Windows to be a client for a
particular type of file server
– Services set up Windows to make a user’s PC
provide file and print services for other PCs on
the network
• Very limited; not for file servers on large PC
networks
57
Windows Layering vs. TCP/IP-OSI

Protocols
– Combination of transport and internet layer
protocols
– TCP/IP is only one possibility
– IPX/SPX for Novell NetWare servers; Microsoft
sometimes calls this NW Link
– NetBEUI for some Microsoft servers on small
PC networks
58
Windows Layering vs. TCP/IP-OSI

Adapters
– Combination of data link layer and physical
layer protocols
– The subnet layers
– Dial-Up adapter sets up a modem and PPP
– Other “adapters,” including Ethernet for a
network interface card (NIC)
59
60
Bindings

Bindings
– After add clients, services, protocols, and
adapters, must bind the combinations that will
work together
Client for MS Windows
Other Added Client
Binding
IPX/SPX Protocol
TCP/IP Protocol
Binding
Ethernet Adapter
Dial-Up Adapter
61
Bindings

Bindings
– Bindings create communication paths between
adjacent layer processes
Client for MS Windows
Other Added Client
Binding
IPX/SPX Protocol
TCP/IP Protocol
Binding
Ethernet Adapter
Dial-Up Adapter
Configuring Networking in Windows

In Windows 95 and Windows 98,
– Go to the Start Button
– Choose Settings
– Choose Control Panel
– Double click the Network icon
– This opens the Network Dialog Box
62
The Network Dialog Box

Be sure the Configuration tab is selected
– You will see adapters, protocols, clients, and
services that have already been added

Operations
– Add: To add an adapter, protocol, client, or
service
– Remove: To remove one
– Properties: To see or change the properties of
the selected adapter, protocol, client, or service
63
The Network Dialog Box

The Add Button
– Clicking the “Add” button takes you to the
Select Network Component Type dialog box
– Choose client, protocol, adapter, or service,
then hit Add
– Assume you chose “protocol” You then go to
the Select Network Protocol dialog box
– Other choices will take you to the relevant
Select Network … dialog box
64
The Network Dialog Box

Select Network Protocol Dialog Box
– Click on a manufacturer to see the protocols it
offers; then click on the specific protocol
– Hit OK to add the protocol from files on your
hard drive or Have Disk if you have a disk
containing the protocol
– The selected protocol will be added
– The Select Network Client, Service, and
Adapter dialog boxes work the same way
65
The Network Dialog Box

To configure a protocol after adding it
– Go to the Network Dialog Box
– Click on the target protocol, etc.
– Click on the Properties button below it
– A dialog box specific to that protocol, etc. will
appear
– This will allow you to configure the protocol,
etc.
66
The TCP/IP Properties Box

To configure TCP/IP
– Click on TCP/IP on the Configuration tab of
the Network Dialog Box
– Click on the Properties button below it
– This opens the TCP/IP Properties dialog box
– The TCP/IP Properties dialog box has multiple
tabs
67
The TCP/IP Properties Box

By default, the IP Address tab is shown
when you open the TCP/IP Properties
Dialog Box

There are two radio buttons allowing you to
either
– “Specify an IP address” or
– “Obtain an IP address automatically”
68
The TCP/IP Properties Box

“Specify an IP address”
– Type in your PC’s permanent IP address
– Type in your local subnet mask (discussed in
Chapter 3)
– Also, on other tabs, setup other parameters
• Gateway (default router)
• DNS Configuration
• Bindings
69
The TCP/IP Properties Box

“Specify an IP address”
– Gateway: IP address router to send packets to
if no other router is specified; Gateway is the
old name for router
– DNS Configuration: Enable or disable DNS,
enter DNS host’s IP address and IP address of
backup DNS host
– Bindings: bindings between the TCP/IP
protocol and clients/services and adapters
70
The TCP/IP Properties Box

“Obtain IP address automatically”
– Asks a DHCP autoconfiguration host for a
temporary IP address
– Also obtains most other configuration
information from the autoconfiguration host as
well
– Almost always the best choice for client PCs
71
Part E:
Broader Perspective
A Multiprotocol World
Other TCP/IP-IP Standards

Even if you use TCP/IP-OSI, you will
not always use HTTP, TCP, and IP at
the top layers
– There are any other TCP/IP protocols for the
application, transport, and internet layers
– Application layer protocols for e-mail, etc.
– Also multiple transport and internet layer
protocols; not always TCP and IP
73
Other TCP/IP-IP Standards

Even if you use TCP/IP-OSI, you will not
always use PPP and modems at the data
link and physical layers
– Many other subnet standards
– Ethernet and other subnet standards for LANs
– Many WAN standards
74
Other TCP/IP-IP Standards

Viewing TCP/IP broadly
– Each layer, in other words, can use any of
several TCP/IP-OSI protocols
– Don’t confuse the standards of webserver
access from home using a telephone line and
modem (HTTP, TCP, IP, PPP, and serial ports,
modems, etc.) with TCP/IP-OSI standards in
general
75
You Will Not Always Use TCP/IPOSI Standards

You almost always will use OSI standards
for the data link and the physical layers

However, at higher layers, you may use
Non-TCP protocols
– IPX/SPX in some Novell NetWare file servers
– SNA for mainframes
– AppleTalk for Macintoshes
– NetBEUI for servers on some small LANs
76
Living in a Multiprotocol World

There are many standards architectures

Each has different layering

Each has multiple standards at each layer

This book will focus on TCP/IP-OSI and
some specific TCP/IP-OSI standards only
because not all standards can be covered

We live in a multiprotocol world
77