Network Layer: Internet Protocol (IP)

72
NETWORK LAYER: INTERNET PROTOCOL (IP)

description

Network Layer: Internet Protocol (IP). Where’s the ip ?. IP (Internet Protocol) is a Network Layer Protocol. IP’s current version is Version 4 (IPv4). It is specified in RFC 891. IP: The waist of the hourglass. IP is the waist of the hourglass of the Internet protocol architecture - PowerPoint PPT Presentation

Transcript of Network Layer: Internet Protocol (IP)

Page 1: Network Layer: Internet Protocol (IP)

NETWORK LAYER:INTERNET PROTOCOL (IP)

Page 2: Network Layer: Internet Protocol (IP)

2

IP (Internet Protocol) is a Network Layer Protocol.

IP’s current version is Version 4 (IPv4). It is specified in RFC 891.

NetworkLayer

Link Layer

IP

ARPNetworkAccess

Media

ICMP IGMP

TransportLayer

TCP UDP

WHERE’S THE IP?

Page 3: Network Layer: Internet Protocol (IP)

3

IP: THE WAIST OF THE HOURGLASS 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

Page 4: Network Layer: Internet Protocol (IP)

OUTLINE

IP Addressing Structure of an IP address Classful IP addresses Limitations and problems with classful IP

addresses Subnetting CIDR IP Version 6 addresses

IP Service IP Packet Format Fragmentation IP Packet Delivery

Page 5: Network Layer: Internet Protocol (IP)

IP ADDRESSES

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IP Header

version(4 bits)

headerlength

Type of Service/TOS(8 bits)

Total Length (in bytes)(16 bits)

Identification (16 bits)flags

(3 bits)Fragment Offset (13 bits)

Source IP address (32 bits)

Destination IP address (32 bits)

TTL Time-to-Live(8 bits)

Protocol(8 bits)

Header Checksum (16 bits)

32 bits

Page 6: Network Layer: Internet Protocol (IP)

IP ADDRESSES

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IP Header

0x4 0x5 0x00 4410

9d08 0102 00000000000002

128.143.137.144

128.143.71.21

12810 0x06 8bff

32 bits

Page 7: Network Layer: Internet Protocol (IP)

WHAT IS AN IP ADDRESS?

An IP address is a unique global address for a network interface

Exceptions: Dynamically assigned IP addresses ( DHCP, Lab

7) IP addresses in private networks ( NAT, Lab 7)

An IP address:- is a 32 bit long identifier- encodes a network number

(network prefix) and a host number

Page 8: Network Layer: Internet Protocol (IP)

The network prefix identifies a network and the host number identifies a specific host (actually, interface on the network).

How do we know how long the network prefix is? Before 1993: The network prefix is implicitly defined

(see class-based addressing)or After 1993: The network prefix is indicated by a

netmask.

NETWORK PREFIX AND HOST NUMBER

network prefixnetwork prefix host numberhost number

Page 9: Network Layer: Internet Protocol (IP)

DOTTED DECIMAL NOTATION

IP addresses are written in a so-called dotted decimal notation

Each byte is identified by a decimal number in the range [0..255]:

Example:

1000111110000000 10001001 10010000

1st Byte

= 128

2nd Byte

= 143

3rd Byte

= 137

4th Byte

= 144

128.143.137.144

Page 10: Network Layer: Internet Protocol (IP)

Example: ellington.cs.virginia.edu

Network address is: 128.143.0.0(or 128.143)

Host number is: 137.144 Netmask is: 255.255.0.0 (or ffff0000)

Prefix or CIDR notation: 128.143.137.144/16 Network prefix is 16 bits long

EXAMPLE

128.143128.143 137.144137.144

Page 11: Network Layer: Internet Protocol (IP)

SPECIAL IP ADDRESSES Reserved or (by convention) special addresses:

Loopback interfaces all addresses 127.0.0.1-127.255.255.255 are reserved for loopback

interfaces Most systems use 127.0.0.1 as loopback address loopback interface is associated with name “localhost”

IP address of a network Host number is set to all zeros, e.g., 128.143.0.0

Broadcast address Host number is all ones, e.g., 128.143.255.255 Broadcast goes to all hosts on the network Often ignored due to security concerns

Test / Experimental addresses Certain address ranges are reserved for “experimental use”. Packets should get dropped if they contain this destination address (see RFC 1918):

10.0.0.0 - 10.255.255.255172.16.0.0 -

172.31.255.255192.168.0.0 - 192.168.255.255

Convention (but not a reserved address) Default gateway has host number set to ‘1’, e.g., e.g., 192.0.1.1

Page 12: Network Layer: Internet Protocol (IP)

