Layer 3 The Network Layer

96
Layer 3 The Network Layer Slides adapted from Tanenbaum

description

Layer 3 The Network Layer. Slides adapted from Tanenbaum. Purpose of Internetworking. As we have seen, Layer 1 and Layer 2 networks are satisfactory for LAN level networks Bridges (layer2 switches) are used to match different Layer 2 protocols - PowerPoint PPT Presentation

Transcript of Layer 3 The Network Layer

Page 1: Layer 3 The Network Layer

Layer 3The Network Layer

Slides adapted from Tanenbaum

Page 2: Layer 3 The Network Layer

Purpose of Internetworking

• As we have seen, Layer 1 and Layer 2 networks are satisfactory for LAN level networks

– Bridges (layer2 switches) are used to match different Layer 2 protocols

– Bridges can also create Virtual LANs (VLANS) by grouping Hosts on different LAN segments through MAC level addressing.

Page 3: Layer 3 The Network Layer

Limitations of Layer2 switching• Even with complex bridges, NIC cards (hosts) never know

the MAC address of all their possible destinations.– Frames get broadcast to everyone on the segment

– Bridges filter somewhat, but may not know the exact host that should receive the Ethernet Frame (ends up wasting lots of bandwidth)

• Layer 2 “Virtual LANs” (VLANs) only partially solve this.

• Layer 2 networks don’t scale.– Complexity increases faster than number of nodes

There’s got to be a better way.

Page 4: Layer 3 The Network Layer

Network Layer Design Issues

• Store-and-Forward Packet Switching• Services Provided to the Transport Layer• Implementation of Connectionless Service• Implementation of Connection-Oriented Service• Comparison of Virtual-Circuit and Datagram Subnets

Page 5: Layer 3 The Network Layer

Store-and-Forward Packet SwitchingThe environment of the network layer protocols.

fig 5-1

Page 6: Layer 3 The Network Layer

Implementation of Connectionless Service

Routing within a diagram subnet.Key point: Packet’s destination address is used to determine the required output port. Routing tables can change over time and packets can take

different routes between the same two routers.

Page 7: Layer 3 The Network Layer

Implementation of Connection-Oriented Service

Routing within a virtual-circuit subnet. Each switch looks at VCI and input port to determine the output port. Does not look at destination. This is like X.25, Frame and ATM VC switching that we saw before.

Page 8: Layer 3 The Network Layer

Comparison of Virtual-Circuit and Datagram Subnets

5-4

Page 9: Layer 3 The Network Layer

Routing Algorithms

• The Optimality Principle• Shortest Path Routing• Flooding• Distance Vector Routing• Link State Routing• Hierarchical Routing• Broadcast Routing• Multicast Routing• Routing for Mobile Hosts• Routing in Ad Hoc Networks

Page 10: Layer 3 The Network Layer

Routing Algorithms (2)

Conflict between fairness and optimality.

If traffic flows between A and A’, B and B’, and C and C’, the utilization of the network will be good, but flow between X and X’ will be severely restricted. Fairness must often be imposed at the expense of overall utilization.

Page 11: Layer 3 The Network Layer

Optimality Principle

Optimality principle: – If router J is on the optimal path from router I to router K, then

the optimal path from J to K also falls along the same route. This means:

– Given the final destination, routers only need to know the optimal route to the next router.

– This entails a lookup-table correlating destination address and output port.

The following figure:– Shows the sink tree for destination “B”– There would be different sink trees for each final destination.– Note there are no loops in this tree.

Page 12: Layer 3 The Network Layer

The Optimality Principle

(a) A subnet. (b) A sink tree for router B.

Page 13: Layer 3 The Network Layer

Shortest Path RoutingThe first 5 steps used in computing the shortest path from A to D.

The arrows indicate the working node.

Page 14: Layer 3 The Network Layer

Shortest path routing Algorithms that efficiently compute the shortest

