IP Datagram - La Salle University
Download
Report
Transcript IP Datagram - La Salle University
IP Datagram
Based on Chapter 20 of Computer Networks
and Internets (Comer)
CSIT 220 (Blum)
1
Overall Goal
Recall that our overall goal is to exchange
information between applications running on
different hosts in such a way that the applications
require no knowledge of the details of the
underlying connection.
Information hiding
This goal is achieved using a protocol suite which
takes a layered approach — defining services and
functions for each layer.
CSIT 220 (Blum)
2
Connection-Oriented or
Connectionless
The two basic types of service are
connection-oriented (establish a dedicated path)
connectionless (each packet finds its own way)
TCP/IP provides (in some sense) both.
The basic delivery system (IP) is connectionless.
A verification scheme (TCP) provides some of
the reliability features of a connection-oriented
service.
CSIT 220 (Blum)
3
Hop-to-hop
Connectionless service is an extension of the
packet switching idea.
Packets can travel independently since each
contains its destination address as part of the
header.
A local network uses the physical address added
at Network Interface Layer (a.k.a Data Link) to
deliver the packet to its local destination, which
may be
CSIT 220 (Blum)
The final destination (a host on the local network)
A router which will place the packet on an adjoining
network
4
Virtual and Universal
Two interconnected networks can use different
protocols at the lowest layers (for instance, Ethernet
and FDDI), but at the IP layer this
specific/heterogeneous information is stripped off
and the packet becomes independent of the network
it arrived on.
At the IP layer, the packets might be called
Virtual: not physical, software-based
Universal: characteristic of all, as opposed to specific to
one or a few
CSIT 220 (Blum)
5
Heterogeneous
LAN
information is
stripped off at
Data-Link layer
before the packet
is handed up to
Network Layer.
CSIT 220 (Blum)
6
IP Datagram
A datagram is “a self-contained, independent
entity of data carrying sufficient information
to be routed from the source to the destination
computer without reliance on earlier
exchanges between this source and
destination computer and the transporting
network.”
Internet’s Request for Comments (RFC) 1594
CSIT 220 (Blum)
7
Datagram Packet
The term “datagram” has become synonymous
with the term “packet.”
A packet should be
Independent of the specifics of the network it is on
Independent of the specifics of the path it has traveled
thus far
Understandable to any router along the way or the
destination host’s IP layer
The information regarding the packet’s
destination and interpretation is in its header.
The data portion which follows is variable in size.
CSIT 220 (Blum)
8
Datagram Paths
A router reads the IP address, calculates the
network portion of that IP address, looks up that
value in its routing table and then sends the packet
to the next router (or to the host if it is local).
The destination field in the packet contains the
destination address. The router uses its Mask to
calculate the network address for the Next Hop
(Router destination).
The Mask is a set of bits which are ANDed with the
destination address to produce the destination
network address.
CSIT 220 (Blum)
9
R2’s Routing Table
CSIT 220 (Blum)
10
R2’s Routing Table
R2
The IP addresses must of course be resolved into physical
address for actual transmission to take place
CSIT 220 (Blum)
11
Best-Effort Delivery
The IP protocol makes a “best-effort” to deliver the
packets. It does NOT handle
datagram duplication (because of retransmission)
delayed or out-of-order delivery
corruption of data
datagram loss
These errors are handled by higher layers of the
stack.
TCP handles these errors
UDP ignores most of these errors
CSIT 220 (Blum)
12
Header Format
Indicates the version of IP being used (typically version 4)
CSIT 220 (Blum)
13
Header Format
Indicates how big the header is, i.e. how many groups of 32.
It is usually 5, since options are rare.
CSIT 220 (Blum)
14
Header Format
Indicates how packet should be sent, to minimize delay,
maximize throughput, etc.
CSIT 220 (Blum)
15
Type of Service
CSIT 220 (Blum)
16
Header Format
Indicates the total length of the packet: how many octets. Can
be up to 65535, but packets are rarely that large.
CSIT 220 (Blum)
17
Header Format
Discussed in the second part of lecture
CSIT 220 (Blum)
18
Header Format
How many hops the packet is allowed before it cannot
continue, (between 1 and 255)
CSIT 220 (Blum)
19
Header Format
Deliver to UDP, TCP, etc
CSIT 220 (Blum)
20
Types or Protocols
CSIT 220 (Blum)
21
Header Format
Checks for errors in the header information, by adding all
of the 16-bit numbers
CSIT 220 (Blum)
22
Header Format
IP address of source, 32 bits in IP(v4)
CSIT 220 (Blum)
23
Header Format
IP address of destination, 32 bits in IP(v4)
CSIT 220 (Blum)
24
Header Format
Allows optional information to be conveyed, header length
indication whether or not the packet has an optional part
CSIT 220 (Blum)
25
Header Format
Header is multiple of 32 bits, padding is 0’s to get length to
work out to correct length
CSIT 220 (Blum)
26
Header Format
And last but not least, the data
CSIT 220 (Blum)
27
Terms In a Datagram Header
Service Type
Three bits are used to set a priority 0-7 which indicate
whether the packet can jump ahead in a queue at
certain routers
CSIT 220 (Blum)
Most routers ignore priority
Can indicate that packet is small but should get
through quickly (e.g. when one is telneting)
Can indicate that many large packets are coming and a
high-throughput path should be used
Can specify that the most reliable path should be used
28
Terms In a Datagram Header
Total Length
total number of octets in datagram including header and
data
Time to Live
prevents a datagram from traveling forever around a path
that contains a loop. This defines the maximum number of
hops. Each router that encounters the packet decrements
the count by 1.
The routers should eliminate loops but there may be a problem
Header Checksum
CSIT 220 (Blum)
used to test accuracy of header bits. Does not check data.
29
tracert
CSIT 220 (Blum)
30
Tracert and TTL
The TTL field plays an important role in the tracert
utility.
The first packet is transmitted with a TTL of 1,
when the router reached after one hop is reached, it
decrements the TTL to give 0. When this happens,
the router drops the packet and send a special
message – an Internet Control Message Protocol
(ICMP) message back to source. And the source
now knows the IP address of the first hop node.
It then issues a packet with a TTL of 2, …
CSIT 220 (Blum)
31
Variable in size
The data portion of an IP datagram (packet) is
variable in size.
The data portion can be as small as a single
octet (byte).
The largest IP packet possible is 64K octets
(this includes the header portion).
We’ll save the question about overhead for the
homework.
CSIT 220 (Blum)
32
Encapsulation,
Fragmentation and
Reassembly and IP(v6)
Based on Chapters 21 and 22 in
Computer Networks and Internets
(Comer)
CSIT 220 (Blum)
33
Encapsulation
Encapsulation is the inclusion of one thing
inside another, a capsule. The outside world
deals only with the capsule and not with what
is contained in the capsule.
Decapsulation is the removal of the object
from the capsule.
CSIT 220 (Blum)
34
Encapsulation (Cont.)
When one attaches an Ethernet header and trailer to
an IP packet, one is encapsulating the IP packet.
Until it is “decapsulated,” it will be treated as an
Ethernet packet without regard for what it contains.
The same IP packet can be encapsulated in an
Ethernet frame or in a FDDI frame.
Different types of packets (IP or Novell’s IPX) can
be put into the same type of capsule (e.g. Ethernet).
CSIT 220 (Blum)
35
CSIT 220 (Blum)
36
Transmission Across the Internet
When an encapsulated frame reaches a router or
destination host, the Layer 2 header is stripped off
(decapsulation), exposing the IP datagram.
If the datagram needs to be forwarded to another
router, the current router adds a new Ethernet
header (or whatever frame protocol is used on the
next hop) and sends the new frame to the next hop.
IP Datagrams are stored in host and router memory
without the frame headers. The frame headers are
used only to send the IP Datagram across the
physical network.
CSIT 220 (Blum)
37
Encapsulating an IP packet
Making a packet the data field of a larger packet/frame.
Ethernet has a trailer too
CSIT 220 (Blum)
38
Ethernet capsule
The encapsulated data
Physical address obtained from an ARP
Indicates what kind of thing is encapsulated
CSIT 220 (Blum)
39
Ethernet
Frame
Types
CSIT 220 (Blum)
40
CSIT 220 (Blum)
41
Frame format and size depends on the network (Ethernet, FDDI, etc.)
MTU
Maximum Transmission Unit: the largest
physical packet size, measured in bytes,
that a network can transmit.
On an Ethernet LAN, the MTU is 1500 bytes,
the maximum number of data (payload) bytes
in an Ethernet frame
Any messages larger than the MTU are
divided into smaller packets (fragments)
before being sent.
CSIT 220 (Blum)
42
MTU (Cont.)
Different physical networks have different MTUs.
The MTU may also be set by the network
administrator.
If the source computer transmits packets that are too
large for some network encountered on the way to its
destination, then a router will break the packet into
smaller packets (fragmenting).
Ideally, the source computer should transmit packets
that do not require the router to fragment them as
this can result in the delay or loss of packets.
CSIT 220 (Blum)
43
A situation requiring fragmentation
If Host 1 transmits a 1500-byte IP datagram
destined for Host 2, it will have to be
fragmented when it reaches the router R.
CSIT 220 (Blum)
44
Fragmenting
If a packet is too big to be transmitted over a
particular network, its data portion is broken into
pieces and these are encapsulated in separate packets.
CSIT 220 (Blum)
45
MTU (Cont.)
There is a setting in the registry corresponding to
MTU. Some consider it a parameter to be tweaked to
improve network performance.
“For example, the MTU of many PPP connections is
576, so if you connect to the Internet via PPP, you
might want to set your machine's MTU to 576 too.
Most Ethernet networks, on the other hand, have an
MTU of 1500 ….” (webopedia)
PPP, Point-to-Point Protocol, is a way to connect a
computer to the Internet.
CSIT 220 (Blum)
46
Datagram Considerations
If an IP datagram exceeds the MTU, it is divided into
fragments and each is sent independently.
The fragments are assigned sequence numbers and
offsets. The receiver knows a frame is a fragment by
a bit set in the header.
When all fragments reach the FINAL destination,
they are joined to form the original datagram. This
is called reassembly.
Reassembly occurs only at the final destination.
CSIT 220 (Blum)
47
FLAGS
There’s a bit in the flag field to indicate that a packet has been
fragmented.
CSIT 220 (Blum)
48
FRAGMENT OFFSET
Allows fragments to be reassembled in proper order.
CSIT 220 (Blum)
49
Reassembly
Reassembly is performed by ultimate destination,
otherwise routers would have to hold on to packets to
reassemble them.
Reassembly uses the sequence numbers and the
offsets to rebuild the datagram.
IP does not guarantee datagram delivery. If part of a
fragment is received, the destination sets a timer to
receive the other pieces. If all fragments are not
received within the time period, the destination can
request a retransmission of the ENTIRE datagram.
CSIT 220 (Blum)
50
Fragment Considerations
Why retransmit the entire packet?
Since a new packet may follow a different
path, encountering different networks and
routers, fragment sizes may vary.
Therefore the old fragments are discarded.
CSIT 220 (Blum)
51
IP (v6)
Fragmentation/reassembly is one of the ways in
which IP(v6) differs from IP(v4).
The fragmentation process itself is different (in
particular where it can occur) and so is the method
of indicating that a packet has been fragmented (i.e.
IP(v6) has a different header scheme).
In IP(v4) there are fixed fields found in every
packet containing this information.
In IP(v6) a fragmented packet contains an extra
header.
CSIT 220 (Blum)
52
Fragmentation header
CSIT 220 (Blum)
Extra fragmentation header
53
Base Header/Extension Header
The creators of IP(v6) wanted to have the flexibility
of having many fields in the packet without
increasing the overhead of the typical packet.
An ordinary, lone packet would have just a “base
header.”
Additional information could be introduced in
additional headers as needed.
Part of the header indicates whether data or another
header follows it.
CSIT 220 (Blum)
54
Extension headers
IP(v6) allows for additional headers to be included if
more information than what is contained in the base
header is needed. It’s analogous to the optional field in
IP(v4). It gives the protocol flexibility.
CSIT 220 (Blum)
55
Base Header
Indicates existence and type of next header or data
CSIT 220 (Blum)
56
What’s Next?
Data from higher layer (TCP) follows
Route header follows
CSIT 220 (Blum)
57
Another IP(v6) Fragmentation Difference
In IP(v4) a source computer or a router may
fragment a message.
In IP(v6) only the source computer can
fragment a message.
In order for this to be true, the source
computer must know the smallest MTU along
the route.
CSIT 220 (Blum)
58
The path MTU
The source starts by sending a large packet
to the destination.
If no acknowledgement is received, a
smaller packet is sent, and so on.
When an acknowledgement is received,
that is the size allowed.
This size is known as the path MTU.
CSIT 220 (Blum)
59
But what about “connectionlessness”?
There is an assumption in the notion of “path
MTU” and it is that all of the packets within
the fragmentation process are going to take
the same path
But isn’t IP connectionless?
CSIT 220 (Blum)
60
It’s deja-vu all over again
The creators of IP(v6) wanted to address some of
the quality of service (QoS) issues.
Packets can be identified as belonging to a
particular "flow" so that packets that are part of a
multimedia presentation that needs to arrive in
"real time" can be provided a higher quality-ofservice relative to other customers.
There are priority settings and so forth so that
IP(v6) can support specified QoS levels
CSIT 220 (Blum)
61
Route indicator
CSIT 220 (Blum)
Information about priority and so on
62
Other important issues
The IPv6 header now includes
extensions that allow a packet to specify
a mechanism for
authenticating its origin
ensuring data integrity
ensuring privacy
CSIT 220 (Blum)
63
anycast
In IP(v6), anycast is communication between
a single sender and the nearest of several
receivers in a group.
In a multicast, a message is sent to a set of
destinations; in an anycast, a message is sent
to one of a set of destinations.
CSIT 220 (Blum)
64
Anycast (Cont.)
Anycasting is designed to let one host initiate
the efficient updating of router tables for a
group of hosts. IPv6 can determine which
gateway host is closest and sends the packets
to that host as though it were a unicast
communication. In turn, that host can anycast
to another host in the group until all routing
tables are updated.
CSIT 220 (Blum)
65
Last but not least: The 128-bit address
The most noticeable difference between IP(v4) and
IP(v6) is the length of the address
IP(v4) addresses consist of 32 bits
232 = 4294967296 = 4.3 109
IP(v6) addresses consist of 128 bits
2128 = 3.4 1038
In addition to supporting more addresses, IP(v6)
supports more levels of hierarchy
IP(v4) had two levels: network and host
CSIT 220 (Blum)
66
Notation
If one adopted a dotted decimal notation, an IP(v6)
address would be broken down into 16 octets, e.g.
105.220.136.100.255.255.255.255.0.0.18.128.140.10.255.255
An alternative notation is the colon hexadecimal
notation, which breaks the address into 8 16-bit
numbers and then represents the 16-bit number as a
4-digit hexadecimal number
69DC:8864:FFFF:FFFF:0:1280:8C0A:FFFF
CSIT 220 (Blum)
67
Converting
Two parts from the decimal dotted notation
make up one unit in “colon hex”
Starting on the left, take two dotted decimal
numbers, multiply the first by 256 and add it
to the second
105*256 + 220 = 27100
Convert that number to hexadecimal
CSIT 220 (Blum)
68
105*256 + 220
CSIT 220 (Blum)
69
Convert to hex
CSIT 220 (Blum)
70
Other References
http://www.whatis.com
http://www.webopedia.com
Understanding Data Communications &
Networks, Shay (1999)
http://www.daemon.org/ip.html
CSIT 220 (Blum)
71