Connectionless Datagram Delivery

advertisement
CSC521 – Communication Protocols
網路通訊協定
Ch.6 Connectionless Datagram Delivery
(IPv4)
吳俊興
國立高雄大學 資訊工程學系
Outline
1.
2.
3.
4.
5.
6.
7.
8.
9.
Introduction
A Virtual Network
Internet Architecture And Philosophy
The Conceptual Service Organization
Connectionless Delivery System
Purpose Of The Internet Protocol
The IPv4 Datagram
Internet Datagram Options
Summary
2
Concepts of The Internet Protocol
•A Virtual Network
IP allows a user to think of an internet as a single virtual network that
interconnects all hosts, and through which communication is possible; its
underlying architecture is both hidden and irrelevant
•Three sets of internet services – conceptual separation
Internet software is designed around three conceptual networking services
arranged in a hierarchy; much of its success has resulted because this
architecture is surprisingly robust and adaptable
3
IP Characteristics
• Provides packet delivery service
– Connectionless
– Unreliable
– Best-effort delivery
• Defines three important items
– Internet addressing scheme
– Format of packets for the (virtual) Internet
– Packet forwarding
4
Elements of a Packet Switching Protocol
• Addressing: source IP and destination IP
• Length: header length and total length
• Error control: checksum and time-to-live
• Encapsulation: fragmentation and resembling support
• Extensibility:
–
–
–
–
version
service type
de-multiplexing
IP option
5
IP Datagram Header Format
Vers
HLen
Service Type
Identification
Time to Live (TTL)
Total Length
Flags
Protocol
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
IP Options (If Any)
Padding
Data (Payload) …
• VERS: 4
• HLEN: header length in 32-bit words
• Service Type: support differentiated
services (DiffServ)
• Total Length: header + data
(MAX=65,535 octets)
• Time to Live (TTL)
– how long allowed to remain in network
– hop limit (i.e. 30, 60, 64)
• Protocol (1: ICMP; 6: TCP; 17: UDP)
• Header Checksum
• Source IP; Destination IP
6
Datagram Encapsulation
Encapsulated in Ethernet frame
• 20-octet IP header follows
14-octet Ethernet header
– Ethernet Type Field set to 0x0800
• source IP:
128.10.2.3
(800a0203)
• destination IP: 128.10.2.8
(800a0208)
• IP type: 01 (ICMP)
7
A Potential Problem – MTU Issues
• Network hardware limits maximum size of frame
– Known as the network Maximum Transmission Unit ( MTU )
– e.g., Ethernet limited to 1500 octets
• Possible ways to accommodate networks with differing MTUs
– Force datagram to be less than smallest possible MTU
• Inefficient
• Cannot know minimum MTU
– Hide the network MTU and accommodate arbitrary datagram size
• A datagram can contain up to 65535 total octets (including
header)
• Question: how is encapsulation handled if datagram exceeds
network MTU?
8
Datagram Fragmentation
• Usually performed by routers
• Divides datagram into several, smaller datagrams called
fragments
• Fragment uses same header format as datagram
• Each fragment forwarded independently
9
Illustration of Fragmentation
• Offset specifies where data belongs in original datagram
• Offset actually stored as multiples of 8 octets
• MORE FRAGMENTS bit turned off in header of fragment#3
10
Reassembly
• Ultimate destination puts fragments back together
– Known as reassembly
– No need to reassemble sub-fragments first
• Timer used to ensure all fragments arrive
– Timer started when first fragment arrives
– If timer expires, entire datagram discarded
11
Time to Live
• how long allowed to remain in network
• hop limit (i.e. 30, 60, 64)
• TTL field of datagram header decremented at each hop (i.e.,
each router)
– If TTL reaches zero, datagram discarded
• Prevents datagrams from looping indefinitely
forwarding error introduces loop)
• IETF recommends initial value of 255 (max)
(in
case
12
Checksum Field In Datagram Header
• 16-bit 1's complement checksum
• Over IP header only!
• Recomputed at each hop
unsigned short
checksum(char *ptr, int
{
unsigned short
int
unsigned long
len)
*buf = (unsigned short *) ptr;
nwords = len / 2;
sum;
for(sum = 0; nwords > 0; nwords--)
sum += swap16(*buf++);
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16);
return swap16(~sum);
}
13
Summary
• Internet Protocol (IP)
– provides basic connectionless delivery service for the Internet
– defines IP datagram to be the format of packets on the Internet
• Datagram header
– Has fixed fields
– Specifies source, destination, and type
– Allows options
• Datagram encapsulated in network frame for transmission
– Fragmentation
• Needed when datagram larger than MTU
• Usually performed by routers
• Divides datagram into fragments
– Reassembly
• Performed by ultimate destination
• If some fragment(s) do not arrive, datagram discarded
– To accommodate all possible network hardware, IP does not require
reliability (best-effort semantics)
14
Download