path– Dijkstra– Bellman

Another approach -- flooding may be used to send packets to all adjacent routers.

– Packets that arrive at desired destination first are considered to have taken the “best”route. (this route is then chosen for subsequent packets.)

Page 15: Layer 3 The Network Layer

Distance Vector Routing

In a network of routers, the trick is to Adapt these algorithms to run in a distributed fashion.

– Each router only needs to know who it’s connected to.– Doesn’t know the complete topology of the entire network.

Defining the “cost” of each link is an important consideration

– Delay??– Bandwidth??– Real-cost??– Queue-depth at input port of next router??

Page 16: Layer 3 The Network Layer

Distance Vector Routing

Each node builds up route tables with best output port and cost for all destinations of the network

– In following slide J receives vectors from each neighbor – Also receives cost to those immediate neighbors

Looks at each possible route to every destination and selects lowest Creates and stores the table locally The “Count to Infinity” problem exists with distance vector routing

– Each node is slow to realize a node has failed. Split-horizon is a modification to alleviate this problem

– Still doesn’t work perfectlyRIP is an example of Distance Vector Routing Protocol

Page 17: Layer 3 The Network Layer

Distance Vector Routing(a) A subnet. (b) Input from A, I, H, K, and the new

routing table for J.

Page 18: Layer 3 The Network Layer

Distance Vector Routing (2)

The count-to-infinity problem, these vectors are the hops to A

In (a), the router A has just come up, B learns then C, etc.

(b) Shows what happens when A fails, each node is very slow to realize the cost to A is INFINITY.

Page 19: Layer 3 The Network Layer

Link State Routing

Each router must do the following: Discover its neighbors, learn their network address. Measure the delay or cost to each of its neighbors. Construct a packet telling all it has just learned. Send this packet to all other routers. Compute the shortest path to every other router.

Page 20: Layer 3 The Network Layer

Learning about the Neighbors

(a) Nine routers and a LAN. (b) A graph model of (a).

Page 21: Layer 3 The Network Layer

Measuring Line CostA subnet in which the East and West parts are connected by two lines.

If link status is reported based congestion and distance, oscillations can occur. CF may be the best route so all traffic is moved over there. Then EI becomes a much better route, etc., etc., etc.

Page 22: Layer 3 The Network Layer

Building Link State Packets

With link-state routing, packets are created by each node that describe its adjacent links.

– The AGE of the update and the sequence number are also included.

– This allows changes in the network to be considered.

(a) A subnet. (b) The link state packets for this subnet.

Page 23: Layer 3 The Network Layer

Distributing the Link State PacketsThe packet buffer for router B in the previous slide

Flooding is used to distribute link-state packets. As the link-state packets are flowing around the network, they must be managed. New ones are used to update and also sent on to adjacent nodes. Old ones are ignored and not forwarded.

Using both Age and Sequence # prevents problems when routers reboot and lose sequence.

Page 24: Layer 3 The Network Layer

Hierarchical Routing

Hierarchical routing.

This type of architecture allows the routing protocols to scale. For example, all the flooded Link-state messages don’t have to propagate outside the areas.

Page 25: Layer 3 The Network Layer

Congestion Control Algorithms

• General Principles of Congestion Control

• Congestion Prevention Policies

• Congestion Control in Virtual-Circuit Subnets

• Congestion Control in Datagram Subnets

• Load Shedding

• Jitter Control

Page 26: Layer 3 The Network Layer

Basic Queuing Theory

In a queue, things stack up as they are waiting to be serviced– Infinite length queues where the service rate is greater than the arrival rate

produce a stable system.

– The average waiting time for a M/M/1 queue is well known

In reality, things are different– Arrivals are not exponentially distributed

• Data tends to be more bursty and “self-similar” (what is this?)– Real Queues can’t hold infinite number of messages (not enough memory,

too much delay)

Multiple queues and priorities are implemented for QoS

