advanced lab in computer communications meeting 1netlab/resources/class/class4.pdf · advanced lab...

42
Advanced Lab in Computer Communications Meeting 4 – Network Layer Instructor: Tom Mahler

Upload: others

Post on 16-Mar-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Advanced Lab in Computer

CommunicationsMeeting 4 – Network Layer

Instructor: Tom Mahler

Page 2: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Routing

How do packets get from A to B in the

Internet?

A B

Internet

Page 3: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Network Layer: Routing

Physical

Data Link

Network

Transport

Application

Layers model

Each router makes a LOCAL decision to forward the packet towards

destination using Internet routing protocols.

Page 4: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Network layer functions

Host addressing: numerical label of each device participating in

a computer network that uses the Internet Protocol.

Path determination: route taken by packets from source to dest.

Routing algorithms:

Global: “link state” algorithms (OSPF, IS-IS)

Decentralized: “distance vector” algorithms (RIP, IGRP, EIGRP, BGP)

Switching: move packets from router’s input to appropriate router

output

Lookup and Forwarding :

Forwarding Table

Longest prefix matches

Page 5: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP (Internet Protocol) is a Network Layer Protocol.

IP’s current version is Version 4 (IPv4). It is specified in RFC 891.

IPv6 is the latest revision of the IP. September 2013 IPv6 surpassed

2% for the first time. IPv6 uses a 128-bit address

Network

Layer

Link Layer

IP

ARPNetwork

Access

Media

ICMP IGMP

Transport

LayerTCP UDP

IP

Page 6: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP

IP is the highest layer protocol which is

implemented at both routers and hosts

Application

TCP

IP

Data Link

Application

TCP

IP

Network

Access

Application protocol

TCP protocol

IP protocol IP protocol

Data

LinkData

Link

IP

Data

LinkData

Link

IP

Data

LinkData

Link

Data

Link

IP protocol

RouterRouter HostHost

Page 7: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP Service

IP provide provides an unreliable connectionless best effort service. Unreliable: IP does not make an attempt to recover lost packets

Connectionless: Each packet (“datagram”) is handled independently. IP is not aware that packets between hosts may be sent in a logical sequence

Best effort: IP does not make guarantees on the service (no throughput guarantee, no delay guarantee,…)

Consequences:

• Higher layer protocols have to deal with losses or with duplicate packets

• Packets may be delivered out-of-sequence

Page 8: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP Addresses

Application dataTCP HeaderEthernet Header Ethernet Trailer

Ethernet frame

IP Header

version

(4 bits)

header

length

Type of Service/TOS

(8 bits)

Total Length (in bytes)

(16 bits)

Identification (16 bits)flags

(3 bits)Fragment Offset (13 bits)

Source IP address (32 bits)

Destination IP address (32 bits)

TTL Time-to-Live

(8 bits)

Protocol

(8 bits)Header Checksum (16 bits)

32 bits

Page 9: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IPv4 Header

Identification – Original packet ID in case of fragmentation

Flags – Don't Fragment (DF)/More Fragments (MF)

Fragment Offset - specifies the offset of a particular fragment relative to the beginning of the original unfragmented IP datagram.

Protocol – upper layer protocol e.g. TCP(6), UDP(17), OSPF(89), ICMP(1) …

Page 10: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IPv4 addresses Routing

between

networks

Routing

within a

network

“class-full” addressing: 1981 -

1993

Page 11: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP addressing: CIDR

classfull addressing: 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

CIDR: Classless Inter Domain Routing network portion of address of arbitrary length

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

address

11001000 00010111 00010000 00000000

network

part

host

part

200.23.16.0/23

Page 12: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP addresses: how to get one?

Hosts (host portion):

hard-coded by system admin in a file

DHCP: Dynamic Host Configuration

Protocol: dynamically get address: “plug-and-play”

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: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP Addressing: introduction

IP 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 interface, not host,

or 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

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 14: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP Addressing

IP address:

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.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 IP networks

(for IP addresses starting with 223,

first 24 bits are network address)

LAN

Page 15: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP Addressing

How to find the networks?

Detach each interface

from router, host

create “islands of

isolated networks

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.1

223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

Interconnected

system consisting

of six networks

Page 16: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Routing Example

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

Starting at A, given IP datagram

addressed to B:

• look up network address of B,

find B on same network as A

• link layer sends datagram to B

inside link-layer frame

B’s MACaddr

A’s MACaddr

A’s IPaddr

B’s IPaddr

IP payload

datagram

frame

frame source,dest. address