Subnetting

SUBNETTING Problem: Organizations

have multiple networks which are independently managed Solution 1: Allocate a

separate network address for each network

Difficult to manage From the outside of the

organization, each network must be addressable.

Solution 2: Add another level of hierarchy to the IP addressing structure

University NetworkUniversity Network

Medical School

Library

EngineeringSchool

Page 13: Network Layer: Internet Protocol (IP)

Each part of the organization is allocated a range of IP addresses (subnets or subnetworks)

Addresses in each subnet can be administered locally

ADDRESS ASSIGNMENT WITH SUBNETTING

University NetworkUniversity Network

Medical School

Library

EngineeringSchool

128.143.0.0/16

128.143.71.0/24

128.143.136.0/24

128.143.56.0/24

128.143.121.0/24

Page 14: Network Layer: Internet Protocol (IP)

BASIC IDEA OF SUBNETTING

Split the host number portion of an IP address into a subnet number and a (smaller) host number.

Result is a 3-layer hierarchy

Then: Subnets can be freely assigned within the organization Internally, subnets are treated as separate networks Subnet structure is not visible outside the organization

network prefixnetwork prefix host numberhost number

subnet numbersubnet numbernetwork prefixnetwork prefix host numberhost number

extended network prefix

Page 15: Network Layer: Internet Protocol (IP)

Routers and hosts use an extended network prefix (subnetmask) to identify the start of the host numbers

SUBNETMASK

128.143 137.144

network prefix host number

128.143 144

network prefix host numbersubnetnumber

137

extended network prefix

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

subnetmask

Page 16: Network Layer: Internet Protocol (IP)

ADVANTAGES OF SUBNETTING With subnetting, IP addresses use a 3-layer

hierarchy: Network Subnet Host

Reduces router complexity. Since external routers do not know about subnetting, the complexity of routing tables at external routers is reduced.

Note: Length of the subnet mask need not be identical at all subnetworks.

Page 17: Network Layer: Internet Protocol (IP)

EXAMPLE: SUBNETMASK 128.143.0.0/16 is the IP address of the network 128.143.137.0/24 is the IP address of the subnet

128.143.137.144 is the IP address of the host 255.255.255.0 (or ffffff00) is the subnetmask of the

host

When subnetting is used, one generally speaks of a “subnetmask” (instead of a netmask) and a “subnet” (instead of a network)

Use of subnetting or length of the subnetmask if decided by the network administrator

Consistency of subnetmasks is responsibility of administrator

Page 18: Network Layer: Internet Protocol (IP)

NO SUBNETTING

All hosts think that the other hosts are on the same network

128.143.70.0/16

128.143.137.32/16subnetmask: 255.255.0.0

128.143.71.21/16subnetmask: 255.255.0.0

128.143.137.144/16subnetmask: 255.255.0.0

128.143.71.201/16subnetmask: 255.255.0.0

Page 19: Network Layer: Internet Protocol (IP)

128.143.0.0/16

128.143.137.32/24subnetmask: 255.255.255.0

128.143.71.21/24subnetmask: 255.255.255.0

128.143.137.144/24subnetmask: 255.255.255.0

128.143.71.201/24subnetmask: 255.255.255.0

128.143.137.0/24Subnet

128.143.71.0/24Subnet

WITH SUBNETTING

Hosts with same extended network prefix belong to the same network

Page 20: Network Layer: Internet Protocol (IP)

Different subnetmasks lead to different views of the size of the scope of the network

128.143.0.0/16

128.143.137.32/26subnetmask: 255.255.255.192

128.143.71.21/24subnetmask: 255.255.255.0

128.143.137.144/26subnetmask: 255.255.255.192

128.143.71.201/16subnetmask: 255.255.0.0

128.143.71.0/24Subnet

128.143.137.128/26Subnet

128.143.137.0/26Subnet

WITH SUBNETTING

Page 21: Network Layer: Internet Protocol (IP)

CLASSFUL IP ADRESSES (UNTIL 1993)

When Internet addresses were standardized (early 1980s), the Internet address space was divided up into classes: Class A: Network prefix is 8 bits long Class B: Network prefix is 16 bits long Class C: Network prefix is 24 bits long

Each IP address contained a key which identifies the class: Class A: IP address starts with “0” Class B: IP address starts with “10” Class C: IP address starts with “110”

Page 22: Network Layer: Internet Protocol (IP)

THE OLD WAY: INTERNET ADDRESS CLASSES

Class C network id host11 0

Network Prefix24 bits

Host Number8 bits

bit # 0 1 23 242 313

Class B 1 network id host

bit # 0 1 15 162

Network Prefix16 bits

Host Number16 bits

