Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network...

22
Datagram Fragmentation, ICMP & IPv6 IP Datagram Encapsulation Network Maximum Transmission Unit (MTU) IP Datagram Fragmentation ICMP (Internet Control Message Protocol) - Error Report Mechanism - Information Query Mechanism - ICMP Message format and Transmission - ping and traceroute Utilities IPv6 - IPv6 Features - IPv6 Header and Format - IPv6 Address Lecture 10

Transcript of Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network...

Page 1: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Datagram Fragmentation, ICMP & IPv6

• IP Datagram Encapsulation

• Network Maximum Transmission Unit (MTU) • IP Datagram Fragmentation • ICMP (Internet Control Message Protocol) - Error Report Mechanism - Information Query Mechanism - ICMP Message format and Transmission - ping and traceroute Utilities

• IPv6 - IPv6 Features - IPv6 Header and Format - IPv6 Address

Lecture 10

Page 2: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Internet Transmission Paradigm

• Source host - Forms datagram with destination address - Sends to nearest router • Intermediate routers - Forward datagram to next router • Final router - Delivers to destination host

Note: Datagram must be passed to network interface & sent across physical network. Network hardware does not recognize IP datagram format and IP address !! How is datagram transmitted across physical network ?? Address Resolution (ARP) and Encapsulation !!

network network network network

router router router Source host

Destination host

IP D IP D IP D IP D IP D

Routing Table --------- ## *** …………

Routing Table --------- ## *** …………

Routing Table --------- ## *** …………

Routing Table --------- ## *** …………

Routing Table --------- ## *** …………

Page 3: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

IP Datagram Encapsulation

Lecture 10

Frame Header Frame Data

IP Header IP Data Area

• Entire datagram treated like data encapsulated in a frame for transmission

• Frame type (0800 for Ethernet) identifies contents as IP datagram

• Frame destination address gives next hop

• Next hop Frame/Hardware Address is obtained by address resolution protocol (ARP)

• IP address will not be changed while frame address is different in different network

IP Datagram/Packet

Hardware Network Frame/Packet

Ethernet Frame

Encapsulated into a frame/packet in lower layer

Page 4: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Encapsulation Across Multiple Hops

• Each router extracts datagram, discard frame, determines next hop via ARP, encapsulates datagram in outgoing frame

• Frame headers may differ depended upon network types • Datagram survives in entire trip, but frame only survives one hop

Animation

Page 5: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Maximum Transmission Unit (MTU)

• Every hardware technology specification includes the definition of the maximum size of the frame data area - called maximum transmission unit (MTU) • IP datagrams can be larger than most hardware MTUs - IP: (216 – 1) bytes = 64K bytes - Ethernet: 1500 bytes - Token ring: 4464 bytes - FDDI: 4352 bytes - X.25: 576 bytes - PPP: 296 bytes (Point-to-Point Protocol) • Any datagram encapsulated in a hardware frame must be smaller than the MTU for that hardware • An internet may have networks with different MTUs

Ethernet Frame

Page 6: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Datagram Fragmentation

• Fragmentation: a technique to limit datagram size to smallest MTU of any network • IP uses fragmentation – split datagrams into pieces to fit in network with small MTU • Router detects datagram larger than network MTU - Splits into pieces called fragments - Each piece smaller than output network MTU • Each fragment has datagram header and is sent separately • Ultimate destination reassembles fragments

Fragmentation Fragmentation No-fragmentation Assemble fragments

No-assemble No-assemble

> MTU

Each <= MTU Fragment 1 Fragment 2 Fragment 3

Page 7: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Network links have MTU

- Different link types

with Different MTUs

* 1500 bytes for Ethernet

* 296 bytes for PPP

large IP datagram divided (“fragmented”) within net

one datagram becomes several datagrams

“reassembled” only at the final destination

IP header bits used to identify, order related fragments

Fragmentation: in: one large datagram out: 3 smaller datagrams

Reassembly

Lecture 10

Datagram Fragmentation & Reassembly

Page 8: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Fragment Related Fields in IP Header

Identification - Datagram ID - 16 bits counter Flag - Signal fragment. - 3 bits, ABC A: reserved B: 1 – no fragment 0 - fragmented C: 1 - not last fragment 0 - last fragment Fragment offset - Payload data location - Numbers of 8 bytes - 13 bits

Page 9: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

ID =x

offset =0

fragflag =0

length =4020

ID =x

offset =0

fragflag =1

length =1500

ID =x

offset =185

fragflag =1

length =1500

ID =x

