35
Lecture 16: Network Layer Overview, Internet Protocol COMP 332, Spring 2018 Victoria Manfredi Acknowledgements: materials adapted from Computer Networking: A Top Down Approach 7 th edition: ©1996-2016, J.F Kurose and K.W. Ross, All Rights Reserved as well as from slides by Abraham Matta at Boston University, and some material from Computer Networks by Tannenbaum and Wetherall.

Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Lecture 16: Network LayerOverview, Internet Protocol

COMP 332, Spring 2018Victoria Manfredi

Acknowledgements: materials adapted from Computer Networking: A Top Down Approach 7th edition: ©1996-2016, J.F Kurose and K.W. Ross, All Rights Reserved as well as from slides by Abraham Matta at Boston University, and some material

from Computer Networks by Tannenbaum and Wetherall.

Page 2: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

1. Announcements– homework 6 posted

• discuss: UDP ping server, chat server + reliability– midterm graded

2. Network layer– overview– what’s inside a router– Internet protocol (IP)

3. Addressing– IPv4 addressing– usage in routing– how to get an IP address– IPv6 addressing– Dynamic Host Configuration Protocol (DHCP)– Network Address Translation (NAT)

2

Page 3: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Network Layer

[email protected] 3

Page 4: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Goal– move pkt from one host to another

How done on Internet?– routers

• examine header fields in every IP pkt• determines outgoing link

Internet e2e argument– some functionality only properly

implemented in end systems– smart hosts vs. dumb routers

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

networkdata linkphysical network

data linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

[email protected] 4

Network layer is in every host and router on Internet

Page 5: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Sender– encapsulates segments into packets, puts src, dest IP in IP pkt hdr

Receiver– decapsulates packets into segments, delivers to transport layer

5

TCP hdr

IP data

IP pkt

TCP data IP hdr

TCP segment

Max len of TCP data in bytes– MSS: Max Segment Size– MSS = MTU – IP hdr – TCP hdr

• TCP header >= 20bytes

Max len of IP packet in bytes– MTU: Max Transmission Unit– 1500 bytes if Ethernet used as

link layer protocol

Page 6: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

1. Control plane– comprises traffic only between routers, to

compute routes between src and dst– network-wide: routers run routing algorithms

2. Data plane– comprises traffic between end hosts,

forwarded by routers– forwarding table set based on routes

computed in control plane– local: each router stores, forwards packets

Plan trip from src to dst

Trip analogy

Get through one interchange

[email protected]

Page 7: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Routing algorithm

Local forwarding tableDest IP Output link

129.133.*.*43.*.*.*43.56.*.*189.37.35.*

2331

123

Dest IP addr in header of arriving packet

Routing (slower time scale)• routers view Internet as graph• run shortest path algorithms

Forwarding (faster time scale)• routers use paths to choose best output

link for packet destination IP address• if one link fails, chooses another

2 control-plane approaches1. traditional routing algorithms

implemented in routers2. software-defined networking

(SDN) implemented in (remote) servers [email protected] 7

Page 8: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

RoutingAlgorithm

Dataplane

Controlplane

4.1 • OVERVIEW OF NETWORK LAYER 309

tables. In this example, a routing algorithm runs in each and every router and both forwarding and routing functions are contained within a router. As we’ll see in Sec-tions 5.3 and 5.4, the routing algorithm function in one router communicates with the routing algorithm function in other routers to compute the values for its forward-ing table. How is this communication performed? By exchanging routing messages containing routing information according to a routing protocol! We’ll cover routing algorithms and protocols in Sections 5.2 through 5.4.

The distinct and different purposes of the forwarding and routing functions can be further illustrated by considering the hypothetical (and unrealistic, but technically feasible) case of a network in which all forwarding tables are configured directly by human network operators physically present at the routers. In this case, no routing protocols would be required! Of course, the human operators would need to interact with each other to ensure that the forwarding tables were configured in such a way that packets reached their intended destinations. It’s also likely that human configu-ration would be more error-prone and much slower to respond to changes in the net-work topology than a routing protocol. We’re thus fortunate that all networks have both a forwarding and a routing function!

Values in arrivingpacket’s header

1

23

Local forwardingtable

header

0100011001111001

1101

3221

output

Control plane

Data plane

Routing algorithm

Figure 4.2 ♦ Routing algorithms determine values in forward tables

M04_KURO4140_07_SE_C04.indd 309 11/02/16 3:14 PM

Individual routing algorithm components in each and every router interact in the control plane

1

2

0111

Values in arriving packet header

3

[email protected]

Page 9: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Dataplane

Controlplane

Remote Controller

CA

CA CA CA CA

1

2

0111

3