031

Class A 0Network Prefix

8 bits

bit # 0 1 7 8

Host Number24 bits

31

Page 23: Network Layer: Internet Protocol (IP)

Class D multicast group id11 1bit # 0 1 2 313

04

Class E (reserved for future use)11 1bit # 0 1 2 313

14

05

THE OLD WAY: INTERNET ADDRESS CLASSES

We will learn about multicast addresses later in this course.

Page 24: Network Layer: Internet Protocol (IP)

PROBLEMS WITH CLASSFUL IP ADDRESSES

By the early 1990s, the original classful address scheme had a number of problems Flat address space. Routing tables on the backbone

Internet need to have an entry for each network address. When Class C networks were widely used, this created a problem. By the 1993, the size of the routing tables started to outgrow the capacity of routers.

Other problems: Too few network addresses for large networks

Class A and Class B addresses were gone Limited flexibility for network addresses:

Class A and B addresses are overkill (>64,000 addresses) Class C address is insufficient (requires 40 Class C

addresses)

Page 25: Network Layer: Internet Protocol (IP)

ALLOCATION OF CLASSFUL ADDRESSES

Page 26: Network Layer: Internet Protocol (IP)

CIDR - CLASSLESS INTERDOMAIN ROUTING IP backbone routers have one routing table

entry for each network address: With subnetting, a backbone router only needs to

know one entry for each Class A, B, or C networks This is acceptable for Class A and Class B networks

27 = 128 Class A networks 214 = 16,384 Class B networks

But this is not acceptable for Class C networks 221 = 2,097,152 Class C networks

In 1993, the size of the routing tables started to outgrow the capacity of routers

Consequence: The Class-based assignment of IP addresses had to be abandoned

Page 27: Network Layer: Internet Protocol (IP)

CIDR - CLASSLESS INTERDOMAIN ROUTING

Goals: New interpretation of the IP address space Restructure IP address assignments to increase

efficiency Permits route aggregation to minimize route

table entries

CIDR (Classless Interdomain routing) abandons the notion of classes Key Concept: The length of the network prefix

in the IP addresses is kept arbitrary Consequence: Size of the network prefix must be

provided with an IP address

Page 28: Network Layer: Internet Protocol (IP)

CIDR NOTATION CIDR notation of an IP address:

192.0.2.0/18 "18" is the prefix length. It states that the first 18

bits are the network prefix of the address (and 14 bits are available for specific host addresses)

CIDR notation can replace the use of subnetmasks (but is more general) IP address 128.143.137.144 and subnetmask

255.255.255.0 becomes 128.143.137.144/24

CIDR notation allows to drop traling zeros of network addresses:192.0.2.0/18 can be written as 192.0.2/18

Page 29: Network Layer: Internet Protocol (IP)

WHY DO PEOPLE STILL TALK ABOUT CIDR eliminates the concept of class A, B, and C

networks and replaces it with a network prefix

Existing classful network addresses are converted to CIDR addresses:

128.143.0.0 128.143.0.0/16

