csci4211: network layer: part i1 network layer: part i network layer and ip protocol! part i:...

71
CSci4211: Network Layer: Part I 1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models Network Layer Functions IP Addressing Network Service Models: Virtual Circuit vs. Datagram IP Forwarding and IP Protocol IP Datagram Forwarding Model IP and ICMP: Datagram Format, IP Fragmentation, … DHCP Briefly: NAT, IPv6 and IPv6 transition (over IPv4) Router Architecture Readings: Textbook: Chapter 4, Sections 4.1-4.4, review section 1.3 (packet vs. circuit switching)

Upload: cecilia-lamb

Post on 30-Dec-2015

262 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

1

Network Layer: Part I Network Layer and IP Protocol!Part I:• Network Layer Functions and Service Models

– Network Layer Functions – IP Addressing– Network Service Models: Virtual Circuit vs. Datagram

• IP Forwarding and IP Protocol– IP Datagram Forwarding Model– IP and ICMP: Datagram Format, IP Fragmentation, …– DHCP

• Briefly: NAT, IPv6 and IPv6 transition (over IPv4)• Router Architecture

Readings: Textbook: Chapter 4, Sections 4.1-4.4, review section 1.3 (packet vs. circuit switching)

Page 2: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

2

What Does Network Layer Do?• End-to-end deliver

packet from sending to receiving hosts, “hop-by-hop” thru network– A network-wide concern!– Involves every router,

host in the network

• Compare:– Transport layer

• between two end hosts– Data link layer

• over a physical link directly connecting two (or more) physically hosts

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 3: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

3

Network layer• transport segment from sending to receiving

host • on sending side encapsulates segments into

datagrams• on rcving side, delivers segments to transport

layer• network layer protocols in every host, router• Router examines header fields in all IP

datagrams passing through it

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 4: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

4

Network Layer Functions• Addressing

– Globally unique address for each routable device• Logical address, unlike MAC address (as you’ll see later)

– Assigned by network operator• Need to map to MAC address (as you’ll see later)

• Routing: building a “map” of network– Which path to use to forward packets from src to dest

• Forwarding: delivery of packets hop by hop– From input port to appropriate output port in a router

Routing and forwarding depend on network service models: datagram vs. virtual circuit

Page 5: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

5

Two Key Network-Layer Functions

• forwarding: move packets from router’s input to appropriate router output

• routing: determine route taken by packets from source to dest.

– routing algorithms

analogy:

• routing: process of planning trip from source to dest

• forwarding: process of getting through single interchange

Page 6: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

6

IPv4 Addressing: Basics• Globally unique (for “public” IP

addresses)• IPv4 address: 32-bit identifier for host, router

interface • Interface: connection between host/router and

physical link– router’s typically have multiple interfaces– host may have multiple interfaces– IP addresses associated with each interface

• Dot notation (for ease of human reading)223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 7: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

7

IP Addressing: Network vs. Host

• Two-level hierarchy – network part (high order

bits)– host part (low order bits)

• What’s a network ? (from IP address perspective)

– device interfaces with same network part of IP address

– can physically reach each other without intervening router

223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2223.1.2.1

223.1.2.6

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

multi-accessLAN

point-to-point link

Page 8: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

8

“Classful” IP Addressing

32 bits

0network host

10 network host

110 network host

1110 multicast address

A

B

C

D

class1.0.0.0 to127.255.255.255

128.0.0.0 to191.255.255.255

192.0.0.0 to223.255.255.255

224.0.0.0 to239.255.255.255

77 15 23 31

• Disadvantage: inefficient use of address space, address space exhaustion

• e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network

Page 9: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

9

Classless Addressing: CIDR CIDR: Classless InterDomain Routing• Network portion of address is of arbitrary

length• Addresses allocated in contiguous blocks

– Number of addresses assigned always power of 2

• Address format: a.b.c.d/x– x is number of bits in network portion of address

11001000 00010111 00010000 00000000

networkpart

hostpart

200.23.16.0/23

Page 10: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

10

Special IP Addresses

• Network address: host id = all 0’s• Directed broadcast address: host id =

all 1’s• Local broadcast address: all 1’s• Local host address (this computer): all 0

’s• Loopback address

– network id = 127, any host id (e.g. 127.0.0.1)

Page 11: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

11

IP Addresses: How to Get One?

Q: How does host get IP address?