Values in arriving packet header

A distinct (typically remote) controller interacts with local control agents (CAs)

[email protected]

Page 10: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Example services– individual packets

• guaranteed delivery• guaranteed delivery with less than 40 ms delay

– flow of packets• in-order packet delivery• guaranteed minimum bandwidth to flow• restrictions on changes in inter-packet spacing

Q: What service model does network layer provide to transport layer for moving packets from sender to receiver?

[email protected] 10

Page 11: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

NetworkArchitecture

Internet

ATM

ATM

ATM

ATM

ServiceModel

best effort

CBR

VBR

ABR

UBR

Bandwidth

none

constantrate

guaranteedrate

guaranteed minimum

none

Loss

no

yes

yes

no

no

Order

no

yes

yes

yes

yes

Timing

no

yes

yes

no

no

Congestionfeedback

no (inferredvia loss)

nocongestion

nocongestion

yes

no

Guarantees ?

ATM: Asynchronous Transfer Modee.g., used in public switched telephone network

[email protected] 11

Page 12: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Network Layer

[email protected] 12

Page 13: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Run routing protocols (control) and store and forward pkts (data)

high-speed switching

fabric: connects inputs to outputs

Routing processor:run routing algorithms, maintain routing state

Router input ports Router output ports

Data plane - simpleForwarding (hardware)

Operates in nanosecond timescale

Control plane - complexRouting management (software)

Operates in millisecond timescale

Port is an interface not a socket

pkt

pkt

phys

ical

link

netw

ork

13

High-level view of generic router architecture

Page 14: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

linetermination

link layer

protocol(receive)

lookup,forwarding

queueing

Network layer– validate/update checksum, decrement TTL– switching: use header field values, lookup output port – queue: if packets arrive faster than forwarding rate

into switch fabric

Physical layer:bit-level reception,

terminate phys. conn.

Data link layer:e.g., Ethernet processing,

error-checking, de-capsulation,

switchfabric

[email protected] 14

Page 15: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Transfer packet – from input buffer to appropriate output buffer

Switching rate– rate at which packets can be transferred from inputs to outputs– N inputs: switching rate = N x line rate desirable

3 types of switching fabrics

Memory

memory

Bus Crossbar

15Forward multiple pkts in parallel

Speed limited by bus contention

Speed limited by memory bandwidth

Page 16: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Switching fabric slower than input ports combined – queueing may occur at input queues – queueing delay and loss due to input buffer overflow!

Head-of-the-Line (HOL) blocking– queued pkt at front of queue prevents others from moving forward

Output port contention: only one red datagram can be transferred.Lower red packet is blocked

switchfabric

One packet time later: green packet experiences HOL

blocking

switchfabric

16

Page 17: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Buffering – when packets arrive from fabric faster than transmission rate– packet loss: due to congestion, lack of buffers

Scheduling– chooses next among queued packets to transmit on link– net neutrality: who gets best performance

[email protected]

linetermination

link layer

protocol(send)

switchfabric

datagrambuffer

queueing

This slide in HUGELY important!

Page 18: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

FIFO (first in first out) – send in order of arrival to queue

Priority – multiple classes, with different priorities (e.g., based on hdr info)

• send highest priority queued packet

Round robin scheduling– multiple classes, cyclically scan class queues

• send one packet from each class (if available)

Weighted fair queueing – generalized round robin

• each class gets weighted amount of service in each cycle

queue(waiting area)

packetarrivals

packetdepartureslink

(server)

18

In practice: hardware queues use FIFO,need software to do priority

Page 19: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Network Layer

[email protected] 19

Page 20: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

THE network layer protocol of the Internet– protocol your device must implement to run on Internet– RFC published ~1980

Provides– best effort service

• to get pkts from one end host to another across many interconnected networks using dst IP address in IP hdr

– addressing• format and usage of addresses

– fragmentation• e.g., if pkt size exceeds Ethernet MTU of 1500 bytes

– some error detection

Q: what does IP not provide?– QoS, reliability, ordering, persistent state for e2e flows, connections20

Page 21: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Network layer functions on hosts and routers

forwardingtable

Routing protocols• path selection• RIP, OSPF, BGP

IP protocol• addressing conventions• datagram format• packet handling conventions

ICMP protocol• error reporting• router “signaling”

transport layer: TCP, UDP

link layer

physical layer

Networklayer

[email protected] 21

Page 22: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

ver length

32 bits

data (variable length,

typically a TCP segment or UDP datagram)

16-bit identifierheader

checksumtime to

live

32 bit source IP address

head.len

type ofservice

flgs fragmentoffset

upperlayer

32 bit destination IP address

options (if any)

IP protocol versionnumber