The change has not affected many (previously existing) enterprise networks Many network administrators (especially on

university campuses) have not noticed the change (and still talk about

(Note: CIDR was introduced with the role-out of BGPv4 as interdomain routing protocol. )

Page 30: Network Layer: Internet Protocol (IP)

CIDR ADDRESS BLOCKS CIDR notation can nicely express blocks of addresses Blocks are used when allocating IP addresses for a company

and for routing tables (route aggregation)

CIDR Block Prefix # of Host Addresses /27 32 /26 64 /25 128 /24 256 /23 512 /22 1,024 /21 2,048 /20 4,096 /19 8,192 /18 16,384 /17 32,768 /16 65,536 /15 131,072 /14 262,144 /13 524,288

Page 31: Network Layer: Internet Protocol (IP)

CIDR AND ADDRESS ASSIGNMENTS Backbone ISPs obtain large block of IP

addresses space and then reallocate portions of their address blocks to their customers.

Example: Assume that an ISP owns the address block

206.0.64.0/18, which represents 16,384 (214) IP addresses

Suppose a client requires 800 host addresses With classful addresses: need to assign a class B

address (and waste ~64,700 addresses) or four individual Class Cs (and introducing 4 new routes into the global Internet routing tables)

With CIDR: Assign a /22 block, e.g., 206.0.68.0/22, and allocated a block of 1,024 (210) IP addresses.

Page 32: Network Layer: Internet Protocol (IP)

CIDR AND ROUTING

Aggregation of routing table entries: 128.143.0.0/16 and 128.144.0.0/16 are represented as

128.142.0.0/15 Longest prefix match: Routing table lookup finds the routing

entry that matches the longest prefix

What is the outgoing interface for 128.143.137.0/24 ?

Route aggregation can be exploited when IP address blocks are assigned in an hierarchical fashion

Prefix Interface

128.0.0.0/4 interface #5

128.128.0.0/9 interface #2

128.143.128.0/17 interface #1

Routing table

Page 33: Network Layer: Internet Protocol (IP)

CIDR AND ROUTING INFORMATION

206.0.64.0/18204.188.0.0/15209.88.232.0/21

Internet

Backbone

ISP X owns:

Company X :

206.0.68.0/22

ISP y :

209.88.237.0/24

Organization z1 :

209.88.237.192/26

Organization z2 :

209.88.237.0/26

Page 34: Network Layer: Internet Protocol (IP)

CIDR AND ROUTING INFORMATION

206.0.64.0/18204.188.0.0/15209.88.232.0/21

Internet Backbone

ISP X owns:

Company X :

206.0.68.0/22

ISP y :

209.88.237.0/24

Organization z1 :

209.88.237.192/26

Organization z2 :

209.88.237.0/26

Backbone sends everything which matches the prefixes 206.0.64.0/18, 204.188.0.0/15, 209.88.232.0/21 to ISP X.

ISP X sends everything which matches the prefix: 206.0.68.0/22 to Company X,209.88.237.0/24 to ISP y

Backbone routers do not know anything about Company X, ISP Y, or Organizations z1, z2.

ISP X does not know about Organizations z1, z2.

ISP y sends everything which matches the prefix: 209.88.237.192/26 to Organizations z1 209.88.237.0/26 to Organizations z2

Page 35: Network Layer: Internet Protocol (IP)

IPV6 - IP VERSION 6

IP Version 6 Is the successor to the currently used IPv4 Specification completed in 1994 Makes improvements to IPv4 (no revolutionary

changes)

One (not the only !) feature of IPv6 is a significant increase in of the IP address to 128 bits (16 bytes)

IPv6 will solve – for the foreseeable future – the problems with IP addressing

1024 addresses per square inch on the surface of the Earth.

Page 36: Network Layer: Internet Protocol (IP)

IPV6 HEADER

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IPv6 Header

version(4 bits)

Traffic Class(8 bits)

Flow Label(24 bits)

Payload Length (16 bits)Next Header

(8 bits)Hop Limits (8 bits)

Source IP address (128 bits)

32 bits

Destination IP address (128 bits)

Page 37: Network Layer: Internet Protocol (IP)

IPV6 VS. IPV4: ADDRESS COMPARISON

IPv4 has a maximum of 232 4 billion addresses

IPv6 has a maximum of 2128 = (232)4 4 billion x 4 billion x 4 billion x 4

billion addresses

Page 38: Network Layer: Internet Protocol (IP)

NOTATION OF IPV6 ADDRESSES Convention: The 128-bit IPv6 address is written as

eight 16-bit integers (using hexadecimal digits for each integer)CEDF:BP76:3245:4464:FACE:2E50:3025:DF12

Short notation: Abbreviations of leading zeroes:

CEDF:BP76:0000:0000:009E:0000:3025:DF12

CEDF:BP76:0:0:9E :0:3025:DF12 “:0000:0000:0000” can be written as “::”

CEDF:BP76:0:0:FACE:0:3025:DF12 CEDF:BP76::FACE:0:3025:DF12

IPv6 addresses derived from IPv4 addresses have 96 leading zero bits. Convention allows to use IPv4 notation for the last 32 bits.::80:8F:89:90 ::128.143.137.144

Page 39: Network Layer: Internet Protocol (IP)

IPV6 PROVIDER-BASED ADDRESSES The first IPv6 addresses will be allocated to a

provider-based plan

Type: Set to “010” for provider-based addresses Registry: identifies the agency that registered the

addressThe following fields have a variable length (recommeded

length in “()”) Provider: Id of Internet access provider (16 bits) Subscriber: Id of the organization at provider (24

bits) Subnetwork: Id of subnet within organization (32

bits) Interface: identifies an interface at a node (48 bits)

Registry ID

Registry ID

Provider ID

Provider ID010010 Subscriber

ID Subscriber

IDInterface

IDInterface

IDSubnetwork

IDSubnetwork

ID

Page 40: Network Layer: Internet Protocol (IP)

40

THE INTERNET PROTOCOL IN THE INTERNET

IP is the highest layer protocol which is implemented at both routers and hosts

Application

TCP

IP

Data Link

Application

TCP

IP

NetworkAccess

Application protocol

TCP protocol

IP protocol IP protocol

DataLink

DataLink

IP

DataLink

DataLink

IP

DataLink

DataLink

DataLink

IP protocol

RouterRouter HostHost

Page 41: Network Layer: Internet Protocol (IP)

41

IP SERVICE 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,…)