offset =370

fragflag =0

length =1040

One large datagram becomes several smaller datagrams

Example

MTU = 1500 bytes

4020 byte IP datagram

20 byte IP header

4000 byte payload

3 fragments: F1, F2, F3

4000=1480+1480+1040

1480 bytes in data field

offset = multiple of 8 bytes so 1480/8 = 185 185+185 = 370

ID: set by sending host IP layer; typically increments ID num for each datagram it sends. Last fragment sent has flag field set to 0 to indicate it’s the last fragment; all other fragments have flag set to 1

If one fragment is lost, IP discards all fragments

Lecture 10

An Example of Datagram Fragmentation

F1

F2

F3

Page 10: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Sub-fragmentation and Fragment Loss

• 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 datagram

• IP may drop fragment • What happens when a fragment is lost? Destination drops entire original datagram

• How does destination identify lost fragment? - Sets timer with each fragment - If timer expires before all fragments arrive, fragment assumed lost - Datagram dropped • Source (transport/application layer protocol) assumed to retransmit

IP Hdr21 data21 IP Hdr22 data22

(sub)fragments

Page 11: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

IP Datagram Errors and ICMP

IP provides best-effort delivery Datagrams will be dropped if the following errors are detected - corrupted bits detected by header checksum - illegal address detected by routers (routing table) and ARP reply - routing loop detected by Time-To-Live (TTL) field - fragment loss detected by timeout

IP ignores errors, but reports some errors !!

Internet Control Message Protocol (ICMP) is a protocol to report errors and provide some information. - Error reporting function Report problems that a router or a destination host encounters when it processes an packet via sending an ICMP message TO a source host - Information query function Help a source host or a network manager get specific information from a router or another host

Page 12: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

Error Report and Information Query Mechanism

Error report mechanism

Source

Host Destination

Host

Router

Router

Router x

with error

with error

IP datagram

ICMP datagram

for error report

ICMP datagram

for error report

Information query mechanism

Source

Host Destination

Host

Router

Router

Router q

ICMP datagram

for information query

r

ICMP datagram

for reply

ICMP datagram

for reply

q q q

r r r

X

x

Dropped

Dropped

Page 13: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

ICMP Message Format and Transmission

- ICMP includes both error messages and information messages - ICMP message consists of ICMP header and ICMP data - ICMP encapsulates message in IP data area for transmission - ICMP datagram is processed and forwarded like conventional IP datagram

ICMP Header ICMP Data Area

ICMP Message

IP Header IP Data Area

ICMP Datagram

Type Checksum Code

Identifier Sequence Num.

ICMP Header

0 8 16 24 31

IP Header: type=1 for ICMP message

Type: error/information type

Code: detailed error type

Encapsulated

Encapsulated

Page 14: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

ICMP Message Types

• Error messages:

- Source quench (type=4)

too many datagrams to buffer in a router

- Time exceeded (type=11)

TTL becomes zero in a router (code=0)

fragment reassembly timer expires

in a host (code=1)

- Destination unreachable (type=3, code=1~15)

network disconnection or

destination host is powered down or

TCP/application not run, firewall, etc

• Information query messages: (a pair)

- Request/reply

(type=8: request, type=0: reply)

- Timestamp request/reply

(type=13: request, type=14: reply)

- Address mask request/reply

(type=17: request, type=18: reply)

Page 15: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

ICMP, Host Reachability and Internet Route

An internet host A is reachable from another host B if datagrams can be delivered from A to B

ping utility tests reachability

- Sends datagram from B to A that A echoes back to B - Uses ICMP echo request and echo reply messages Command format: ping IP-address/Host-name

List of all routers on path from A to B is called the route from A to B

traceroute uses UDP to non-existent port and TTL field to find route

- Sends ICMP echo messages with increasing TTL - Router that decrements TTL to 0 sends ICMP time exceeded message, with router's address as source address - First, with TTL=1, gets to first router, which discards and sends time exceeded message - Next, with TTL=2, gets through first router to second router - Continue, with TTL=3, 4, …, until message from destination received Command format for Unix/Linux: traceroute IP-address/Host-name

Command format for Windows: tracert IP-address/Host-name

ICMP & TraceRT Anim1

ICMP & TraceRT Anim2

ping & other network utilities

Page 16: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

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 One next version is called IPv6 !

Page 17: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

New Features in IPv6