header length(# of 32bit words)

upper layer protocolto deliver payload to

ICMP=1, UDP=17, TCP=6

total packetlength (bytes)

Not widely used

forfragmentation/

reassemblymax numberremaining hops

(decremented at each router)

e.g. timestamp,record route

taken, specify routers to visit.

When used usually indicate

suspicious activity

How much overhead?

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

layer overhead 1-22

Q: Why is version 1st?So you know how to parse pkt

Bits transmitted left to right, top to bottom

Page 23: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

[email protected] 1-23

Look at IP headers and ping/traceroute

Page 24: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Network links have MTU – largest possible link-level frame– different link types have

different MTUs

Fragment when pkt > MTU– 1 pkt becomes several pkts

• IP header bits used to identify, order related fragments

– reassembled only at final dest– re-fragmentation possible– don’t recover from lost fragments– (IPv6 does not support)

[email protected]

fragmentation:in: one large pktout: 3 smaller pkts

reassembly

DoS attack: send fragmented pktsbut leave one out

Page 25: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

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 pktbecomes several

smaller pkts

4000 byte packet• 3980 bytes payload• IP hdr >=20 bytes

MTU = 1500 bytes1480 bytes in

data field

offset =1480/8 = 185

25

Identify as last segment

Page 26: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Addressing

[email protected] 26

Page 27: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Globally unique 32-bit identifier– associated with host or router interface – Interface: connection between host/router and physical link

– host: usually 1 or 2 interfaces– router: usually many interfaces

Hierarchical– subnet part

• variable len# of high order bits• assigned by ICANN

– host part• variable len # of low order bits• network + host

27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

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

Page 28: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Pros– scalable: routers don’t need to look at host part– all pkts on same network forwarded in same direction

• only when pkt reaches network does host matter

Cons – every IP addr belongs to specific network … but what if host

moves networks and wants to keep same addr?• mobile IP• contrast with fixed Ethernet link layer addr

28

Page 29: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Q: how are interfaces actually connected?A: see Ch 5, 6.

[email protected]

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: wired Ethernet interfaces connected by Ethernet switches

A: wireless WiFi interfaces connected by WiFi base station

For now: don’t worry about how one interface is connected to another

(with no intervening router)

Page 30: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

IP address– subnet part: high order bits– host part: low order bits

What’s a subnet?– set of interfaces that all

have same subnet part of IP addr

– devices can reach other without intervening routers

Subnet mask– divides IP addr into subnet

addr + host addr– included in routing protocol

info given to [email protected]

Network comprising 3 subnets

223.1.1.1

223.1.1.3

223.1.1.4 223.1.2.9

223.1.3.2223.1.3.1

subnet

223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

Page 31: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Recipe to find subnets– detach each interface

from its host or router– create islands of

isolated networks

Each isolated network – is called a subnet

[email protected]

subnet mask: /24

223.1.1.0/24223.1.2.0/24

223.1.3.0/24

223.1.1.1

223.1.1.3

223.1.1.4 223.1.2.9

223.1.3.2223.1.3.1

subnet

223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

Page 32: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

[email protected]

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

Page 33: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Allows more fine-grained division of blocks of addresses

Subnet masks – define variable partition of host part of addresses – e.g.,

• /23 subnet mask: 11111111 11111111 11111110 00000000• logical “and” of subnet mask with addr

– if a and b are both 1 then 1 otherwise 0

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

33

11001000 00010111 00010000 00000000

subnetpart

hostpart

200.23.16.0/23

Page 34: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Suppose – we must have 223.1.1 as network prefix– we need block of 90 addresses

What should subnet mask be?– how many bits for 90 addresses?

[email protected]

0 26 25 24 23 22 21 20

64 32 16 8 4 2 1

27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1

1 26 25 24 23 22 21 20

64 32 16 8 4 2 1

223.1.1.0/24 gives 256 addresses [0-255]

223.1.1.0/25 gives 128 addresses [0-127]

223.1.1.128/25 gives a different set of 128

addresses [128-255]

Page 35: Lecture 16: Network Layer Overview, Internet Protocolvumanfredi.web.wesleyan.edu/comp332-s18/lectures/lec16... · 2018-04-04 · THE network layer protocol of the Internet – protocol

Private subnet (used in NAT), do not appear on Internet– 172.16-31.*.*– 10.*.*.*– 192.168.*.*

Loopback address:– 127.*.*.*

Addresses you can’t assign to devices– *.*.*.255: broadcast addr– *.*.*.0: used for subnet name

Broadcast address– 255.255.255.255: broadcast to all hosts on network indicated

• if no mask: local network• if mask: broadcast on that network

Address when device booting up– 0.0.0.0 35