cs 43: computer networks the network layerkwebb/cs43/f17/13... · cs 43: computer networks the...

33
CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017

Upload: others

Post on 02-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

CS 43: Computer NetworksThe Network Layer

Kevin Webb

Swarthmore College

November 2, 2017

Page 2: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

TCP/IP Protocol Stack

HTTP

TCP

IP

Ethernetinterface

HTTP

TCP

IP

Ethernetinterface

IP IP

Ethernetinterface

Ethernetinterface

SONETinterface

SONETinterface

host host

router router

Application Layer

Transport Layer

Link Layer

Network Layer

Page 3: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Some background…

• 1968: DARPAnet/ARPAnet (precursor to Internet)– (Defense) Advanced Research Projects Agency Network – Bob Taylor, Larry Roberts create program to build first wide-area

packet-switched network

• Mid 1970’s: new networks emerge– SATNet, Packet Radio, Ethernet– All “islands” to themselves – didn’t work together

• Big question: how to connect these networks?

Page 4: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Internetworking

• Cerf & Kahn, in 1974, “A Protocol for Packet Network Intercommunication”– Foundation for the modern Internet

• Routers forward packets from source to destination– May cross many separate networks along the way

• All packets use a common Internet Protocol– Any underlying data link protocol

– Any higher layer transport protocol

Page 5: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

DARPAnet Primary Goal: Connect Stuff

• “Effective technique for multiplexed utilization of existing interconnected networks” – David Clark (1988)

– Minimal assumptions about underlying networks

• No support for broadcast, multicast, real-time, reliability

• Extra support could actually get in the way

– Packet switched, store and forward

• Matched application needs, nets already packet switched

• Enables efficient resource sharing/high utilization

– “Gateways” interconnect networks

• Routers in today’s nomenclature

Page 6: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Internet Protocol Stack

• Application: Email, Web, …

• Transport: TCP, UDP, …

• Network: IP

• Link: Ethernet, WiFi, ATM, …

• Physical: copper, fiber, air, …

• “Hourglass” model, “thin waist”, “narrow waist”

IP

UDP

TCP

Ethernet

ATM

Email

Web

Page 7: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Internet Protocol Stack

• This should seem weird.

• Everyone uses IP?

• “Hourglass” model, “thin waist”, “narrow waist”

IP

UDP

TCP

Ethernet

ATM

Email

Web

Page 8: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Example of Internet Routing

Link

IP

TCP

SMTP

Physical

Link

IP

TCP

SMTP

Physical

Link

IP

Physical

Link

IP

Physical

Link

IP

Physical

A X Y Z B

A B

X

Y

Z

Network layer involved at every hop along the path.

Page 9: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Network Layer Functions

• Forwarding: move packets from router’s input to appropriate router output(“data plane”)

• Routing: determine route taken by packets from source to destination.(“control plane”)

Page 10: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

When should a router perform routing? Forwarding?A. Do both when a packet arrives.

B. Route in advance, forward when a packet arrives.

C. Forward in advance, route when a packet arrives.

D. Do both in advance.

E. Some other combination

Page 11: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Network Layer Functions

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

– Look up in a table

• Routing: determine route taken by packets from source to destination.

– Populating the table

Page 12: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

1

23

0111

value in arrivingpacket’s header

routing algorithm

local forwarding table

header value output link

0100

0101

0111

1001

3

2

2

1

Interplay between routing and forwarding

routing algorithm determines

end-end-path through network

forwarding table determines

local forwarding at this router

Each packet is forwarded independently.Does it have to be that way?

Page 13: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Circuit Switching

• Reserve path in advance

• (Old) telephone system

A B

Page 14: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Why doesn’t the Internet (typically) use circuits?

A. It’s too slow to establish a connection.

B. It doesn’t offer good enough performance.

C. It wastes resources.

D. It requires too many resources.

E. Some other reason.

Page 15: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Packet Switching

• Do we always need to reserve a link?

• Statistical multiplexing

– Assign multiple conversations to a physical path

– At any given time, one will have something to say

Keep link busyA B

Page 16: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Which of the following is/are generally true of packet vs. circuit switching?

1. Packet switching has less variance in performance.

2. Circuit switching is less reliable.

A. Only 1 is true.

B. Only 2 is true.

C. Both 1 and 2 are true.

D. Neither 1 nor 2 are true.

Page 17: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Circuit-switching vs. Packet switching

• Circuit switching: establish path, send data– Reserve resources, provide performance control

– Example: telephone system

• Packet switching: forward packets hop by hop– Fair sharing despite bursts, statistical multiplexing

– Example: postal system

A AB B

