1 Lecture 11: The Network Layer Slides adapted from: Congestion slides for Computer Networks: A...

34
1 Lecture 11: The Network Layer Slides adapted from: Congestion slides for Computer Networks: A Systems Approach (Peterson and Davis) Chapter 3 slides for Computer Networking: A Top Down Approach Featuring the Internet (Kurose and Ross) ITCS 6166/8166 091 Spring 2007 Jamie Payton Department of Computer Science University of North Carolina at Charlotte February 14, 2007
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    0

Transcript of 1 Lecture 11: The Network Layer Slides adapted from: Congestion slides for Computer Networks: A...

1

Lecture 11:

The Network Layer

Slides adapted from:Congestion slides for Computer Networks: A Systems Approach (Peterson and Davis)

Chapter 3 slides for Computer Networking: A Top Down Approach Featuring the Internet (Kurose and Ross)

ITCS 6166/8166 091Spring 2007

Jamie PaytonDepartment of Computer Science

University of North Carolina at Charlotte

February 14, 2007

2

Announcements

• Homework 2 – Due: Feb. 16 at 5 pm– Submit through WebCT

• Homework 3 – Available!– Due: Feb. 21

3

Homework 3 Helpful Tips

• TCP timeout– Doubles after a packet loss

• Simple form of congestion control

• TCP congestion window– At the conceptual level

• Doubles each RTT

– In implementation• Window size increases by 1 MSS for every ACK

4

The Network Layer

• Function of network layer– Provide end-to-end

connectivity• Addressing• Forwarding and Routing

• Two network types– Connection-oriented

• Virtual circuit networks

– Connectionless• Datagram networks

5

Network Layer Overview:

Forwarding and Routing

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

• forwarding: process of getting through single interchange

6

1

23

0111

value in arrivingpacket’s header

routing algorithm

local forwarding table

header value output link

0100010101111001

3221

Network Layer Overview:

Forwarding and Routing

7

Network Layer Overview:

Network Service Models

• Network service model defines characteristics of end-to-end transport

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

8

Network Layer Overview:

Network Layer Service ModelsNetwork

Architecture

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 ?

9

Network Layer Overview:

Connections

• Have two types of networks– Connection-oriented – Connectionless

• Similar to services in transport layer, but– service: host-to-host– no choice: network provides one

or the other– implementation: in network core

• Support different network service models

10

Virtual Circuit Networks

• Provide connection-oriented service through virtual circuits (VC)

• Connection process– Connection setup– Data transfer– Connection teardown

• Router maintains state for every connection

• Possible services provided– In-order packet delivery– Guaranteed bandwidth– Guaranteed maximum jitter

• Examples: ATM networks

11

VC ImplementationA VC consists of:

1. path from source to destination

2. VC numbers, one number for each link along path

3. entries in forwarding tables in routers along path

• Packet belonging to VC carries VC number• VC number can be changed on each link.

– New VC number comes from forwarding table

12

VC Forwarding Table

12 22 32

12

3

VC number

interfacenumber

Outgoing VC #

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

Forwarding table in NW router:

Routers maintain connection state information!

Incoming interface Incoming VC # Outgoing interface

13

Datagram Networks

• Provide connectionless network-layer transport through datagram networks

• Packets are sent independently of each other– Each packet has full set of control information

• Sent using destination address

– Every switch needs to be able to handle any packet

• No need for per-connection state• Services

– “Best-effort”– Not in-order delivery– No guarantees on bandwidth, jitter

• Used in the Internet!

14

Internet Network Layer

• Relies on: – Internet Protocol (IP)

• Data format and transfer

– Internet Control

Message Protocol (ICMP)• Error handling

– Routing protocols• Determines forwarding

tablesNetwork Layer

15

IP Protocol

• IP packet format– 20 byte header– + options– + data

• IP header– Version– Source and destination

addresses– Length– Upper layer protocol– Time-to-live (TTL)– Header checksum– Fields for “fragmentation”

16

IP Fragmentation & Reassembly• Network links have MTU

(max. transfer size) – largest possible link-level

frame

– different link types, different MTUs

• Large IP datagram is “fragmented”

– one datagram becomes several datagrams

– “reassembled” at final destination