Consequences: • Higher layer protocols have to deal with losses or with duplicate

packets

• Packets may be delivered out-of-sequence

Page 42: Network Layer: Internet Protocol (IP)

42

IP supports the following services: one-to-one (unicast) one-to-all (broadcast) one-to-several (multicast)

IP multicast also supports a many-to-many service. IP multicast requires support of other protocols (IGMP,

multicast routing)

IP SERVICE

unicastbroadcast multicast

Page 43: Network Layer: Internet Protocol (IP)

43

20 bytes ≤ Header Size < 24 x 4 bytes = 60 bytes 20 bytes ≤ Total Length < 216 bytes = 65536 bytes

IP DATAGRAM FORMAT

ECNversionheaderlength

DS total length (in bytes)

Identification Fragment offset

source IP address

destination IP address

options (0 to 40 bytes)

payload

4 bytes

time-to-live (TTL) protocol header checksum

bit # 0 15 23 248 317 16

0MF

DF

Page 44: Network Layer: Internet Protocol (IP)

44

IP DATAGRAM FORMAT

Question: In which order are the bytes of an IP datagram transmitted?

Answer: Transmission is row by row For each row:

1. First transmit bits 0-72. Then transmit bits 8-153. Then transmit bits 16-234. Then transmit bits 24-31

This is called network byte order or big endian byte ordering.

Note: Many computers (incl. Intel processors) store 32-bit words in little endian format. Others (incl. Motorola processors) use big endian.

Page 45: Network Layer: Internet Protocol (IP)

BIG ENDIAN VS. SMALL ENDIAN

Little Endian Stores the low-order byte at

the lowest address and the highest order byte in the highest address. Base Address+0 Byte0 Base Address+1 Byte1 Base Address+2 Byte2 Base Address+3 Byte3

Intel processors use this order

Big Endian Stores the high-order byte at

the lowest address, and the low-order byte at the highest address. Base Address+0 Byte3 Base Address+1 Byte2 Base Address+2 Byte1 Base Address+3 Byte0

Motorola processors use big endian.

• Conventions to store a multibyte work• Example: a 4 byte Long Integer Byte3 Byte2 Byte1 Byte0

Page 46: Network Layer: Internet Protocol (IP)

46

FIELDS OF THE IP HEADER

Version (4 bits): current version is 4, next version will be 6.

Header length (4 bits): length of IP header, in multiples of 4 bytes

DS/ECN field (1 byte) This field was previously called as Type-of-Service

(TOS) field. The role of this field has been re-defined, but is “backwards compatible” to TOS interpretation

Differentiated Service (DS) (6 bits): Used to specify service level (currently not supported

in the Internet) Explicit Congestion Notification (ECN) (2 bits):

New feedback mechanism used by TCP

Page 47: Network Layer: Internet Protocol (IP)

47

FIELDS OF THE IP HEADER

Identification (16 bits): Unique identification of a datagram from a host. Incremented whenever a datagram is transmitted

Flags (3 bits): First bit always set to 0 DF bit (Do not fragment) MF bit (More fragments) Will be explained later Fragmentation

Page 48: Network Layer: Internet Protocol (IP)

48

FIELDS OF THE IP HEADER

Time To Live (TTL) (1 byte): Specifies longest paths before datagram is

dropped Role of TTL field: Ensure that packet is eventually

dropped when a routing loop occursUsed as follows: Sender sets the value (e.g., 64) Each router decrements the value by 1 When the value reaches 0, the datagram is

dropped

Page 49: Network Layer: Internet Protocol (IP)

49

FIELDS OF THE IP HEADER Protocol (1 byte):

Specifies the higher-layer protocol. Used for demultiplexing to higher layers.

Header checksum (2 bytes): A simple 16-bit long checksum which is computed for the header of the datagram.

IP

1 = ICMP 2 = IGMP

6 = TCP 17 = UDP

4 = IP-in-IPencapsulation

Page 50: Network Layer: Internet Protocol (IP)

50

FIELDS OF THE IP HEADER

Options: Security restrictions Record Route: each router that processes the

packet adds its IP address to the header. Timestamp: each router that processes the

packet adds its IP address and time to the header.

(loose) Source Routing: specifies a list of routers that must be traversed.

(strict) Source Routing: specifies a list of the only routers that can be traversed.

Padding: Padding bytes are added to ensure that header ends on a 4-byte boundary

Page 51: Network Layer: Internet Protocol (IP)

51