Arrivals

Servicing

Page 27: Layer 3 The Network Layer

Congestion

When queues in the Routers begin to be congested, measures must be taken to manage this.

Why not just let the queues overflow??– Often this makes the problem worse

– Flow control algorithms will try to resend further compounding the problem

– Delay in the network would be maximum

– Longer queues introduce more chance for Jitter

Lots of work has been done on congestion management

Page 28: Layer 3 The Network Layer

Congestion

When too much traffic is offered, congestion sets in and performance degrades sharply.

Page 29: Layer 3 The Network Layer

General Principles of Congestion Control

Monitor the system .– detect when and where congestion occurs.

Pass information to where action can be taken. Adjust system operation to correct the problem.

Page 30: Layer 3 The Network Layer

Congestion Prevention Policies

Policies that affect congestion.

5-26

From “Congestion control in Computer Networks, Issues and Trends”, Raj Jain, IEEE Network Magazine May/June 1990.

Page 31: Layer 3 The Network Layer

Congestion prevention policies

Layers 2-4 are all involved in congestion control and prevention– Bits errors at layer 1 can even become an issue– Interaction between the layers can be a problem

Data Link Layer– Can request info too quick– Can send too many (or not enough) ACKs– Etc.

Network Layer– Responsible for Queueing and routing the data through large network– Lots of potential to introduce delay

Transport Layer– TCP Window size can be important– Flow Control

Page 32: Layer 3 The Network Layer

Congestion Control in Virtual-Circuit Subnets

(a) A congested subnet. (b) A redrawn subnet, eliminates congestion and a virtual circuit from A to B.

With VC based networks, it may be possible to dynamically set up a new

VC that takes an uncongested route.

Page 33: Layer 3 The Network Layer

Hop-by-Hop Choke Packets

(a) A choke packet that affects only the source.

(b) A choke packet that affects each hop it passes through.

Choke packets are send in the reverse direction to slow down the transmitter

Page 34: Layer 3 The Network Layer

Jitter Control

(a) High jitter. (b) Low jitter.

Page 35: Layer 3 The Network Layer

Quality of Service

• Requirements• Techniques for Achieving Good Quality of Service• Integrated Services• Differentiated Services• Label Switching and MPLS

Page 36: Layer 3 The Network Layer

Requirements

How stringent the quality-of-service requirements are.

5-30

Different applications need different QoS characteristics to function well.

Page 37: Layer 3 The Network Layer

Buffering

Smoothing the output stream by buffering packets.

A major factor in packet networks is variance in the time each packet takes to traverse the network. This jitter can be removed by playout buffers but they introduce additional delay.

Page 38: Layer 3 The Network Layer

The Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket with packets.

Variants of the the leaky bucket are used in protocols besides Frame Relay – Often combined with the TOKEN BUCKET

Page 39: Layer 3 The Network Layer

The Leaky Bucket

Algorithm

(a) Input to a leaky bucket. (b) Output from a leaky bucket. Output from a token bucket with capacities of (c) 250 KB, (d) 500 KB, (e) 750 KB, (f) Output from a 500KB token bucket feeding a 10-MB/sec leaky bucket.

Page 40: Layer 3 The Network Layer

The Token Bucket Algorithm

(a) Before. (b) After.

5-34

Page 41: Layer 3 The Network Layer

Admission Control

An example of flow specification.

5-34

Page 42: Layer 3 The Network Layer

Packet Scheduling

(a) A router with five packets queued for line O.(b) Finishing times for the five packets.

Fair queuing is used so that longer frames don’t take an unfair amount of capacity. Here, A is 6 units long and Frame C is only 2 units long. C should get completely sent first.

Page 43: Layer 3 The Network Layer

Reserving capacity in Layer 3 networks For real-time streaming media applications, the required

bandwidth can be significant Packet networks may eventually be used to distribute movies

and things cable is providing today Lots of these applications are Multicasting