– IP header bits used to identify, order related fragments

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

17

IP Fragmentation and Reassembly

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=1040

One large datagram becomesseveral smaller datagrams

Example• 4000 byte

datagram• MTU = 1500 bytes

1480 bytes in data field

offset =1480/8

18

Overview of IP Addressing

• A 32-bit globally unique identifier for an interface– Typically written in dotted-decimal notation:

192.168.0.1

• IP address assignment– In blocks of neighboring IP addresses: “subnets”– Notation: lowest address / prefix: 192.168.0.128/25

• Allocation of addresses is crucial for routing

19

IP Addressing• IP address: 32-bit

identifier for host, router interface

• interface: connection between host/router and physical link– routers typically have

multiple interfaces– host typically has one

interface– IP addresses

associated with each interface

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

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

20

Subnets• IP address:

– subnet part (high order bits)

– host part (low order bits)

• What’s a subnet ?– device interfaces

with same subnet part of IP address

– can physically reach each other without intervening router

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

network consisting of 3 subnets

subnet

21

Subnets 223.1.1.0/24223.1.2.0/24

223.1.3.0/24

Recipe• To determine the

subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.

Subnet mask: /24

22

IP Addressing: CIDRCIDR: Classless InterDomain Routing

– subnet portion of address of arbitrary length– address format: a.b.c.d/x, where x is # bits in

subnet portion of address

11001000 00010111 00010000 00000000

subnetpart

hostpart

200.23.16.0/23

23

IP Addresses: How to Get One?

Q: How does host get IP address?• hard-coded by system admin in a file

– Wintel: control-panel->network->configuration->tcp/ip->properties

– UNIX: /etc/rc.config• DHCP: Dynamic Host Configuration Protocol: dynamically get

address from as server– “plug-and-play”

(more in next chapter)

24

IP Addresses: How to Get One?

Q: How does network get subnet 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

25

Hierarchical Addressing: Route Aggregation

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16”

200.23.20.0/23Organization 2

...

...

Hierarchical addressing allows efficient advertisement of routing information:

26

Hierarchical Addressing

ISPs-R-Us has a more specific route to Organization 1

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16or 200.23.18.0/23”

200.23.20.0/23Organization 2

...

...

27

IP Addressing

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

28

Network Address Translation (NAT)

• Limited number of IP addresses– Block of addresses reserved for “local” use– 10.*.*.* and 192.168.*.*

• Network address translator– Connects local net through single outside IP address

29

NAT: Network Address Translation

10.0.0.1

10.0.0.2

10.0.0.3

S: 10.0.0.1, 3345D: 128.119.40.186, 80

1

10.0.0.4

138.76.29.7

1: host 10.0.0.1 sends datagram to 128.119.40.186, 80

NAT translation tableWAN side addr LAN side addr

138.76.29.7, 5001 10.0.0.1, 3345…… ……

S: 128.119.40.186, 80 D: 10.0.0.1, 3345

4

S: 138.76.29.7, 5001D: 128.119.40.186, 80

2

2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table

S: 128.119.40.186, 80 D: 138.76.29.7, 5001

3

3: Reply arrives dest. address: 138.76.29.7, 5001

4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345

30

Internet Network Layer

• Relies on: – Internet Protocol (IP)

• Data transfer

– Internet Control

Message Protocol (ICMP)• Error handling

– Routing protocols• Determines forwarding

tablesNetwork Layer

31

ICMP: Internet Control Message Protocol

• Used by hosts & routers to communicate network-level information

– Error reporting • Unreachable host

• Unreachable Network

• Unreachable Port

• Unknown Protocol

– Echo request/reply • Used by ping

• Network-layer “above” IP:

– ICMP msgs carried in IP datagrams

• ICMP message: – Type

– Code

– First 8 bytes of IP datagram causing error

32

ICMP Messages

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)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header

33

Internet Network Layer

• Relies on: – Internet Protocol (IP)

• Data transfer

– Internet Control

Message Protocol (ICMP)• Error handling

– Routing protocols• Determines forwarding

tablesNetwork Layer

34

Summary

• Network Layer – Connection versus connectionless

• Virtual Circuits vs. Datagram Networks

– Network Layer Functions• Addressing• Next time: Forwarding and Routing