MAXIMUM TRANSMISSION UNIT

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: 4352802.3: 1492 ATM AAL5: 9180802.5: 4464 PPP: negotiated

Page 52: Network Layer: Internet Protocol (IP)

52

IP FRAGMENTATION

FDDIRing

RouterHost A Host B

Ethernet

MTUs: FDDI: 4352 Ethernet: 1500

• Fragmentation: • IP router splits the datagram into several datagram• Fragments are reassembled at receiver

• What if the size of an IP datagram exceeds the MTU?IP datagram is fragmented into smaller units.

• What if the route contains networks with different MTUs?

Page 53: Network Layer: Internet Protocol (IP)

53

WHERE IS FRAGMENTATION DONE?

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 !!

Router

IP datagram H Fragment 1 H1Fragment 2 H2

Page 54: Network Layer: Internet Protocol (IP)

54

WHAT’S INVOLVED IN FRAGMENTATION?

The following fields in the IP header are involved:

Identification When a datagram is fragmented, the identification is the same in all fragments

Flags DF bit is set: Datagram cannot be fragmented and must

be discarded if MTU is too smallMF bit set: This datagram is part of a fragment and an

additional fragment follows this one

ECNversionheaderlength

DS total length (in bytes)

Identification Fragment offset

time-to-live (TTL) protocol header checksum

0MF

DF

Page 55: Network Layer: Internet Protocol (IP)

55

WHAT’S INVOLVED IN FRAGMENTATION?

The following fields in the IP header are involved:

Fragment offset Offset of the payload of the current fragment in the original datagram

Total length Total length of the current fragment

ECNversionheaderlength

DS total length (in bytes)

Identification Fragment offset

time-to-live (TTL) protocol header checksum

0MF

DF

Page 56: Network Layer: Internet Protocol (IP)

56

EXAMPLE OF FRAGMENTATION

A datagram with size 2400 bytes must be fragmented according to an MTU limit of 1000 bytes

IP datagram

Router

Fragment 2Fragment 3

MTU: 1000MTU: 4000

Fragment 1

Header length: 20

Total length: 2400

Identification: 0xa428

DF flag: 0

MF flag: 0

Fragment offset: 0

Header length: 20

Total length: 996

Identification: 0xa428

DF flag: 0

MF flag: 1

fragment offset: 0

Header length: 20

Total length: 996

Identification: 0xa428

DF flag: 0

MF flag: 1

Fragment offset: 122

Header length: 20

Total length: 448

Identification: 0xa428

DF flag: 0

MF flag: 0

Fragment offset: 244

Page 57: Network Layer: Internet Protocol (IP)

57

DELIVERY OF AN IP DATAGRAM

Ethernet

TokenRingLANEthernet

H1

R1 R2

R3 R4

H2

Network ofEthernetswitches

Point-to-point link Point-to-point link

IP

View at the data link layer layer: Internetwork is a collection of LANs or point-to-

point links or switched networks that are connected by routers

Page 58: Network Layer: Internet Protocol (IP)

58

H1

R1 R2

R3 R4

H2

10.2.1.0/24

20.1.0.0/1610.1.2.0/24

10.1.0.0/24 10.3.0.0/16

20.2.1.0/28

DELIVERY OF AN IP DATAGRAM

IP

View at the IP layer: An IP network is a logical entity with a network number We represent an IP network as a “cloud” The IP delivery service takes the view of clouds, and ignores

the data link layer view

Page 59: Network Layer: Internet Protocol (IP)

59

END-TO-END DELIVERY OF DATAGRAMS

The following conditions must hold so that an IP datagram can be successfully delivered

1. The network prefix of an IP destination address must correspond to a unique data link layer network (=LAN or point-to-point link or switched network). (The reverse need not be true!)

2. Routers and hosts that have a common network prefix must be able to exchange IP dagrams using a data link protocol (e.g., Ethernet, PPP)

3. Every data link layer network must be connected to at least one other data link layer network via a router.

1. The network prefix of an IP destination address must correspond to a unique data link layer network (=LAN or point-to-point link or switched network). (The reverse need not be true!)

2. Routers and hosts that have a common network prefix must be able to exchange IP dagrams using a data link protocol (e.g., Ethernet, PPP)

3. Every data link layer network must be connected to at least one other data link layer network via a router.

Page 60: Network Layer: Internet Protocol (IP)

60

ROUTING TABLES Each router and each host keeps a routing table which tells the

router how to process an outgoing packet Main columns:

1. Destination address: where is the IP datagram going to?2. Next hop: how to send the IP datagram?3. Interface: what is the output port?

Next hop and interface column can often be summarized as one column

Routing tables are set so that datagrams gets closer to the its destination

Destination NextHop

interface

