0% found this document useful (0 votes)
3 views

Unit 3 IPv4 Format and IPv6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Unit 3 IPv4 Format and IPv6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

1

Internet Protocol – IPv4


(Packet Format, Fragmentation, Options Field)

AMK, CGPIT
2

IP Packet Structure
32 Bits
4-bit 4-bit 8-bit
Version Header Type of Service
16-bit Total Length (Bytes)
Length (TOS)

3-bit
16-bit Identification Flags 13-bit Fragment Offset

8-bit Time to
8-bit Protocol 16-bit Header Checksum
Live (TTL)
Header
32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

AMK, CGPIT
3

IPv4 Header
• IP Version number (4 bits)
– First 4 bits tells about version if IP protocol
– As per the value of version field, parsing is done
– “4” (for IPv4), “6” (for IPv6)

• Header length (4 bits)


– Number of 4 Byte Words or 32-bit words in header part
– Min HLEN is 20 bytes (without options field) thus value is 5
– Max. HLEN is 60 bytes (with max options field) thus value is 15

• Type-of-Service (8 bits)
– Allow packets to be treated differently based on needs
– E.g., low delay for audio, high b/w for bulk transfer
AMK, CGPIT
4

Example

An IP packet has arrived with the first 8


bits as shown:
 01000010
The receiver discards the packet. Why?
The next 4 bits (0010) show the header length, which means (2  4 = 8),
which is wrong.

The minimum number of bytes in the header must be 20. The packet has
been corrupted in transmission.
AMK, CGPIT
5

Example

In an IP packet, the value of HLEN is


1000 in binary. How many bytes of
options are being carried by this packet?

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 main header, the next 12 bytes are the options.

AMK, CGPIT
6

IPv4 Header
4-bit
4-bit 8-bit
Version
Header
Length
Type of Service (TOS) 16-bit Total Length (Bytes)
16-bit Identification 3-bit 13-bit Fragment Offset
Flags
8-bit Time to
8-bit Protocol 16-bit Header Checksum
Live (TTL)

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

• Total length (16 bits)


– Number of (actual) bytes in the packet
– Max size is 65,535 bytes (216 -1)
– Data Links may have harder limits:
Ethernet “Max Transfer Unit” (MTU) commonly 1500 bytes
AMK, CGPIT
8

IPv4 Header
4-bit 4-bit 8-bit
Header Type of Service 16-bit Total Length (Bytes)
Version
Length (TOS)
16-bit Identification 3-bit 13-bit Fragment Offset
Flags

8-bit Time to Live 8-bit Protocol 16-bit Header Checksum


(TTL)
32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

• Time-To-Live (8 bits): Solves two purposes


– Identify and discard packets stuck in forwarding
loops and
– Limiting the journey of IP datagram
AMK, CGPIT
10

IPv4 Header
4-bit 4-bit 8-bit
Header Type of Service 16-bit Total Length (Bytes)
Version
Length (TOS)
16-bit Identification 3-bit 13-bit Fragment Offset
Flags

8-bit Time to Live 8-bit Protocol 16-bit Header Checksum


(TTL)
32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

AMK, CGPIT
11

Multiplexing of Protocols

• IP acts as carrier for various protocols


• Allows multiplexing at sender & de-mux at receiver
• Values of 8 – bit protocol field
– 1 for ICMP
– 2 for IGMP
– 6 for TCP
– 17 for UDP
– 89 for OSPF AMK, CGPIT
12

IPv4 Header
• Two IP addresses
– Source and destination (32 bits each)
• Destination address
– Unique identifier for receiving host
– Allows each node to make forwarding decisions
• Source address
– Unique identifier for sending host
– Enables recipient to send a reply back to source

AMK, CGPIT
13

Fragmentation

Values of MTU → Ethernet – 1500 FDDI – 4352 PPP – 296


What should be size of the IP payload?

3 – Bit Flag →

AMK, CGPIT
14

Fragmentation
• Only the Data is fragmented (not the header)
• Modified header is prefixed to the data
• Reassembly is done only at the destination host as:
– Packet switched network so different paths by different
fragments are possible (independently routed)
– All the fragments reach anyhow to destination host
– Reassembly at intermediate nodes is loss of Efficiency
• Fields that are directly related to fragmentation are
– Identification, Flag, Fragmentation Offset
AMK, CGPIT
15