datagram source,dest. address

Page 17: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

ARP: Address Resolution Protocol

Each IP node (Host, Router)

on LAN has ARP module and

table

ARP Table: IP/MAC address

mappings for some LAN

nodes

< IP address; MAC address;

TTL>

< …………………………..

>

TTL (Time To Live): time of

day after which address

mapping will be forgotten

(typically 20 minutes)

Question: how to determineMAC address of Bgiven B’s IP address?

Page 18: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

ARP protocol

A knows B's IP address, wants to learn

physical address of B

A broadcasts ARP query pkt, containing B's

IP address

all machines on LAN receive ARP query

B receives ARP packet, replies to A with its

(B's) physical layer address

A caches (saves) IP-to-physical address pairs

until information becomes old (times out)

Page 19: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IP addresses: how to get one?

Network (network portion):

get allocated portion of 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 20: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Datagram Forwarding Algorithm for

router/hosts

Every node (host/router) first checks to see if it is connected to the same physical network as the destination.

Routers are connected to several physical networks, while hosts are only connected on a single network.

If the destination address is in the same network, send the packet directly to the destination.

If the destination address is in a different network, the node forwards the packet to a router that knows how to reach the destination.

Page 21: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Getting a datagram from source to dest.

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

Starting at A, given IP

datagram addressed to B:

r look up net. address of B

r find B is on same net. as A

r link layer will send datagram

directly to B inside link-layer

frame

m B and A are directly

connected

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2

223.1.3 223.1.1.4 2

misc

fields223.1.1.1 223.1.1.3 data

Page 22: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Getting a datagram from source to dest.

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

Dest. Net. next router Nhops

223.1.1 1223.1.2 223.1.1.4 2

223.1.3 223.1.1.4 2Starting at A, dest. E:

r look up network address of E

r E on different network

m A, E not directly attached

r routing table: next hop router to

E is 223.1.1.4

r link layer sends datagram to

router 223.1.1.4 inside link-

layer frame

r datagram arrives at 223.1.1.4

r continued…..

misc

fields223.1.1.1 223.1.2.2 data

Page 23: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Getting a datagram from source to dest.

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

Arriving at 223.1.4, destined

for 223.1.2.2

r look up network address of E

r E on same network as router’s

interface 223.1.2.9

m router, E directly attached

r link layer sends datagram to

223.1.2.2 inside link-layer frame

via interface 223.1.2.9

r datagram arrives at 223.1.2.2

misc

fields223.1.1.1 223.1.2.2 data network 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

Dest. next

Page 24: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Routing Algorithm classification

Global or decentralized information?

Global:

all routers have complete topology, link cost info

“link state” algorithms

Decentralized:

router knows physically-connected neighbors, link costs to

neighbors

iterative process of computation, exchange of info with

neighbors

“distance vector” algorithms

Page 25: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

RIP – Routing Information Protocol

Distributed with the popular Berkeley Software Distribution version of Unix.

Based on BF algorithm.

Richard Bellman

Page 26: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

RIP – Routing Information Protocol

At start every node is familiar with it’s immediate neighbors.

Every node holds a distance vector containing the costs to all other nodes.

Each node distributes it’s distance vector to it’s immediate neighbors.

The nodes keep updating their distance vectors until convergenceis reached.

Routers keep sending distance vectors/ updates every 30 sec to handle changes in the network graph topology.

Cost metric: number of hops (distance)RIP support 1-15 hops routes (with 16 hops representing infinity).

Page 27: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

RIP - ExampleNode Distance to reach a node

A B C D E F G

A 0 1 1 ∞ 1 1 ∞

B 1 0 1 ∞ ∞ ∞ ∞

C 1 1 0 1 ∞ ∞ ∞

D ∞ ∞ 1 0 ∞ ∞ 1

F 1 ∞ ∞ ∞ ∞ 0 1

G ∞ ∞ ∞ 1 ∞ 1 0

A

B

C

E

D

GF

Destination Cost Next Hop

B 1 B

C 1 C

D ∞ -

E 1 E

F 1 F

G ∞ -

Initial distances stored at each node

Initial routing table at node A

Page 28: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

RIP - ExampleNode Distance to reach a node

A B C D E F G

A 0 1 1 2 1 1 2

B 1 0 1 2 2 2 3

C 1 1 0 1 2 2 2

D 2 2 1 0 3 2 1

F 1 2 2 2 2 0 1

G 2 3 2 1 3 1 0

A

B

C

E

D

GF

Destination Cost Next Hop

B 1 B

C 1 C

D 2 C

E 1 E

F 1 F

G 2 F

Final distances stored at each node

Final routing table at node A

Page 29: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

RIP – Convergence Problem

A B

C

1000 1

1

Node Cost

A 1

C 1

Page 30: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IGRP (Interior Gateway Routing Protocol)

CISCO proprietary; successor of RIP (mid 80s)

Distance Vector, like RIP

several cost metrics (delay, bandwidth, reliability, load

etc)

uses TCP to exchange routing updates

Uses a combination of metrics

Network delay, bandwidth, reliability and load all factored into the routing decision

Page 31: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IGRP Continued

Provides a wide range for its metrics

For example Reliability – value between 1 and 255

Bandwidth – values reflecting speeds from 1200 bps to 10 Gbps

Delay – value from 1 to 224

Contrast with RIP(does not weigh metrics) – it only uses one

Maximum hop count 255

Contrast with RIP 15 hops only

Page 32: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

IGRP Metrics and routing Updates

Bandwidth by default is given the most importance

Router running IGRP sends updates every 90 seconds

Declares route inaccessible if an update from first router is not sent within 3 update periods (270 seconds)

after 5 update periods (450 seconds) router removes the route from the routing table

Poison reverse to speed up convergence

Page 33: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Features that Enhance Stability of IGRP –

Split Horizons with Poison-Reverse

Occur when router tries to send information

about a route back in the direction that it

came

Helps prevent routing loops

Implemented in IGRP

Page 34: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

EIGRP

EIGRP is a distance vector, classless routing protocolthat was released in 1992 with IOS 9.21.

As its name suggests, EIGRP is an enhancement of Cisco IGRP (Interior Gateway Routing Protocol).

Both are Cisco proprietary protocols and only operate on Cisco routers.

The main purpose in Cisco's development of EIGRP was to create a classless version of IGRP.

Although EIGRP may act like a link-state routing protocol, it is still a distance vector routing protocol.

Page 35: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

EIGRP

The Algorithm

–EIGRP uses the Diffusing Update Algorithm (DUAL).

–EIGRP does not send periodic updates and route

entries do not age out.

–Only changes in the routing information, such as a

new link or a link becoming unavailable ("Hello" packet

is not received from a neighbor) cause a routing update

to occur.

–EIGRP routing updates are still vectors of distances

transmitted to directly connected neighbors.

Page 36: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

EIGRP EIGRP’s 5 Packet Types Hello packets

Used to discover & form adjacencies with neighbors

Update packets

Used to propagate routing information

Query packets

Used by DUAL for searching for networks

Can use Unicast or Multicast

Reply packets

Reply packet

Can use Unicast only

Acknowledgement packets

Used to acknowledge receipt of update, query & reply packets

Page 37: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

EIGRP EIGRP Bounded Updates

EIGRP only sends update when there is a change in route

status

Partial update

A partial update includes only the route information that

has changed – the whole routing table is NOT sent

Bounded update

When a route changes, only those devices that are

impacted will be notified of the change

EIGRP’s use of partial bounded updates minimizes use of

bandwidth

Page 38: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

OSPF- Open Shortest Path First

At first, every node knows it’s neighbors and the cost to reach them.

Each router generates link state advertisements (LSAs) which are distributed to all routers

LSA = (link id, state of the link, cost, neighbors of the link)

Each router maintains a database of all received LSAs (topological database or link state database), which describes the network has a graph with weighted edges.

Each router uses its link state database to run a shortest path algorithm (Dijikstra’s algorithm) to produce the shortest path to each network

Edsger Dijkstra

Page 39: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Features of OSPF

Enables load balancing by allowing traffic to

be split evenly across routes with equal cost

Type-of-Service routing allows to setup

different routes dependent on the TOS field

Supports multicasting

Allows hierarchical routing

Page 40: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

Neighbor Discovery and Maintenance

Hello Protocol

Hello packets sent out every 10 seconds

helps to detect failed neighbors

RouterDeadInterval (default 40 seconds)

neighboring routers agree on intervals

hello interval set so that a link is not accidentally

brought down

Page 41: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

OSPF Areas An area is a set of routers that are configured to change link state information among

themselves.

Area Border Routers (ABRs) are connecting between the different areas.

The result: improved scalability rather than absolute optimal shortest paths

Page 42: Advanced Lab in Computer Communications Meeting 1netlab/resources/class/class4.pdf · Advanced Lab in Computer Communications Meeting 4 –Network Layer ... Host addressing: numerical

END