Page 18: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Datagram vs. “Virtual Circuit”

• Datagram network provides network-layer connectionless service (packet switching)

• Virtual-circuit network provides network-layer connection service (like circuit switching)

Page 19: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

application

transport

network

data link

physical

Virtual circuits: Signaling Protocols

• Used to setup, maintain, teardown VC

• Used in ATM, frame-relay, X.25

• Less common in today’s Internet

1. initiate call 2. incoming call

3. accept call4. call connected

5. data flow begins 6. receive dataapplication

transport

network

data link

physical

Page 20: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Datagram Networks

• No call setup at network layer

• Routers: no state about end-to-end connections

no network-level concept of “connection”

• Packets forwarded individually towards destination

1. send datagrams

application

transport

network

data link

physical

application

transport

network

data link

physical

2. receive datagrams

Page 21: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

How do we populate a router’s forwarding table?

A. A person adds entries to the table.

B. A program external to the router adds entries to the table.

C. Routers communicate with each other to add entries to the table.

D. Some other mechanism.

Page 22: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Routing

Traditional

• Routers run a routing protocol to exchange state.

• Use state to build up the forwarding table.

Assume this is the type of routing we’re talking about unless we explicitly say otherwise!

Page 23: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Routing

Traditional

• Routers run a routing protocol to exchange state.

• Use state to build up the forwarding table.

“Software-Defined”

• Routers are dumb, just do what they’re told.

• Controller service explicitly tells each router what to do.

• Rare on the Internet, hot topic in data centers.

Page 24: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Datagram Forwarding

• Routers periodically exchange state.

• Use the state to build a forwarding table (FIB)

Page 25: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

1

23

Datagram forwarding table

IP destination address in arriving packet’s header

routing algorithm

local forwarding table

dest address output link

?3

2

2

1

Page 26: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Routers exchange state (we’ll save the what and when for later). They decide, for each destination, how to get there, and build a lookup structure. What should they build?

A. A list – scan for the destination.

B. A hash table – look up the destination.

C. A tree – Follow branches that lead to the destination.

D. Some other software structure.

E. We can’t do this in software, we need special hardware.

Page 27: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

1

23

Datagram forwarding table

IP destination address in arriving packet’s header

routing algorithm

local forwarding table

dest address output link

address-range 1

address-range 2

address-range 3

address-range 4

3

2

2

1

4 billion IP addresses, so rather than list individual destination addresslist range of addresses(aggregate table entries)

Page 28: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Destination Address Range

11001000 00010111 00010000 00000000

through11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000

through11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000

through11001000 00010111 00011111 11111111

Otherwise (default gateway)

Link Interface

0

1

2

3

Q: but what happens if ranges don’t divide up so nicely?

Datagram forwarding table

Page 29: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Longest prefix matching

Destination Address Range

11001000 00010111 00010*** *********

11001000 00010111 00011000 *********

11001000 00010111 00011*** *********

Otherwise (default gateway)

DA: 11001000 00010111 00011000 10101010

examples:

DA: 11001000 00010111 00010110 10100001 which interface?

which interface?

when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.

longest prefix matching

Link interface

0

1

2

3

Page 30: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Routing

Traditional

• Routers run a routing protocol to exchange state.

• Use state to build up the forwarding table.

“Software-Defined”

• Routers are dumb, just do what they’re told.

• Controller service explicitly tells each router what to do.

• Rare on the Internet, hot topic in data centers.

Coming up in ~1 week.

Page 31: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Software-Defined Networking (SDN)

Traditional Hardware SDN Hardware

You Can’t read this, it’s too small! Seriously,

stop trying to read this, more important things

are happening elsewhere!

You Can’t read this, it’s too small! Seriously,

stop trying to read this, more important things

are happening elsewhere!

You Can’t read this, it’s too small! Seriously,

stop trying to read this, more important things

are happening elsewhere!

Left Right

35

Page 32: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Software-Defined Networking (SDN)

Traditional Hardware SDN Hardware

Controller

You Can’t read this, it’s too small! Seriously,

stop trying to read this, more important things

are happening elsewhere!

You Can’t read this, it’s too small! Seriously,

stop trying to read this, more important things

are happening elsewhere!

LeftRightRight Right

36

Page 33: CS 43: Computer Networks The Network Layerkwebb/cs43/f17/13... · CS 43: Computer Networks The Network Layer Kevin Webb Swarthmore College November 2, 2017. TCP/IP Protocol Stack

Summary

• Forwarding: moving packet from one interface to another (table lookup)

• Routing: Populating the table in advance

• On the Internet, best effort packet switching is the norm

• Hardware helps with quick forwarding using longest prefix matching