• “static” assigned: i.e., hard-coded in a file– Wintel: control-panel->network->configuration->tcp/ip-

>properties– UNIX: /etc/rc.config

• Dynamically assigned: using DHCP (Dynamic Host Configuration Protocol)– dynamically get address from as server– “plug-and-play”

Page 12: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

12

DHCP: Dynamic Host Configuration Protocol

Goal: allow host to dynamically obtain its IP address from network server when it joins networkCan renew its lease on address in useAllows reuse of addresses (only hold address while connected an

“on”Support for mobile users who want to join network (more shortly)

DHCP overview:– host broadcasts “DHCP discover” msg– DHCP server responds with “DHCP offer” msg– host requests IP address: “DHCP request” msg– DHCP server sends address: “DHCP ack” msg

Page 13: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

13

DHCP Client-Server Scenario

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

B

E

DHCP server

arriving DHCP client needsaddress in thisnetwork

Page 14: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

14

DHCP Client-Server ScenarioDHCP server: 223.1.2.5 arriving

client

time

DHCP discover

src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654

DHCP offer

src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs

DHCP request

src: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs

DHCP ACK

src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs

Page 15: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

15

IP Addresses: How to Get One? …

Q: How does network get network part of IP addr?

A: gets allocated portion of its provider ISP’s address space

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. ….

Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

Page 16: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

16

IP Addressing: the Last Word...

Q: How does an ISP get block of addresses?

A: ICANN: Internet Corporation for Assigned Names and Numbers– allocates addresses– manages DNS– assigns domain names, resolves disputes

Page 17: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

17

Routing & Forwarding:Logical View of a Router

A

ED

CB

F

22

13

1

1

2

53

5

Page 18: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

18

1

23

0111

value in arrivingpacket’s header

routing algorithm

local forwarding tableheader value output link

0100010101111001

3221

Interplay between routing and forwarding

Page 19: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

19

Network Service ModelQ: What service model

for “channel” transporting packets from sender to receiver?

• guaranteed bandwidth?• preservation of inter-

packet timing (no jitter)?• loss-free delivery?• in-order delivery?• congestion feedback to

sender?

? ??virtual circuit

or datagram?

The most important abstraction provided

by network layer:

serv

ice a

bst

ract

ion

Page 20: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

20

Network Service Model (cont’d)Some Possible Examples:

Example services for individual datagrams:

• guaranteed delivery• guaranteed delivery

with less than 40 msec delay

Example services for a flow of datagrams:

• in-order datagram delivery

• guaranteed minimum bandwidth to flow

• restrictions on changes in inter-packet spacing

Page 21: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

21

Network Layer Connection vs. Connectionless Service

• datagram network provides network-layer connectionless service

• VC network provides network-layer connection service

• analogous to the transport-layer services, but:– service: host-to-host– no choice: network provides one or the other– implementation: in network core

• network vs transport layer connection service:– network: between two hosts, in case of VCs, also

involve intervening routers – transport: between two processes

Page 22: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

22

Virtual Circuit vs. Datagram• Objective of both: move packets through routers from

source to destination• Datagram Model:

– Routing: determine next hop to each destination a priori– Forwarding: destination address in packet header, used

at each hop to look up for next hop • routes may change during “session”

– analogy: driving, asking directions at every gas station, or based on the road signs at every turn

• Virtual Circuit Model: – Routing: determine a path from source to each

destination – “Call” Set-up: fixed path (“virtual circuit”) set up at “call”

setup time, remains fixed thru “call” – Data Forwarding: each packet carries “tag” or “label”

(virtual circuit id, VCI), which determines next hop– routers maintain ”per-call” state

Page 23: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

23

Virtual Circuits

• call setup/teardown for each call before data can flow– need special control protocol: “signaling” – every router on source-dest path maintains “state” (VCI

translation table) for each passing call – VCI translation table at routers along the path of a call

“weaving together” a “logical connection” for the call• link, router resources (bandwidth, buffers) may be

reserved and allocated to each VC– to get “circuit-like” performance

• Compare w/ transport-layer “connection”: only involves two end systems, no fixed path, can’t reserve bandwidth!

“source-to-dest path behaves much like telephone circuit” (but actually over packet network)– performance-wise– network actions along source-to-dest path

Page 24: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

24

VC Implementation

a VC consists of:1. path from source to destination2. VC numbers, one number for each link along path3. entries in forwarding tables in routers along path

• packet belonging to VC carries VC number (rather than dest address)

• VC number can be changed on each link.– New VC number comes from forwarding table

Page 25: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

25

VC Translation/Forwarding Table

12 22 32

1 23

VC number

interfacenumber

Incoming interface Incoming VC # Outgoing interface Outgoing VC #

1 12 3 222 63 1 18 3 7 2 171 97 3 87… … … …

Forwarding table innorthwest router:

Routers maintain connection state information!

Page 26: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

26

During data packet forwarding phase, input VCI is used to look up the table, and is “swapped” w/ output VCI (VCI translation, or “label swapping”)

VCI translation table (aka “forwarding table”), built at call set-up phase

1

2

13

1

2 2

1

four “calls” going thru the router, each entry corresponding one call

green call

purple call

blue call

orange call

Page 27: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

27

Virtual Circuit: Example

0

13

2

0

1 3

2

0

13

2

511

4

7

Router 3

Host B

Router 2

Host A

Router 1

Router 4

“call” from host A to host B along path: host A router 1 router 2 router 3 host B

•each router along path maintains an entry for the call in its VCI translation table• the entries piece together a “logical connection” for the call

• Exercise: write down the VCI translation table entry for the call at each router

Page 28: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

28

Virtual Circuit: Signaling Protocols

• used to setup, maintain teardown VC• used in ATM, frame-relay, X.25• used in part of today’s Internet: Multi-Protocol Label

Switching (MPLS) operated at “layer 2+1/2” (between data link layer and network layer) for “traffic engineering” purpose

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Initiate call 2. incoming call

3. Accept call4. Call connected5. Data flow begins 6. Receive data

Page 29: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

29

Virtual Circuit Setup/TeardownCall Set-Up: • Source: select a path from source to destination

– Use routing table (which provides a “map of network”)• Source: send VC setup request control (“signaling”) packet

– Specify path for the call, and also the (initial) output VCI – perhaps also resources to be reserved, if supported

• Each router along the path:– Determine output port and choose a (local) output VCI for the call

• need to ensure that no two distinct VCs leaving the same output port have the same VCI!

– Update VCI translation table (“forwarding table”)• add an entry, establishing an mapping between incoming VCI

& port no. and outgoing VCI & port no. for the call

Call Tear-Down: similar, but remove entry instead

Page 30: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

30

Datagram Networks: the Internet model

• no call setup at network layer• routers: no state about end-to-end connections

– no network-level concept of “connection”

• packets forwarded using destination host address– packets between same source-dest pair may take

different paths, when intermediate routes change!

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Send data 2. Receive data

Page 31: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

31

Forwarding Table

Destination Address Range Link Interface

11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111

otherwise 3

4 billion possible entries

Page 32: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

32

IP Forwarding Table4 billion possible entries! (in reality, far less, but can still have millions of “routes”)

forwarding table entry format destination network next-hop (IP address) link interface (1st IP address , network mask ) 11001000 00010111 00010000 00000000, 200.23.16.1 0 11111111 11111111 11111000 00000000

11001000 00010111 00011000 00000000, - (direct) 1 11111111 11111111 11111111 00000000

11001000 00010111 00011001 00000000, 200.23.25.6 2 11111111 11111111 11111000 00000000

otherwise 128.30.0.1 3

Page 33: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

Network Layer4-33

Route aggregation: Shrinking the forwarding table

“Send me anythingwith addresses beginning 200.23.0.0/20”

200.23.2.0/23

200.23.4.0/23

200.23.14.0/23

UMN

Organization 0

CSE DepartmentInternet

Organization 1

200.23.6.0/23Organization 2

...

...Port 1

Port 0

Port 7

CSci4211: Network Layer: Part I

Page 34: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

Network Layer4-34

Route aggregation with more specific routes

UMN-FAST has a more specific route to CSE department

“Send me anythingwith addresses beginning 200.23.0.0/20”

200.23.2.0/23

200.23.14.0/23

UMN

Organization 0

CSE DepartmentInternet

UMN-FAST “Send me anythingwith addresses beginning 200.23.14.0/23”

200.23.4.0/23Organization 2

...

...

CSci4211: Network Layer: Part I

Page 35: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

35

Longest Prefix Matching

Prefix Match Link Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3

DA: 11001000 00010111 00011000 10101010

Examples

DA: 11001000 00010111 00010110 10100001 Which interface?

Which interface?

CSci4211: Network Layer: Part I

35

Page 36: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

36

Longest Prefix Matching Prefix Match Link Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3

DA: 11001000 00010111 00011000 10101010

Examples

DA: 11001000 00010111 00010110 10100001 interface 0

interface 1

But not interface 2, the 3rd entry is also a match, but shorter!

Page 37: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

37

IP Datagram Forwarding Model

IP datagram:

miscfields

sourceIP addr

destIP addr data

• datagram remains unchanged, as it travels source to destination

• addr fields of interest here

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

forwarding table in A

Page 38: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

38

IP Forwarding: Destination in Same Net

Starting at A, send IP datagram addressed to B:

• look up net. address of B in forwarding table

• find B is on same net. as A• link layer will send datagram

directly to B inside link-layer frame– B and A are directly

connected

miscfields223.1.1.1223.1.1.3data

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

forwarding table in A

Page 39: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

39

IP Forwarding: Destination in Diff. Net

Starting at A, dest. E:• look up network address of

E in forwarding table• E on different network

– A, E not directly attached

• routing table: next hop router to E is 223.1.1.4

• link layer sends datagram to router 223.1.1.4 inside link-layer frame

• datagram arrives at 223.1.1.4

• continued…..

miscfields223.1.1.1223.1.2.3 data

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2223.1.3 223.1.1.4 2

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

forwarding table in A

Page 40: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

40

IP Forwarding: Destination in Diff. Net …

Arriving at 223.1.4, destined for 223.1.2.2

• look up network address of E in router’s forwarding table

• E on same network as router’s interface 223.1.2.9 – router, E directly attached

• link layer sends datagram to 223.1.2.2 inside link-layer frame via interface 223.1.2.9

• datagram arrives at 223.1.2.2!!! (hooray!)

miscfields223.1.1.1223.1.2.3 data

Dest. Net router Nhops interface

223.1.1 - 1 223.1.1.4 223.1.2 - 1 223.1.2.9

223.1.3 - 1 223.1.3.27

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

forwarding table in router

Page 41: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

41

Virtual Circuit vs. Datagram• Objective of both: move packets through routers from

source to destination• Datagram Model:

– Routing: determine next hop to each destination a priori– Forwarding: destination address in packet header, used

at each hop to look up for next hop • routes may change during “session”

– analogy: driving, asking directions at every gas station, or based on the road signs at every turn

• Virtual Circuit Model: – Routing: determine a path from source to each

destination – “Call” Set-up: fixed path (“virtual circuit”) set up at “call”

setup time, remains fixed thru “call” – Data Forwarding: each packet carries “tag” or “label”

(virtual circuit id, VCI), which determines next hop– routers maintain ”per-call” state

Page 42: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

42

Network Layer Service Models:

NetworkArchitecture

Internet

ATM

ATM

ATM

ATM

ServiceModel

best effort

CBR

VBR

ABR

UBR

Bandwidth

none

constantrateguaranteedrateguaranteed minimumnone

Loss

no

yes

yes

no

no

Order

no

yes

yes

yes

yes

Timing

no

yes

yes

no

no

Congestionfeedback

no (inferredvia loss)nocongestionnocongestionyes

no

Guarantees ?

• Internet model being extended: MPLS, Intserv, Diffserv– Section 5.8, sections 7.7-7.9

Page 43: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

43

Datagram or VC: Why?Internet• data exchange among

computers– “elastic” service, no

strict timing req. • “smart” end systems

(computers)– can adapt, perform

control, error recovery– simple inside network,

complexity at “edge”• many link types

– different characteristics– uniform service difficult

ATM• evolved from telephony• human conversation:

– strict timing, reliability requirements

– need for guaranteed service

• “dumb” end systems– telephones– complexity inside

network

MPLS (layer 2 ½)• evolve from ATM

– traffic engineering, fast path restoration (a priori “backup” paths)

Page 44: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

44

Routing & Forwarding:Logical View of a Router

A

ED

CB

F

22

13

1

1

2

53

5

Page 45: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

45

IP Forwarding & IP/ICMP Protocol

Networklayer routing

table

Routing protocols•path selection•RIP, OSPF, BGP

IP protocol•addressing conventions•packet handling conventions

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Data Link layer (Ethernet, WiFi, PPP, …)

Physical Layer (SONET, …)

Page 46: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

46

IP Datagram Format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifier

Internet checksum

time tolive

32 bit source IP address

IP protocol versionnumber

header length (bytes)

max numberremaining hops

(decremented at each router)

forfragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

“type” of data flgs fragment offset

upper layer

32 bit destination IP address

Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.

how much overhead with TCP?

• 20 bytes of TCP• 20 bytes of IP• = 40 bytes +

app layer overhead

Page 47: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

47

IP Datagram Format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifier

Internet checksum

time tolive

32 bit source IP address

IP protocol versionnumber

header length (bytes)

max numberremaining hops

(decremented at each router)

forfragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

“type” of data flgs fragment offset

upper layer

32 bit destination IP address

Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.

how much overhead with TCP?

• 20 bytes of TCP• 20 bytes of IP• = 40 bytes +

app layer overhead

Page 48: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

48

Fields in IP Datagram• IP protocol version: current version is 4, IPv4, new: IPv6• Header length: number of 32-bit words in the header• Type of Service:

– 3-bit priority,e.g, delay, throughput, reliability bits, …

• Total length: including header (maximum 65535 bytes)• Identification: all fragments of a packet have same

identification• Flags: don’t fragment, more fragments• Fragment offset: where in the original packet (count in 8

byte units)• Time to live: maximum life time of a packet• Protocol Type: e.g., ICMP, TCP, UDP etc• IP Option: non-default processing, e.g., IP source routing

option, etc.

Page 49: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

49

IP Fragmentation & Reassembly: Why• network links have MTU

(max.transfer size) - largest possible link-level frame.– different link types,

different MTUs • large IP datagram divided

(“fragmented”) within net– one datagram

becomes several datagrams

– “reassembled” only at final destination

– IP header bits used to identify, order related fragments

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

Page 50: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

50

IP Fragmentation & Reassembly: How• An IP datagram is chopped by a router into smaller

pieces if– datagram size is greater than network MTU– Don’t fragment option is not set

• Each datagram has unique datagram identification– Generated by source hosts

– All fragments of a packet carry original datagram id

• All fragments except the last have more flag set– Fragment offset and Length fields are modified appropriately

• Fragments of IP packet can be further fragmented by other routers along the way to destination !

• Reassembly only done at destination host (why?)– Use IP datagram id, fragment offset, fragment flags. Length– A timer is set when first fragment is received (why?)

Page 51: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

51

IP Fragmentation and Reassembly: Exp

ID=x

offset=0

fragflag=0

length=4000

ID=x

offset=0

fragflag=1

length=1500

ID=x

offset=185

fragflag=1

length=1500

ID=x

offset=370

fragflag=0

length=1060

One large datagram becomesseveral smaller datagrams

Example• 4000 byte datagram• MTU = 1500 bytes

• offset in the second fragment:

185x8=1480 (why not 1500 bytes

=length?)

• offset in the third fragment:

370x8=2960 Except for last fragment, IP fragment payload size (i.e., excluding IP header) must be multiple of 8!

Page 52: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

Quiz: Calculating length & Offset

ID=x

offset=0

fragflag=0

length=4000

Example• 4000 byte datagram• MTU = 1500 bytes

A BMTU = 1500

bytesMTU = 900 bytes

CSci4211: Network Layer: Part I

52

Page 53: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

Answer

53

ID=x

Offset= 0

fragflag=1

length= 900

ID=x

offset=110

fragflag=1

ID=x

offset= 185

fragflag=1

length= 900

ID=x

offset= 295

fragflag=1

length= 620

ID=x

offset=370

fragflag=1

length= 900

ID=x

offset= 480

fragflag=0

CSci4211: Network Layer: Part I

Page 54: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

54

ICMP: Internet Control Message Protocol

• used by hosts, routers, gateways to communication network-level information– error reporting:

unreachable host, network, port, protocol

– echo request/reply (used by ping)

• network-layer “above” IP:– ICMP msgs carried in

IP datagrams• ICMP message: type,

code plus first 8 bytes of IP datagram causing error

Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)5 0,1 redirect for network/host8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header