– There are sources sending the same content to many receivers RSVP, Resource reSerVation Protocol is a well-known

protocol for this scenario– RSVP support the ability to RESERVE bandwidth in a packet

network– It’s important that the network have a way to enforce that reservation– How does know whether it can Admit the request? (Admission

Control?)

Page 44: Layer 3 The Network Layer

RSVP-The ReSerVation Protocol

(a) A network, (b) The multicast spanning tree for host 1. (c) The multicast spanning tree for host 2.

Page 45: Layer 3 The Network Layer

RSVP

Note that when two sources subscribe to the same source, links that they share in common don’t need to reserve 2X the amount of bandwidth.

RSVP has evolved into a popular mechanism for receivers to request resources in a network.

It is an entire Protocol and will be discussed in more detail later during the MPLS discussion.

Page 46: Layer 3 The Network Layer

RSVP-The ReSerVation Protocol (2)

(a) Host 3 requests a channel to host 1. (b) Host 3 then requests a second channel, to host 2. (c) Host 5 requests a channel to host 1.

Page 47: Layer 3 The Network Layer

Expedited ForwardingExpedited packets experience a traffic-free network.

Expedited Forwarding is a concept where Packet networks can achieve very high performance because the network is lightly loaded. This can be accomplished by building a separate network or carving a “virtually” separate network within existing switches

Just like the HOV lane on 635

Page 48: Layer 3 The Network Layer

Assured ForwardingA possible implementation of the data flow for assured forwarding.

Often, different applications are classified before they enter the network. An edge router than breaks them out to separate queuing systems based on their class. It may also shape the traffic to reduce congestion

VOIP may get high priority

Email could get the lowest

Page 49: Layer 3 The Network Layer

Internetworking

• How Networks Differ

• How Networks Can Be Connected

• Concatenated Virtual Circuits

• Connectionless Internetworking

• Tunneling

• Internetwork Routing

• Fragmentation

Page 50: Layer 3 The Network Layer

Connecting Networks

A collection of interconnected networks.

Page 51: Layer 3 The Network Layer

How Networks Differ

Some of the many ways networks can differ.5-43

Page 52: Layer 3 The Network Layer

How Networks Can Be Connected

(a) Two Ethernets connected by a switch.

(b) Two Ethernets connected by routers.

Page 53: Layer 3 The Network Layer

Concatenated Virtual Circuits

Internetworking using concatenated virtual circuits.

Page 54: Layer 3 The Network Layer

Connectionless Internetworking

A connectionless internet.

Here, the internetworking is done by just forwarding Datagrams. Packets might take different routes.

Page 55: Layer 3 The Network Layer

Tunneling

Tunneling a packet from Paris to London.

Tunneling makes the network seem to be all one Layer 3 cloud. The Multiprotocol routers likely have either Frame or ATM interfaces

Page 56: Layer 3 The Network Layer

Tunneling (2)

Tunneling a car from France to England.

Page 57: Layer 3 The Network Layer

Internetwork Routing

(a) An internetwork. (b) A graph of the internetwork.

Note that 1,2,3,4 and 5 are actually networks themselves

Page 58: Layer 3 The Network Layer

Internetwork routing (cont)

Note in previous slide This is a hierarchical network i.e.

– Within the subnetworks there is separate routing occurring An ‘exterior’ routing protocol is used at the coarse level. Within each subnetwork, an ‘interior’ routing protocol is used.

(RIP-- distance vector or OSFP-- link-state)– These subnetworks could be service providers, enterprises, or regions.

Essentially, this can be considered a rough model of the Internet.– The internet is a loose coalition of several different networks.– Not really any centralized control

Page 59: Layer 3 The Network Layer

Typical Internet node

ATM switch

BackboneRouter

BackboneRouter

BackboneRouter

BackboneRouter

Frame Relay or ATMconnections to POPs or

large customers

FDDI ring

