Top Banner
The Network Layer
30

The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

The Network Layer

Page 2: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

2

Announcements• Project 4 is due next Monday, April 9th

• Homework 5 available later today, due next Wednesday, April 11th

• Prelim II will be Thursday, April 26th, 7:30-9:00pm, in PH 101

Page 3: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

3

Review: OSI Levels• Physical Layer

– electrical details of bits on the wire

• Data Link Layer– sending “frames” of bits and error detection

• Network Layer– routing packets to the destination

• Transport Layer– reliable transmission of messages, disassembly/assembly, ordering,

retransmission of lost packets

• Session Layer– really part of transport, typically Not implemented

• Presentation Layer– data representation in the message

• Application– high-level protocols (mail, ftp, etc.)

Page 4: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

4

Review: OSI Levels

Presentation

Transport

Network

Data Link

Physical

Application

Presentation

Transport

Network

Data Link

Physical

ApplicationNode A Node B

Network

Session Session

Page 5: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

5

Review: OSI Levels

Presentation

Transport

Network

Data Link

Physical

Application

Presentation

Transport

Network

Data Link

Physical

ApplicationNode A Node B

Network

Session Session

Network

Data Link

Physical

Router

Page 6: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

6

Purpose of Network layer

• Given a packet, send it across the network to destination• 2 key issues:

– Portability: • connect different technologies

– Scalability• To the Internet scale

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 7: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

7

What does it involve?Two important functions:• routing: determine path from source to dest. • forwarding: move packets from router’s input to output

T1T3

Sts-1

T3

T1

Page 8: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

8

Network service model

Q: 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 circuitor

datagram?

The most important abstraction provided

by network layer:

serv

ice a

bst

ract

ion

Which things can be “faked” at the transport layer?

Page 9: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

9

Two connection models

• Connectionless (or “datagram”):– each packet contains enough information that routers can decide how

to get it to its final destination

• Connection-oriented (or “virtual circuit”)– first set up a connection between two nodes– label it (called a virtual circuit identifier (VCI))– all packets carry label

BAb b

C

BA1 1

C

1

Page 10: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

10

Virtual circuits: signaling protocols

• used to setup, maintain teardown VC• setup gives opportunity to reserve resources

– used in ATM (Asynchronous Transfer Mode), frame-relay, X.25 (or OSI protocol suite)

• not used in today’s Internet

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Initiate call 2. incoming call

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

Page 11: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

11

Virtual circuit switching• Forming a circuit:

– send a connection request from A to B. • Contains VCI + address of B

• VCI is the Virtual Circuit Identifier

– rule: VCI must be unique on the link its used on– switch creates an entry mapping input messages with VCI to output

port– switch picks a new VCI unique between it and next switch

a b

25

21

c12

1

Page 12: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

12

(Input link,VCI) (output link, new VCI)(1, 2) (?, ?)(1, 5) (?, ?)

Virtual circuit forwarding• For each VCI switch has a table which maps input link to

output link and gives the new VCI to use– if a’s messages come into switch 1 on link 2 and go out on link 3 then

the table will be:

a b

25

21

c12

1

Switch 1

Switch 2

Switch 3

Page 13: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

13

Virtual Circuits: Discussion• Plusses: easy to associate resources with VC

– Easy to provide QoS guarantees (bandwidth, delay)– Very little state in packet

• Minuses:– Not good in case of crashes

• Requires explicit connect and teardown phases

– What if teardown does not get to all routers?– What if one switch crashes?

• Will have to teardown and rebuild route

Page 14: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

14

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

– no network-level concept of “connection”

• packets typically routed using destination host ID– packets between same source-dest pair may take different paths

• Best effort: data corruption, packet drops, route loops

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Send data 2. Receive data

Page 15: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

15

Datagrams: ForwardingHow does packet get to the destination?• switch creates a “forwarding table”, mapping destinations to output port

(ignores input ports)• when a packet with a destination address in the table arrives, it pushes it

out on the appropriate output port• when a packet with a destination address not in the table arrives, it must

find out more routing information (next problem)

a b

c1d

22

00S1

S2

S3

1

01

Page 16: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

16

Datagrams• Plusses:

– No round trip connection setup time– No explicit route teardown– No resource reservation each flow could get max bandwidth– Easily handles switch failures; routes around it

• Minuses– Difficult to provide resource guarantees– Higher per packet overhead

• Internet uses datagrams: IP (Internet Protocol)

Page 17: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

17

Datagrams Forwarding• How to build forwarding tables?

– Manually enter it• What if nodes crashed

• What about scale?

• The graph-theoretic routing problem– Given a graph, with vertices (switches), edges (links), and edge costs

(cost of sending on that link)– Find the least cost path between any two nodes

• Path cost = (cost of edges in path)

Page 18: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

18

Simple Routing Algorithm• Choose a central node

