Network (14 bits)

advertisement
IP
Orientation
2
 IP (Internet Protocol) is a Network Layer Protocol.
TCP
UDP
ICMP
IP
ARP
Network
Access
IGMP
Transport
Layer
Network
Layer
Link Layer
Media
 IP’s current version is Version 4 (IPv4). It is specified in
RFC 891.
IPv4 Address Model
Class
Network ID
Host ID
# of
Addresses
# of
Networks
A
0 + 7 bit
24 bit
224-2
126
B
10 + 14 bit
16 bit
65,536 - 2
214
C
110 + 21 bit
8 bit
256 - 2
221
D
1110 + Multicast Address
E
IP Multicast
Future Use
Class A:
0Network (7 bits)
Class B:
1 0
Class C:
1 1 0
Host (24 bits)
Network (14 bits)
Network (21 bits)
Host (16 bits)
Host (8 bits)
IP: The waist of the hourglass
4
 IP is the waist of the
hourglass of the Internet
protocol architecture
 Multiple higher-layer
protocols
 Multiple lower-layer protocols
 Only one protocol at the
network layer.
Applications
HTTP FTP SMTP
TCP UDP
IP
Data link layer
protocols
Physical layer
protocols
Application protocol
5
 IP is the highest layer protocol which is implemented
at both routers and hosts
Application
Application protocol
Application
TCP
TCP protocol
TCP
IP
Data Link
Host
IP
IP protocol
Data
Link
Data
Link
IP
IP protocol
Data
Link
Router
Data
Link
Data
Link
IP protocol
Data
Link
Router
Data
Link
IP
Network
Access
Host
IP Service
6
 Delivery service of IP is minimal
 IP provide provides an unreliable connectionless best effort service (also
called: “datagram service”).



Unreliable: IP does not make an attempt to recover lost packets
Connectionless: Each packet (“datagram”) is handled independently.
IP is not aware that packets between hosts may be sent in a logical
sequence
Best effort: IP does not make guarantees on the service (no throughput
guarantee, no delay guarantee,…)
IP
 IP is connectionless in the end-to-end delivery
 Data delivered in datagrams (packets / frames), each with
a header
 Combines collection of physical networks into
single, virtual network
 Transport protocols use this connectionless service
to provide connectionless data delivery (UDP) and
connection-oriented data delivery (TCP)
IP is Best Effort Delivery
 IP provides service equivalent to LAN
 Does not guarantee to prevent
 Duplicate datagrams
 Delayed or out-of-order delivery
 Corruption of data
 Datagram loss
 Reliable delivery provided by transport layer
 Network layer - IP - can detect and report errors
without actually fixing them
IP Problems
•
Higher layer protocols have to deal with losses or with
packets
•
Packets may be delivered out-of-sequence
duplicate
IP Service
10
 IP supports the following services:
one-to-one
 one-to-all
 one-to-several
(unicast)
(broadcast)
(multicast)

unicast
broadcast
multicast
 IP multicast also supports a many-to-many service.
 IP multicast requires support of other protocols (IGMP, multicast routing)
The IP Datagram
 Formally, the unit of IP data delivery is called a
datagram
 Includes header area and data area
 Datagrams can have different sizes
Header area usually fixed (20 octets) but can have options
 Data area can contain between 1 octet and 65,535 octets
(216- 1)
 Usually, data area much larger than header

Forwarding Datagrams
 The header contains all the information needed to
deliver a datagram to a destination computer




Destination address
Source address
Identifier
Other delivery information
 Routers examine the header of each datagram and
forwards the datagram along a path to the destination


Use routing table to compute next hop
Update routing tables using algorithms previously discussed

Link state, distance vector, manually
IP Datagram Format
13
bit # 0
7 8
version
header
length
15 16
ECN
DS
Identification
time-to-live (TTL)
23
24
total length (in bytes)
0
D M
F F
protocol
Fragment offset
header checksum
source IP address
destination IP address
options (0 to 40 bytes)
payload
4 bytes
 20 bytes ≤ Header Size < 24 x 4 bytes = 60 bytes
 20 bytes ≤ Total Length < 216 bytes = 65536 bytes
31
IP Datagram Format
14
 Transmission is row by row
 For each row:
1. First transmit bits 0-7
2. Then transmit bits 8-15
3. Then transmit bits 16-23
4. Then transmit bits 24-31
 Note: Many computers (incl. Intel processors) store 32-bit words in little
endian format. Others (incl. Motorola processors) use big endian.
 This is called network byte order (LE or BE)
 "Big Endian" means that the high-order byte of the
number is stored in memory at the lowest address, and
the low-order byte at the highest address.
 0x1234:

BE: 12 34 LE: 34 12
Maximum Transmission Unit
15
 Maximum size of IP datagram is 65535, but the data link layer protocol
generally imposes a limit that is much smaller
 Example:

Ethernet frames have a maximum payload of 1500 bytes
 IP datagrams encapsulated in Ethernet frame cannot be longer than
1500 bytes
 The limit on the maximum IP datagram size, imposed by the data link
protocol is called maximum transmission unit (MTU)
• MTUs for various data link protocols:
Ethernet:
1500
FDDI:
4352
802.3:
1492
ATM AAL5: 9180
802.5:
4464
PPP:
negotiated
Datagram Lifetime
 Datagrams could loop indefinitely
 Consumes resources
 Transport protocol may need upper bound on datagram life
 Datagram marked with lifetime
 Time To Live field in IP
 Once lifetime expires, datagram discarded (not forwarded)
 Hop count


Decrement time to live on passing through a each router
Time count

Need to know how long since last router
IP Fragmentation
17
• What if the route contains networks with different MTUs? Or
exceeds?
FDDI
Ring
Host A
MTUs:
FDDI: 4352
Ethernet
Router
Ethernet: 1500
• Fragmentation:
• IP router splits the datagram into several datagram
• Fragments are reassembled at receiver
Host B
Where is Fragmentation done?
18
Fragmentation can be done at the sender or at intermediate
routers
 The same datagram can be fragmented several times.
 Reassembly of original datagram is only done at destination hosts

IP datagram
H
Fragment 2
Router
H2
Fragment 1
H1
IP Fragmentation and Reassembly
length ID moreflag offset
=4000 =x
=0
=0
One large datagram becomes
several smaller datagrams
length ID moreflag offset
=1500 =x
=1
=0
length ID moreflag offset
=1500 =x
=1
=1480
length ID moreflag offset
=1040 =x
=0
=2960
Fragmenting Fragments
 A fragment may encounter a subsequent network
with even smaller MTU



Router fragments the fragment to fit
Resulting (sub)fragments look just like original fragments
(except for size)
No need to reassemble hierarchically; (sub)fragments include
position in original datagram
Dealing with Failure
 Re-assembly may fail if some fragments get lost
 Need to detect failure
 Re-assembly time out
 Assigned to first fragment to arrive
 If timeout expires before all fragments arrive, discard partial
data
Error Control
 Not guaranteed delivery
 Router should attempt to inform source if packet
discarded

e.g. for time to live expiring
 Source may modify transmission strategy
 May inform high layer protocol
 Datagram identification needed
 Destination doesn’t ACK or NAK if checksum fails,
no retries, best-effort like Ethernet
Download