ATM switch

ATM switch

Frame Relay or ATMconnections to POPs or

large customers

SONET LTE

OXC

WDM transponder

Layer 2Layer3

Layer 1 or 2

Layer 2

Layer 3

Layer 2

Layer 1

Layer 0

Source: RHK

Page 60: Layer 3 The Network Layer

Fragmentation(a) Transparent fragmentation. (b) Nontransparent fragmentation.

Page 61: Layer 3 The Network Layer

Fragmentation (2)

Fragmentation when the elementary data size is 1 byte.(a) Original packet, containing 10 data bytes.(b) Fragments after passing through a network with maximum

packet size of 8 payload bytes plus header.(c) Fragments after passing through a size 5 gateway.

Page 62: Layer 3 The Network Layer

The Network Layer in the Internet

• The IP Protocol

• IP Addresses

• Internet Control Protocols

• OSPF – The Interior Gateway Routing Protocol

• BGP – The Exterior Gateway Routing Protocol

• Internet Multicasting

• Mobile IP

• IPv6

Page 63: Layer 3 The Network Layer

Design Principles for Internet

Make sure it works. Keep it simple. Make clear choices. Exploit modularity. Expect heterogeneity. Avoid static options and parameters. Look for a good design; it need not be perfect. Be strict when sending and tolerant when receiving. Think about scalability. Consider performance and cost.

Page 64: Layer 3 The Network Layer

Collection of Subnetworks

The Internet is an interconnected collection of many networks.

Page 65: Layer 3 The Network Layer

The IP Protocol

The IPv4 (Internet Protocol) header.

Page 66: Layer 3 The Network Layer

The IP Protocol (2)

Some of the IP options.

5-54

Page 67: Layer 3 The Network Layer

IP Addresses

IP address formats.

Page 68: Layer 3 The Network Layer

IP Addresses (2)

Special IP addresses.

Page 69: Layer 3 The Network Layer

Subnets

A campus network consisting of LANs for various departments.

Page 70: Layer 3 The Network Layer

Subnets (2)

A class B network subnetted into 64 subnets.

Page 71: Layer 3 The Network Layer

CDR – Classless InterDomain Routing

A set of IP address assignments.

5-59

Page 72: Layer 3 The Network Layer

NAT – Network Address Translation

Placement and operation of a NAT box.

Page 73: Layer 3 The Network Layer

Internet Control Message Protocol

The principal ICMP message types.

5-61

Page 74: Layer 3 The Network Layer

ARP– The Address Resolution Protocol

Three interconnected /24 networks: two Ethernets and an FDDI ring.

Page 75: Layer 3 The Network Layer

Dynamic Host Configuration Protocol

Operation of DHCP.

Page 76: Layer 3 The Network Layer

OSPF – The Interior Gateway Routing Protocol

(a) An autonomous system. (b) A graph representation of (a).

Page 77: Layer 3 The Network Layer

OSPF (2)The relation between ASes, backbones, and areas in OSPF.

Page 78: Layer 3 The Network Layer

OSPF (3)

The five types of OSPF messages.

5-66

Page 79: Layer 3 The Network Layer

Problems with Distance-Vector and Link-State Routing

Neither distance-vector (RIP) nor link state (OSPF) protocols effective for exterior routing

Distance vector and link state protocols assume all routers share common metric

Priorities and restrictions may differ between ASs Flooding of link state information may become

unmanageable

Page 80: Layer 3 The Network Layer

Path Vector Routing

Dispense with routing metrics Provide information about:

– Which networks can be reached by given router– Which ASs must be crossed to get there

No distance or cost element Routing information includes all Ass visited to reach

destination– Allows policy routing

Page 81: Layer 3 The Network Layer

BGP – The Exterior Gateway Routing Protocol

(a) A set of BGP routers. (b) Information sent to F.

Page 82: Layer 3 The Network Layer

