Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
20.56
Position of IPv4 in TCP/IP protocol
suite
20.57
IPv4 datagram format
20.58
IPv4 Header
• Variable length: 20-60 byte (multiple of 4)
• Contains routing information
20.59
IPv4 Datagram
60
IPv4 Format
• Version (4-bit): currently 4.
• Header length (4-bit): the length of the IP header in 4-byte unit.
• Type of Services(TOS):
– This field was not used earlier because of the lack of standard
– DiffServ uses this field for differentiate packet types.
• Total length
– to defines the total length of the datagram including the header in
bytes.
– 16-bit number, the maximum IP size is limited to 216 bytes, or 64
Kbytes.
20.61
IPv4 Format
• Identification
– A source node gives a unique ID to each packet.
– Identification, Flags, Fragmentation offset fields are used for fragmentation (will be covered
later)
• Time to Live (TTL)
– A packet has a limited lifetime in the network to avoid zombie packets.
– Designed to hold a timestamp, and decreased by each router. A packet is discarded by a
router if TTL is zero.
– Revised to hold the maximum number of hops the packet can travel thru the network. Each
router decrements it by one.
• Protocol
– To define payload protocol type
– 1 for ICMP
– 2 for IGMP
– 6 for TCP
– 17 for UDP
– 89 for OSPF
20.62
IPv4 Format
• Header checksum
– Refer RFC 1071
– An IP header is slightly modified by each router. At least TTL field.
– The checksum must be re-calculated by routers which is a kind of
general compuers with more than one network interface.
– The checksum must be efficiently calculated with no need of special
hardware.
• Source IP address and Destination IP address
• Options
– Variable length
– For new protocols
• Padding
– To make the header a multiple of 32-bit words
20.63
VER (4 bits) : defines the Total Length (16 bits) : defines
version of IP, current the total datagram length
version is (IPv4) IPv4 Datagram up to 65,535 bytes
Differentiate Service types defines the class of datagram for quality-of-service purpose. E.g. min.
delay, max. throughput, max. reliability, min. cost. (Not look into detail).
Identification (16 bits) Protocol (8 bits) : defines Fragmentation offset (13 bits) :
: sequence number the higher layer protocol pointer to show the offset of
(TCP or UDP) TCP = 6,
used in fragmentation ICMP = 1, UDP = 17… the data in the original
More fragments datagram
Do not fragment !
20.66
Default types of service
20.67
Values for codepoints
20.68
Example .1
An IP packet has arrived with the first 8 bits as shown:
Solution
There is an error in this packet. The 4 left-most bits
(0100) show the version, which is correct. The next 4
bits (0010) show the wrong header length (2 × 4 = 8).
The minimum number of bytes in the header must be 20.
The packet has been corrupted in transmission.
Example .2
In an IP packet, the value of HLEN is 1000 in binary. How many
bytes of options are being carried by this packet?
Solution
The HLEN value is 8, which means the total number of bytes
in the header is 8 × 4 or 32 bytes. The first 20 bytes are the
base header, the next 12 bytes are the options.
Example .3
In an IP packet, the value of HLEN is 516 and the value of the
total length field is 002816. How many bytes of data are being
carried by this packet?
Solution
The HLEN value is 5, which means the total number of bytes in
the header is 5 × 4 or 20 bytes (no options). The total length is 40
bytes, which means the packet is carrying 20 bytes of data (40 −
20).
Example .4
An IP packet has arrived with the first few hexadecimal digits as
shown below:
How many hops can this packet travel before being dropped?
The data belong to what upper layer protocol?
Solution
To find the time-to-live field, we skip 8 bytes (16 hexadecimal
digits). The time-to-live field is the ninth byte, which is 01. This
means the packet can travel only one hop. The protocol field is
the next byte (02), which means that the upper layer protocol is
IGMP (see Table 7.2)
Example .5
A packet has arrived with an M bit value of 0. Is this the first
fragment, the last fragment, or a middle fragment? Do we know
if the packet was fragmented?
Solution
If the M bit is 0, it means that there are no more fragments; the
fragment is the last one. However, we cannot say if the original
packet was fragmented or not. A non fragmented packet is
considered the last fragment.
Fragmentation Related Fields
• Length
– Length of IP fragment
• Identification
– To match up with other fragments
• Fragment offset
– Where this fragment lies in entire IP datagram
• Flags
– “More fragments” flag
– “Don’t fragment” flag
74
IP datagram
IP Packet
IP Fragmentation
• If IP packet is longer than the MTU, the router
breaks packet into smaller packets
– Called IP fragments
– Fragments are still IP packets
– Earlier in Mod A, fragmentation in TCP
MTU
IP Packet 3 2 1
IP Packets
Fragmentation
IP Fragmentation
• What is Fragmented?
– Only the original data field
– New headers are created
MTU
IP Packet 3 2 1
IP Packets
Fragmentation
IP Fragmentation
• What Does the Fragmentation?
– The router
– Not the subnet
MTU
IP Packet 3 2 1
IP Packets
Fragmentation
Multiple Fragmentations
Source Destination
Host Host
Internet Internet
Process Process
Fragmentation
Defragmentation
Defragmentation
Fragmentation and IP Fields
• More Fragments field (1 bit)
– 1 if more fragments
– 0 if not
– Source host internet process sets to 0
– If router fragments, sets More Fragments
field in last fragment to 0
– In all other fragments, sets to 1
0 0 1 1
Source IP Address
Destination IP Address
Data Field
Identification Field
• IP packet has a 16-bit Identification field
– Source host internet process places a random
number in the Identification field
– Different for each IP packet
47 47 47 47
47 47 47 47
730 212 0
Fragmentation: Recap
• IP Fragmentation
– Data field of a large IP packet is fragmented
– The fragments are sent into a series of
smaller IP packets fitting a network’s MTU
– Fragmentation is done by routers
– Fragmentation may be done multiple times
along the route
IP Fragmentation
• What if the size of an IP datagram exceeds the MTU?
IP datagram is fragmented into smaller units.
Ethernet
FDDI
Ring
Host A Router Host B
MTUs: FDDI: 4352 Ethernet: 1500
• Fragmentation:
• IP router splits the datagram into several datagram
• Fragments are reassembled at receiver
90
Where is Fragmentation done?
Router
91
What’s involved in Fragmentation?
• The following fields in the IP header
are involved:
header
version
length
DS ECN total length (in bytes)
DM
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum
92
What’s involved in Fragmentation?
• The following fields in the IP header
are involved:
header
version
length
DS ECN total length (in bytes)
DM
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum
93
IP Fragmentation Example #1
router
host
MTU = 4000
IP IP
Header Data
94
IP Fragmentation Example #2
MTU = 2000
router
router
Length = 2000, M=1, Offset = 0
Length = 3820, M=0
IP IP
IP IP Header Data
Header Data
1980 bytes
3800 bytes
Length = 1840, M=0, Offset = 1980
IP IP
Header Data
1820 bytes
95
IP Fragmentation Example #3
Length = 1500, M=1, Offset = 0
host IP IP
router
MTU = 1500 Header Data
1980 bytes
Length = 1500, M=1, Offset = 1980
500 bytes
Length = 1840, M=0, Offset = 1980 IP IP
Header Data
Length = 360, M=0, Offset = 3460
IP IP
Header Data IP IP
1480 bytes Header Data
1820 bytes
96
340 bytes
Example of Fragmentation
• A datagram with size 2400 bytes must be fragmented according to an MTU
limit of 1000 bytes
Length = 520, M=1, Offset = 1480 • Some fragments may never arrive
– After a while, give up entire process
IP IP
Header Data
IP IP
Header Data
98
Fragmentation and Reassembly
• Demonstrates many Internet concepts
– Decentralized
• Every network can choose MTU
– Connectionless
• Each fragment contains full routing information
• Fragments can proceed independently and along different routes
– Complex endpoints and simple routers (david clark paper)
• Reassembly at endpoints
99
Motivation for Change from IPv4 to IPv6
- Current version of IPv4 - is more than 30 years old
- IPv4 has shown remarkable success !!!
- Then why change?
Address space
- 32 bit address space allows for over a million networks
- But...most are Class C and too small for many organizations
- 214 = 16384 Class B network addresses already almost exhausted
Type of service
- Different applications have different requirements for delivery reliability & speed
- Current IPv4 has type of service that's not often implemented
- Effective multimedia communication
- Data encryption and authentication
Multicast
40 bytes
IPv6 Base Header Format