- Large address size – 128 bits = 16 bytes - Better header format - entirely different - Base header – 40 bytes - Extension headers - Additional information stored in optional extension headers - Support for resource allocation (QoS) - flow labels and quality of service allow audio and video applications to establish appropriate connections - Support for more security - Extensible - new features can be added more easily - No checksum field - to reduce processing time in a router - No fragmentation - to reduce load of routers - Potential for the Internet of Things (IoT)

40 bytes

Page 18: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

IPv6 Base Header Format

It contains less information than IPv4 header - VERS = 6 for IPv6 - PRIORITY (8 bits) for traffic classes, such as delay, jitter, reliability requirements - PAYLOAD LENGTH (16 bits): Length excluding the base header - NEXT HEADER points to first extension header - HOP LIMIT (8 bits) same as TTL in IPv4 - FLOW LABEL (20 bits)

- used to associate datagrams belonging to a flow or communication between two applications - Specific path - Routers use FLOW LABEL to forward datagrams along prearranged path

Page 19: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

IPv6 Next Header

Purpose of multiple headers: economy and extensibility

Next header codes 0 - Hop-by-hop option 2 - ICMP 6 - TCP 17 - UDP 43 - Source routing 44 - Fragmentation 50 - Encrypted security payload 51 - Authentication 59 - Null (no next header) 60 - Destination option

Page 20: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Lecture 10

IPv6 Addressing - 128-bit addresses: Type + Rest of address - Groups of 16-bit numbers in hex separated by colons - colon hexadecimal (or colon hex) 69DC:8864:FFFF:FFFF:0:1280:8C0A:FFFF

- Special types of addresses: unicast, multicast, anycast - collection of computers with same prefix - Type: 0000 0000 - Reserved 0000 000 - ISO network addresses 0000 010 - IPX (Novell) 010 - Provided-based unicast addresses 100 - Geographic unicast addresses 1111 1111 - Multicast address - Provider-based unicast addresses for normal host -------------------------------------------------------------------------------------------------------------- | 010 | RegID(5) | ProviderID(16) | SubscriberID(24) | SubnetID(32) | HostID(48) | ------------------------------------------------------------------------------------------------- ------------- - Register ID: 11000 - INTERNIC for North America 01000 - RIPNIC for European countries 10100 - APNIC for Asian and Pacific countries - Address hierarchy - Reserved addresses - Loopback address: 000...0001 - IPv4 address: 000...000+IPv4 address = Ipv6 address

IPv6 Introduction Video

Page 21: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

A B E F

IPv6 IPv6 IPv6 IPv6

Tunnel Logical view:

Physical view: A B E F

IPv6 IPv6 IPv6 IPv6

C D

IPv4 IPv4

Flow: X Src: A Dest: F data

Flow: X Src: A Dest: F data

Flow: X Src: A Dest: F data

Src:B Dest: E

Flow: X Src: A Dest: F data

Src:B Dest: E

A-to-B: IPv6

E-to-F: IPv6

B-to-C: IPv6 inside

IPv4

B-to-C: IPv6 inside

IPv4

Lecture 10

Tunneling – Transition from IPv4 toIPv6

Not all routers can be upgraded simultaneous

How will the network operate with mixed IPv4 and IPv6 routers?

Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers

http://en.wikipedia.org/wiki/IPv6

http://ja.wikipedia.org/wiki/IPv6

Page 22: Datagram Fragmentation, ICMP & IPv6cis.k.hosei.ac.jp/~jianhua/course/com/Lecture10.pdf · network network network network Source router router router host ... - Sends datagram from

Exercise 10

1. 100 byte data is sent using IP across an Ethernet. Before sent, the data will be first formed an IP datagram and then the datagram will be encapsulated into an Ethernet Frame. Calculate the percentage of headers in sending the 100 byte data. Assume no optional field in IP header.

2. Suppose a file of 20 Kbytes to be sent from host H1 to host H2 across three networks as shown in the following figure. How many IP datagrams will be sent from H1? And how many IP datagrams will be received by H2? Assume no datagram loss, duplication and disorder during the transmissions. 3. Host A sends a message to host B and never receive reply from B. However, host A receives an ICMP message with a header in hexadecimal format as the follows 03 01 1A C8 31 00 B7 Give possible reasons that A does not receive reply from B.

4. Explain how traceroute utility works. Use the utility in a Windows OS environment to probe the Internet organization web server. The command is tracert www.ietf.org . How many routes

have been passed when your packet travel to the web server? Which one is the slowest?

5. Summarize main features of IPv6 as compared with IPv4.

Toking Ring MTU=4464

Ethernet MTU=1500

FDDI MTU=4352 R1 R2 H1 H2