Boarder Gateway Protocol (BGP)

Allows routers (gateways) in different ASs to exchange routing information

Messages sent over TCP– See next slide

Three functional procedures– Neighbor acquisition

– Neighbor reachability

– Network reachability

Page 83: Layer 3 The Network Layer

BGP v4 Messages

Open– Start neighbor relationship with another router

Update– Transmit information about single route

– List multiple routes to be withdrawn

Keepalive– Acknowledge open message

– Periodically confirm neighbor relationship

Notification– Send when error condition detected

Page 84: Layer 3 The Network Layer

Neighbor Acquisition

Neighbors attach to same subnetwork If in different ASs routers may wish to exchange

information Neighbor acquisitionis when two neighboring routers agree

to exchange routing information regularly– Needed because one router may not wish to take part

One router sends request, the other acknowledges– Knowledge of existence of other routers and need to exchange

information established at configuration time or by active intervention

Page 85: Layer 3 The Network Layer

Neighbor Reachability

Periodic issue of keepalive messages Between all routers that are neighbors

Page 86: Layer 3 The Network Layer

Network Reachability

Each router keeps database of subnetworks it can reach and preferred route

When change made, router issues update message All BGP routers build up and maintain routing information

Page 87: Layer 3 The Network Layer

BGP MessageFormats Marker:

– Reserved for authentication

Length:– In octets

Type:– Open, Update, Keepalive,

Notification

Page 88: Layer 3 The Network Layer

Neighbor Acquisition Detail

Router opens TCP connection with neighbor Sends open message

– Identifies sender’s AS and gives IP address

– Includes Hold Time

• As proposed by sender If recipient prepared to open neighbor relationship

– Calculate hold time

• min [own hold time, received hold time]

• Max time between keepalive/update messages– Reply with keepalive

Page 89: Layer 3 The Network Layer

Keepalive Detail

Header only Often enough to prevent hold time expiring

Page 90: Layer 3 The Network Layer

Update Detail

Information about single route through internet– Information to be added to database of any recipient router

– Network layer reachability information (NLRI)

• List of network portions of IP addresses of subnets reached by this route

– Total path attributes length field

– Path attributes field (next slide)

List of previously advertised routes being withdrawn May contain both

Page 91: Layer 3 The Network Layer

Path Attributes Field

Origin– Interior (e.g. OSPF) or exterior (BGP) protocol

AS_Path– ASs traversed for this route

Next_Hop– IP address of boarder router for next hop

Multi_Exit_disc– Information about routers internal to AS

Local_Pref– Tell other routers within AS degree of preference

Atomic_Aggregate, Aggregator– Uses subnet addresses in tree view of network to reduce information needed in NLRI

Page 92: Layer 3 The Network Layer

Withdrawal of Route(s)

Route identified by IP address of destination subnetwork(s)

Page 93: Layer 3 The Network Layer

Notification Message

Error notification Message header error

– Includes authentication and syntax errors Open message error

– Syntax errors and option not recognised– Proposed hold time unacceptable

Update message error– Syntax and validity errors

Hold time expired Finite state machine error Cease

– Close connection in absence of any other error

Page 94: Layer 3 The Network Layer

Diagram for BGP Routing Information Exchange

Page 95: Layer 3 The Network Layer

BGP Routing Information Exchange

R1 constructs routing table for AS1 using OSPF R1 issues update message to R5 (in AS2)

– AS_Path: identity of AS1

– Next_Hop: IP address of R1

– NLRI: List of all subnets in AS1

Suppose R5 has neighbor relationship with R9 in AS3 R9 forwards information from R1 to R9 in update message

– AS_Path: list of ids {AS2,AS1}

– Next_Hop: IP address of R5

– NLRI: All subnets in AS1

R9 decides if this is prefered route and forwards to neighbors

Page 96: Layer 3 The Network Layer

The Main IPv6 Header

The IPv6 fixed header (required).