10.1.0.0/2410.1.2.0/2410.2.1.0/2410.3.1.0/2420.1.0.0/1620.2.1.0/28

directdirectR4direct R4R4

eth0eth0serial0eth1eth0eth0

Routing table of a host or router

IP datagrams can be directly delivered (“direct”) or is sent to a router (“R4”)

Page 61: Network Layer: Internet Protocol (IP)

61

DELIVERY WITH ROUTING TABLES

D e s t i n a t i o n N e x t H o p 1 0 . 1 . 0 . 0 / 2 4 1 0 . 1 . 2 . 0 / 2 4 1 0 . 2 . 1 . 0 / 2 4 1 0 . 3 . 1 . 0 / 2 4 2 0 . 1 . 0 . 0 / 1 6 2 0 . 2 . 1 . 0 / 2 8

d i r e c t R 3 R 3 R 3 R 3 R 3

H 1

R 1 R 2

R 3 R 4

H 2

1 0 . 2 . 1 . 0 / 2 4

2 0 . 1 . 0 . 0 / 1 61 0 . 1 . 2 . 0 / 2 4

1 0 . 1 . 0 . 0 / 2 4 1 0 . 3 . 0 . 0 / 1 6

2 0 . 2 . 1 . 0 / 2 8

2 0 . 2 . 1 . 2 / 2 8

D e s t i n a t i o n N e x t H o p 1 0 . 1 . 0 . 0 / 2 4 1 0 . 1 . 2 . 0 / 2 4 1 0 . 2 . 1 . 0 / 2 4 1 0 . 3 . 1 . 0 / 2 4 2 0 . 1 . 0 . 0 / 1 6 2 0 . 2 . 1 . 0 / 2 8

d i r e c t d i r e c t R 4 d i r e c t R 4 R 4

D e s t i n a t i o n N e x t H o p 1 0 . 1 . 0 . 0 / 2 4 1 0 . 1 . 2 . 0 / 2 4 1 0 . 2 . 1 . 0 / 2 4 1 0 . 3 . 1 . 0 / 2 4 2 0 . 1 . 0 . 0 / 1 6 2 0 . 2 . 1 . 0 / 2 8

R 3 R 3 R 2 d i r e c t d i r e c t R 2

D e s t i n a t i o n N e x t H o p 1 0 . 1 . 0 . 0 / 2 4 1 0 . 1 . 2 . 0 / 2 4 1 0 . 2 . 1 . 0 / 2 4 1 0 . 3 . 1 . 0 / 2 4 2 0 . 2 . 0 . 0 / 1 6 3 0 . 1 . 1 . 0 / 2 8

R 3 d i r e c t d i r e c t R 3 R 2 R 2

D e s t i n a t i o n N e x t H o p 1 0 . 1 . 0 . 0 / 2 4 1 0 . 1 . 2 . 0 / 2 4 1 0 . 2 . 1 . 0 / 2 4 1 0 . 3 . 1 . 0 / 2 4 2 0 . 1 . 0 . 0 / 1 6 2 0 . 2 . 1 . 0 / 2 8

R 1 R 1 d i r e c t R 4 d i r e c t d i r e c t

D e s t i n a t i o n N e x t H o p 1 0 . 1 . 0 . 0 / 2 4 1 0 . 1 . 2 . 0 / 2 4 1 0 . 2 . 1 . 0 / 2 4 1 0 . 3 . 1 . 0 / 2 4 2 0 . 1 . 0 . 0 / 1 6 2 0 . 2 . 1 . 0 / 2 8

R 2 R 2 R 2 R 2 R 2 d i r e c t

to:20.2.1.2

Page 62: Network Layer: Internet Protocol (IP)

DELIVERY OF IP DATAGRAMS There are two distinct processes to delivering IP

datagrams:1. Forwarding: How to pass a packet from an input interface to the output interface? 2. Routing: How to find and setup the routing tables?

Forwarding must be done as fast as possible: on routers, is often done with support of hardware on PCs, is done in kernel of the operating system

Routing is less time-critical On a PC, routing is done as a background process 62

Page 63: Network Layer: Internet Protocol (IP)

63

PROCESSING OF AN IP DATAGRAM IN IP

UDP TCP

Inputqueue

Lookup nexthop

RoutingProtocol

Destinationaddress local?

Staticrouting

Yes

Senddatagram

IP forwardingenabled?

No

Discard

Yes No

Demultiplex

routingtable

IP module

Data Link Layer

IP router: IP forwarding enabledHost: IP forwarding disabled

Page 64: Network Layer: Internet Protocol (IP)

64

PROCESSING OF AN IP DATAGRAM IN IP Processing of IP datagrams is very similar on