Page 55: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

55

ICMP Message Transport & Usage

• ICMP messages carried in IP datagrams• Treated like any other datagrams

– But no error message sent if ICMP message causes error

• Message sent to the source– 8 bytes of the original header included

• ICMP Usage (non-error, informational): Examples– Testing reachability: ICMP echo request/reply

• ping

– Tracing route to a destination: Time-to-live field• traceroute

– Path MTU discovery• Don’t fragment bit

– IP redirect (for hosts only): inform hosts of better routes

Page 56: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I 56

NAT (Network Address TranslationA fix to limited IP address space:

Page 57: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

No checksum operation

No fragmentation

Longer addressing space

Fix size IP Header

Simplified Design of IPv6

2001:0db8:85a3:0000:0000:8a2e:0370:7334

CSci4211: Network Layer: Part I

57

Can have one or more extension header fields

End hosts must perform path MTU discovery (using ICMP) per destination before sending any data!

Page 58: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

58

IPv6 address structure [common practice]

[see RFCs 3587, 4291, 6177 for more info]

Infrastructure Site

/0 /64/48

• Each site address is /48, • Providing 216 = 65,536 subnet addresses

• Current ISP allocation (min) is /32• Providing 216 = 65,536 customer site addresses• ISP allocation can be larger and can increase

Infrastructure CustomerISP

/0 /48/32

CSci4211: Network Layer: Part I

Page 59: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

59

IPv6 Transition• Dual stack hosts

– Two TCP/IP stacks co-exists on one host– Supporting IPv4 and IPv6– Client uses whichever protocol it wishes

IPv4 IPv6

www.apnic.net

??

IPv4

TCP/UDP

Application

IPv6

Link

CSci4211: Network Layer: Part I

Page 60: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

60

• IPv6 tunnel over IPv4

IPv6 Transition (cont’d)

IPv4Network

IPv6 IPv6

IPv6 Header Data

IPv4 Header IPv6 Header Data

IPv6 Header Data

tunnel

Page 61: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

61

Routing & Forwarding:Logical View of a Router

A

ED

CB

F

22

13

1

1

2

53

5

Page 62: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

62

Router Architecture OverviewTwo key router functions: • run routing algorithms/protocol (RIP, OSPF, BGP)• forwarding datagrams from incoming to outgoing link

Page 63: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

63

Input Port Functions

Decentralized switching: • given datagram dest., lookup output

port using forwarding table in input port memory

• goal: complete input port processing at ‘line speed’

• queuing: if datagrams arrive faster than forwarding rate into switch fabric

Physical layer:bit-level reception

Data link layer:e.g., Ethernetsee chapter 5

Page 64: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

64

Three Types of Switching Fabrics

Page 65: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

65

Switching Via MemoryFirst generation routers:• traditional computers with switching under direct control of CPU•packet copied to system’s memory• speed limited by memory bandwidth (2 bus crossings per datagram)

InputPort

OutputPort

Memory

System Bus

Page 66: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

66

Switching Via a Bus

• datagram from input port memory

to output port memory via a shared bus

• bus contention: switching speed limited by bus bandwidth

• 1 Gbps bus, Cisco 1900: sufficient speed for access and enterprise routers (not regional or backbone)

Page 67: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

67

Switching Via An Interconnection Network• overcome bus bandwidth limitations• Banyan networks, other interconnection nets

initially developed to connect processors in multiprocessor

• Advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric.

• Cisco 12000: switches Gbps through the interconnection network

Page 68: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

68

Output Ports

• Buffering required when datagrams arrive from fabric faster than the transmission rate

• Scheduling discipline chooses among queued datagrams for transmission

Page 69: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

69

Output Port Queueing

• buffering when arrival rate via switch exceeds output line speed

• queueing (delay) and loss due to output port buffer overflow!

Page 70: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

70

Input Port Queuing• Fabric slower than input ports combined ->

queueing may occur at input queues • Head-of-the-Line (HOL) blocking: queued

datagram at front of queue prevents others in queue from moving forward

• queueing delay and loss due to input buffer overflow!

Page 71: CSci4211: Network Layer: Part I1 Network Layer: Part I Network Layer and IP Protocol! Part I: Network Layer Functions and Service Models –Network Layer

CSci4211: Network Layer: Part I

71

Network Layer: Part I Summary• Network Layer Functions

– Addressing, Routing and Forwarding• IP Addressing Scheme: CIDR

– DHCP

• Network Service Models– Virtual Circuit vs. Datagram– Virtual Circuit Model

• VC set-up/tear-down• data forward operations

• IP Forwarding and IP Protocol– IP Datagram Forwarding Model: dest. in same net vs. diff.

net– IP and ICMP: Datagram Format, IP Fragmentation, …