– All nodes send their (nbr, cost) information to this node– Central node uses info to learn entire topology of the network– It then computes shortest paths between all pairs of nodes

• Using All Pair Shortest Path Algorithm

– Sends the new matrix to every node

• Nice, simple, elegant!• What is the problem?

– Scalability: centralization hurts scalability– Central node is “crushed” with traffic

Page 19: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

19

Link State Routing• Basic idea:

– Every node propagates its (nbr, cost) information– This information at all nodes is enough to construct topology– Can use a graph algorithm to find the shortest routes

• Mechanisms required:– Reliable flooding of link information– Method to calculate shortest route (Dijkstra’s algorithm)

• Example link state update packet:– [node id, (nbr, cost) list, seq. no., ttl]

• Seq. no. to identify latest updates, ttl specifies when to stop msg.

Page 20: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

20

Reliable floodingreceive(pkt) If already have a copy of LSP from pkt.ID

or if pkt’s sequence number <= copy’sdiscard pkt

elsedecrement pkt.TTLreplace copy with pktforward pkt to all links besides the one that we received it on

# done every 10 minutes or sogen_LSP()

increment node’s sequence # by onerecompute cost vectorsend created LSP to all neighbors

Page 21: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

21

Discussion: Link-State Routing

• Plusses: – Simple, determines the optimal route most of the time– Used by OSPF (Open Shortest Path First)

• Minuses:– Might have oscillations

– Avoid using load as cost metric, reduce herding effect

A

D

C

B1 1+e

e0

e

1 1

0 0

A

D

C

B2+e 0

001+e1

A

D

C

B0 2+e

1+e10 0

A

D

C

B2+e 0

e01+e1

Initially start withalmost equal routes

… everyone goes with least loaded

… recomputeLeast loaded =>

Most loaded

… recompute

Page 22: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

22

Is our routing algo scalable?• Route table size grows with size of network

– Because our address structure is flat!

• Solution: have a hierarchical structure– Used by OSPF– Divide the network into areas, each area has unique number

• Nodes carry their area number in the address 1.A, 2.B, etc.

– Nodes know complete topology in their area– Area border routers (ABR) know how to get to any other area

Page 23: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

23

Hierarchical Addressing

1.a3.b

2.b11.b2

2

00S1

S2

S3

1

01

2.a

3

3.a

2

Zone 3

Zone 2

Forwarding table for switch 1Destination switch port

2. ?3. ? 1.b ? 1.a ?

Page 24: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

24

IP has 2-layer addressing

• Each IP address is 32 bits– Network part: which network the host is on?

– Host part: identifies the host. • All hosts on same network have the same network part

• 3 classes of addresses: A, B and C

18.26.0.1

network 32-bits host

0 net host

1 7 24 bits

1 0 net host

2 14 16 bits

110 net host

3 21 8 bits

Page 25: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

25

IP addressing

• The different classes:

• Problems: inefficient, address space exhaustion– cornell.edu is a class B network (can address 64K hosts)– mit.edu is a class A network (can address 4M hosts)

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

32 bits

Unicast

Multicast

1111 reservedE 240.0.0.0 to255.255.255.255Reserved

Page 26: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

26

IP addressing: CIDR• Classless InterDomain Routing

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

– Examples:• Class A: /8

• Class B: /16

• Class C: /24

11001000 00010111 00010000 00000000

networkpart

hostpart

200.23.16.0/23

Page 27: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

27

Internet Protocol Datagram

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

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 flgsfragment

offsetupper layer

32 bit destination IP address

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

Page 28: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

28

Datagram Portability• IP Goal: To create one logical network from multiple physical

networks– All intermediate routers should understand IP– IP header information sufficient to carry the packet to destination– Goal: Run over anything!

• Problem:– Physical networks have different MTUs (maximum transfer units)– “max. transmission unit”: 1500 for Ethernet, 48 for ATM

• Solution 1:– Fit everything in the MTU (!)

Page 29: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

29

IP Fragmentation & Reassembly• Solution 2: (the one used)

– If packet size > MTU of network, then fragment into pieces• Each fragment is less than MTU size

• Each has IP headers + frag bit set + frag id + offset

– Packets may get refragmented on the way to destination– Reassembly only done at the destination– What is a good initial packet size?

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

Page 30: The Network Layer. 2 Announcements Project 4 is due next Monday, April 9th Homework 5 available later today, due next Wednesday, April 11th Prelim II.

30

Summary• Virtual Circuit

– Plusses: easy to associate resources with VC• Easy to provide QoS guarantees (bandwidth, delay)• Very little state in packet

– Minuses:• Not good in case of crashes

• Datagrams– Plusses:

• Easily handles switch failures; routes around it • No round trip connection setup time• No explicit route teardown• No resource reservation each flow could get max bandwidth

– Minuses• Difficult to provide resource guarantees• Higher per packet overhead

– Forwarding• Link-state routing: OSPF• Hierarchical addressing: IP and OSPF