IPv4 Header
4-bit 4-bit 8-bit
Header Type of Service 16-bit Total Length (Bytes)
Version
Length (TOS)
16-bit Identification 3-bit 13-bit Fragment Offset
Flags

8-bit Time to Live 8-bit Protocol 16-bit Header Checksum


(TTL)
32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

Three fields that are directly related to fragmentation

AMK, CGPIT
16

Options
• Used for testing, debugging and management

AMK, CGPIT
17

Option Format

AMK, CGPIT
18

No-Operation Option
• One byte filler between two options
• Used to align next option on 16 bit or 32 bit boundary
19

End-of-Option
• One byte option used for padding at the end of the last
option field
• Only one EOP could be used
• After this option, the receiver looks for the payload of IP
Datagram
20

Record Route Option


• First Byte – Code, Second Byte – Length, Third Byte – Pointer
• Pointer is offset indicates byte number of first empty entry
• Placeholder for holding outgoing IP address (Max. 9 IP
Addresses)
21

Strict Source Route Option


• Source predetermines router for datagram
• Reasons – Min. Delay, Max Throughput, Avoid Competitor
Network
• Discard Packet – If packet reaches to router not listed in SSR
option
• Discard Packet – If additional routers are traversed
22

Loose Source Route Option


• Similar to strict source router option, however, it is more
relaxed
• In addition to routers listed, datagram may travel more
routers
23

Timestamp
• Option is used to record the time of datagram processing by
router
• Time is marked in millisecond from midnight
• Ideas is to estimate time of datagram travel; one router to
another
24

Codes for Various Options


• No operation: Code is 00000001 ---- (1)10
• End of option: Code is 00000000 ---- (0)10
• Record route: Code is 00000111 ---- (7)10
• Strict source route: Code is 10001001 ---- (137)10
• Loose source route: Code is 10000011 ---- (131)10
• Timestamp: Code is 01000100 ---- (68)10
25

Internet Protocol – IPv6

Text book: TCP/IP Protocol Suite, 4th Edition, B. Forouzan


Contents are taken from Chapter 27 of above text book
26

Changes in IPv6 Compared to IPv4


• Large Address Size
– Length of IPv6 is 128 bits i.e. 16 bytes (2128 address space)
• Better Header Format
– Base header is kept fixed and is separated from options
– Options are inserted between base header and data
– Speeds-up the routing process as routers do not need to
check/process most of the options
• Improves throughput and delay
• Introduces few new options
– To allow additional functionalities (will see later)
AMK, CGPIT
27

Changes in IPv6 Compared to IPv4


• Allowance for Extension
– Provision to extend the protocol if required
• Support for Resource Allocation
– Type-of-service field has been removed
– Two new fields Traffic class and Flow label introduced
– Helps in special handling of the packets
• Support for More Security
– Two new options - encryption and authentication options
provides confidentiality and integrity

AMK, CGPIT
IPv4 v/s IPv6 Datagram
28

AMK, CGPIT
IPv4 v/s IPv6 Datagram
29

AMK, CCE
IPv4 v/s IPv6 Datagram
30

AMK, CGPIT
31

IPv6 Base Header Format

• Version – its value should be 6


• Traffic class – indicates different payloads with different
delivery requirements (replaces Type-of-Service field in IPv4)
• Flow label – it is 20 bit field, special treatment for particular
flow of data
32

IPv6 Base Header Format

• Payload length – it defines the length of payload (excluding


fixed length base header)
• Hop limit – similar to TTL field in IPv4
• Next header – defines type of the next extension header or
the type of data
33

IPv6 Payload
• It is combination of
– Zero or more extension headers and
– Followed by data from other protocol (UDP, TCP, OSPF, …)
• Many extension headers are possible in payload
• Each extension header must have two mandatory fields
– Next header and length
• Each next header field value (code) defines type of next
header
• Last ‘Next Header’ informs protocol that is carried by
datagram
AMK, CGPIT
34

Next Header Field


Diff. Ser.

Base
Header

Payload

• Next header codes


– 00: Hop-by-hop option, 02: ICMPv6, 06: TCP,
– 17: UDP, 43: Source-routing option, 44: Fragmentation, …..
AMK, CGPIT
35

Next Header Codes

AMK, CGPIT

You might also like