an IP router and a host Main difference:

“IP forwarding” is enabled on router and disabled on host

IP forwarding enabled if a datagram is received, but it is not for the local system, the datagram will be sent to a different system

IP forwarding disabled if a datagram is received, but it is not for the local system, the datagram will be dropped

Page 65: Network Layer: Internet Protocol (IP)

65

PROCESSING OF AN IP DATAGRAM AT A ROUTER

1. IP header validation2. Process options in IP header3. Parsing the destination IP address 4. Routing table lookup5. Decrement TTL 6. Perform fragmentation (if

necessary)7. Calculate checksum8. Transmit to next hop9. Send ICMP packet (if necessary)

Receive an IP datagram

Page 66: Network Layer: Internet Protocol (IP)

66

ROUTING TABLE LOOKUP

When a router or host need to transmit an IP datagram, it performs a routing table lookup

Routing table lookup: Use the IP destination address as a key to search the routing table.

Result of the lookup is the IP address of a next hop router, and/or the name of a network interface

Page 67: Network Layer: Internet Protocol (IP)

67

TYPE OF ROUTING TABLE ENTRIES Network route

Destination addresses is a network address (e.g., 10.0.2.0/24)

Most entries are network routes

Host route Destination address is an interface address (e.g.,

10.0.1.2/32) Used to specify a separate route for certain hosts

Default route Used when no network or host route matches The router that is listed as the next hop of the default

route is the default gateway (for Cisco: “gateway of last resort)

Loopback address Routing table for the loopback address (127.0.0.1) The next hop lists the loopback (lo0) interface as

outgoing interface

Page 68: Network Layer: Internet Protocol (IP)

68

Destination address Next hop

10.0.0.0/8 128.143.0.0/16 128.143.64.0/20

128.143.192.0/20 128.143.71.0/24

128.143.71.55/32 default

R1 R2 R3 R3 R4 R3 R5

=

ROUTING TABLE LOOKUP: LONGEST PREFIX MATCH

Longest Prefix Match: Search for the routing table entry that has the longest match with the prefix of the destination IP address

1. Search for a match on all 32 bits2. Search for a match for 31 bits …..32. Search for a mach on 0 bits

Host route, loopback entry 32-bit prefix match

Default route is represented as 0.0.0.0/0 0-bit prefix match

128.143.71.21

The longest prefix match for 128.143.71.21 is for 24 bits with entry 128.143.71.0/24

Datagram will be sent to R4

Page 69: Network Layer: Internet Protocol (IP)

69

ROUTE AGGREGATION

Longest prefix match algorithm permits to aggregate prefixes with identical next hop address to a single entry

This contributes significantly to reducing the size of routing tables of Internet routers

Destination Next Hop

10.1.0.0/2410.1.2.0/2410.2.1.0/2410.3.1.0/2420.0.0.0/8

R3directdirect

R3R2

Destination Next Hop

10.1.0.0/2410.1.2.0/2410.2.1.0/2410.3.1.0/2420.2.0.0/1630.1.1.0/28

R3directdirect

R3R2R2

Page 70: Network Layer: Internet Protocol (IP)

70

HOW DO ROUTING TABLES GET UPDATED?

Adding an interface: Configuring an interface eth2

with 10.0.2.3/24 adds a routing table entry:

Adding a default gateway: Configuring 10.0.2.1 as the

default gateway adds the entry:

Static configuration of network routes or host routes

Update of routing tables through routing protocols

ICMP messages

Destination Next Hop/interface

10.0.2.0/24 eth2

Destination Next Hop/interface

0.0.0.0/0 10.0.2.1

Page 71: Network Layer: Internet Protocol (IP)

71

ROUTING TABLE MANIPULATIONS WITH ICMP

When a router detects that an IP datagram should have gone to a different router, the router (here R2)

forwards the IP datagram to the correct router sends an ICMP redirect message to the host

Host uses ICMP message to update its routing table

Destination Next Hop 10.1.0.0/24 …

R2

Destination Next Hop 10.1.0.0/24 …

R1

Ethernet

H1

R1 R2

(1) IP datagram

R1

(2) IP datagram

(3) ICMP redirect

Page 72: Network Layer: Internet Protocol (IP)

72

ICMP ROUTER SOLICITATIONICMP ROUTER ADVERTISEMENT

After bootstrapping a host broadcasts an ICMP router solicitation.

In response, routers send an ICMP router advertisement message

Also, routers periodically broadcast ICMP router advertisement

This is sometimes called the Router Discovery Protocol

Ethernet

H1

R1 R2

ICMP routeradvertisement

ICMP routeradvertisement

ICMP routersolicitation