+ All Categories
Home > Documents > Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. ·...

Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. ·...

Date post: 11-Oct-2020
Category:
Upload: others
View: 11 times
Download: 6 times
Share this document with a friend
57
Computer Networking, Copyright © University of Edinburgh 2005 CS4/MSc Computer Networking Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing protocols
Transcript
Page 1: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

Computer Networking, Copyright © University of Edinburgh 2005

CS4/MScComputer Networking

Lecture 4

The network layer:

Forwarding,

Routing,

IP and Internet routing protocols

Page 2: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

2

• External view: services the network provides to the transport layer– Connection-oriented with quality of service guarantees

– Connectionless

– Note that there is no choice; it’s one or the other

• Internal view: the physical interconnection topology of the network– How are packets transferred – datagrams or virtual circuits

– Congestion control and flow control (topic of future lecture)

– Addressing and routing procedures

• Two major functions– Forwarding (or switching) – move packet to the right out-port of router

– Routing – determine the correct/best next router for each destination

Network layer services

Page 3: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

3

• Dynamic interconnection of inputs to outputs

• Enables dynamic sharing of transmission resources

• Two fundamental approaches:– Connectionless

– Connection-Oriented: Call setup control, Connection control

The Switching Function

Page 4: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

4

• Entire messages multiplexed onto shared lines, relayed from switch to switch in store-and-forward fashion

• Headers for source & destination addresses

Message Switching

Switches

Message

Destination

Source

Message

Message

Message

Page 5: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

5

• High utilisation of the transmission line

• Delay over multiple hops can be long:– Whole message has to be received before it can be transmitted on

– Minimum delay = 3τ + 3T, assuming equal speed lines and no queueingdelay

• Probability of transmission error also increases with length of the block– More retransmissions required for correct delivery (for each link)

Message Switching Delay

t

t

t

t

Delay

Source

Destination

T

τSwitch 1

Switch 2

Page 6: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

6

Packet Switching (datagram)

• Messages broken into smaller units (packets)

• Source & destination addresses in each packet header

• Connectionless, packets routed independently (datagram)

• Packets may arrive out of order and may follow different routes

• Pipelining of packets across network can reduce delay, increase throughput

Packet 2

Packet 1

Packet 1

Packet 2

Packet 2

• Lower delay than message switching, suitable for interactive traffic

Page 7: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

7

Packet-Switching Delay

t

t

t

t

31 2

31 2

321

3τ + 2(T/3) first bit received

3τ + 3(T/3) first bit released

3τ + 5 (T/3) last bit released

Lτ + (L-1)P first bit received

Lτ + LP first bit released

Lτ + LP + (k-1)P last bit releasedwhere T = k P

3 hops L hops

Source

Destination

Switch 1

Switch 2

τ

Page 8: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

8

Packet-Size

Eventually the delay due to the transmission of the header in each packet will reverse the speed-up gained by using ever-smaller packet sizes

figure from Stallings, Data & computer communications 7e

Page 9: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

9

Switching operation in connectionless networks

• At each switch the (final) destination address is extracted from the header and used in a look-up table to determine the forwarding output port

– Routing table has an entry for each destination

• Size of table becomes impractical for very large number of destinations

– Hierarchical addressing scheme used

• Routing tables updated dynamically when network failures occur– Adjacent routers periodically share link status information

• Therefore datagram switching is robust

Page 10: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

10

Connection-Oriented Packet Switching: Virtual Circuits

• Call set-up phase sets ups routers in fixed path along network• All packets for a connection follow the same path• Variable bit rates possible, negotiated during call set-up• Delays variable, cannot be less than circuit switching• A release procedure required to terminate the session

Virtual circuit

Packet PacketPacket

Packet

Page 11: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

11

Connection Setup

• Signaling messages propagate as route is selected• Signaling messages identify connection and setup tables in switches• Typically a connection is identified by a local tag, Virtual Circuit Identifier (VCI)• Each switch only needs to know how to relate an incoming tag in one input to an outgoing tag in the corresponding output • Once tables are setup, packets can flow along path• Data packet headers are shorter than with datagram switching

SW 1

SW 2

SW n

Connect request

Connect request

Connect request

Connect confirm

Connect confirm

Connect confirm

Page 12: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

12

Virtual-Circuit Packet-Switching Delay

t

t

t

t

31 2

31 2

321

Release

Connect request

CR

CR Connect confirm

CC

CC

• Connection setup delay is incurred before any packet can be transferred

• Delay is acceptable for sustained transfer of large number of packets

• This delay may be unacceptably high if only a few packets are being transferred

Page 13: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

13

Cut-Through Switching

• Some networks perform error checking on header only, so packet can be forwarded as soon as header is received & processed

• Delays reduced further with cut-through switching

• Error control for the payload is left for higher layer protocols

• To be successful, header needs to be processed quickly. Mostly used in VC switching

31 2

31 2

321

Minimum delay = 3τ + Tt

t

t

tSource

Destination

Switch 1

Switch 2

Page 14: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

14

Router Architecture Overview

Page 15: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

15

Input Port Functions

Decentralized switching:• given datagram dest., lookup output port using

forwarding table in input port memory• goal: complete input port processing at ‘line

speed’• queuing: if datagrams arrive faster than

forwarding rate into switch fabric

Physical layer:bit-level reception

Data link layer:e.g., Ethernet

Page 16: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

16

Three types of switching fabrics

Page 17: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

17

Output Ports

• Buffering required when datagrams arrive from fabric faster than the transmission rate

• Scheduling discipline chooses among queued datagrams for transmission

Page 18: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

18

Input Port Queuing

• Fabric slower than input ports combined -> queueing may occur at input queues

• Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward

• Queueing delay and loss due to input buffer overflow!

Page 19: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

19

• IP packets transfer information across internet

Host A IP → router→ router…→ router→ Host B IP

• IP layer in each router determines next hop (router)

• Network interfaces transfer IP packets across networks

Inter-networking

Router

InternetLayer

NetworkInterface

TransportLayer

InternetLayer

NetworkInterface

TransportLayer

InternetLayer

NetworkInterface

Host A Host B

Net 5Net 1

Net 5Net 2 Net 5Net 3

Router

InternetLayer

NetworkInterface

Router

InternetLayer

NetworkInterface

Net 5Net 4

Page 20: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

20

IP datagram format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifierInternet

checksumtime to

live

32 bit source IP address

IP protocol versionnumber

header length(bytes)

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 flgs fragmentoffset

upperlayer

32 bit destination IP address

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

Page 21: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

21

• Each physical link imposes a maximum size of transmission unit (MTU)

– e.g. ethernet 1500 bytes, FDDI 4464 bytes

• IP may have to break a large packet into smaller fragments– Each fragment is sent independently, as though it were an IP packet

• Any router may need to fragment packets to smaller sizes again

IP IP

RouterSource Destination

Network Network

Fragmentation and Reassembly

• The destination IP is the only entity that reassembles fragments into the original packet

Page 22: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

22

To reassemble a packet– Destination waits until all the fragments have been received

– If any fragment is lost, the whole original packet is abandoned» Lost fragments detected by using a time-out following arrival of first fragment

– Identification field in IP header shows which packet a fragment belongs to» Source must not reuse an identification value for a sufficiently long period

– Flag bits :» DF : don’t fragment

- if packet is longer than MTU for next hop, discard and send error message» MF : more fragments follow this one

– Offset field : measures the offset in the packet of this fragment in units of eight bytes (all fragments must be multiples of 8, except the last)

Performance: fragment loss means retransmission of all packet fragments again

– Could be done more efficiently with selective retransmission

Fragmentation and Reassembly Operation

Page 23: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

23

• Each host is assigned a unique 32-bit IP address :

– Network ID + Host ID

– or multiple IP addresses for hosts with multiple interfaces

– Host ID allocated locally by network administrator or DHCP

• Network IDs allocated by RIPE (Réseaux IP Européens) NCC (Network Coordination Centre) in Amsterdam for Europe, Middle East & North Africa

– One of three Regional Internet Registries: ARIN (Americas), APNIC (Asia Pacific)

» Allocation of blocks of IP addresses to Local Internet Registries e.g. ISPs

- who further allocate them to their users

– Routers only need to route packets on basis of the Network ID part

» reduces size of routing tables

– Five address classes : A to E with distinct prefixes

» Class D used for multicast services to a group of hosts simultaneously

» Class E reserved for experiments

IP Addresses

Page 24: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

24

Subnets – portion of a network sharing a particular subnet address

• IP address: – subnet part (high order bits)

– host part (low order bits)

• What’s a subnet ?– device interfaces with same subnet part

of IP address

– can physically reach each other without intervening router

• Subnet mask (a 32-bit combination which describes which portion of address refers to the subnet and which to the host– Masks out the hostID part of the address

e.g. 255.255.255.0

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

subnet 223.1.3.0/24

subnet 223.1.2.0/24

subnet 223.1.1.0/24

Page 25: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

25

• Essentially applies the idea of subnetting to the network ID part of the address• An arbitrary prefix length indicates the network number

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

– e.g. 205.100.0.0/22 indicates a prefix of 22 bits

– 172.16.0.0.255.255.0.0 represented as 172.16.0.0/16, i.e. the number of left-most

contiguous mask bits that are set to one.

• Allows aggregation of a number of contiguous network addresses into a single entry in a routing table (supernetting)

– Assuming the next hop router is common

• Requires that a longest prefix match search scheme be used• IP addresses have to be allocated using policies to capitalise on this capability

– e.g. reflecting the physical hierarchical topology of the network

– continents use a short prefix, countries slightly longer etc.

Classless Inter-Domain Routing (CIDR)

Page 26: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

26

• Each domain takes its IP address from a higher level – hierarchical internet architecture• This allows for the summarisation of the domains to be done at higher level

– ISP owns network 172.16.0.0/16

– ISP can offer 172.16.1.0/24, 172.16.2.0/24 and so on …. To customers

– When advertising to other providers, ISP need only advertise 172.16.0.0/16

Classless Inter-Domain Routing (CIDR)

Page 27: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

27

• IP addresses can be re-used in separate internal sub-internetworks

• Each internal sub-network lives behind a NAT-enabled gateway/router

Network Address Translation

– Registered IP addresses used outside the gateway to connect to public network

» assigned by the usual authorities as normal

– A set of unregistered IP addresses is used in the private local network

» a range of addresses are set aside for this re-use by the authority

– Hosts on the local network communicate using local unregistered addresses

– Packets outgoing to the public network have their local IP addresses translated to registered external IP addresses by the gateway and vice versa

Page 28: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

28

Dynamic NAT example

10.0.0.1

10.0.0.2

10.0.0.3

S: 10.0.0.1, 3345D: 128.119.40.186, 80

110.0.0.4

138.76.29.7

1: host 10.0.0.1 sends datagram to 128.119.40.186, 80

NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345…… ……

S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4

S: 138.76.29.7, 5001D: 128.119.40.186, 802

2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table

S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3

3: Reply arrivesdest. address:138.76.29.7, 5001

4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345

Page 29: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

29

NAT limitations

• 16-bit port-number field: – 60,000 simultaneous connections with a single LAN-side address. Not bad!

• NAT is controversial:– routers should only process up to layer 3

– violates end-to-end argument» NAT possibility must be taken into account by app designers, eg, P2P

applications

– address shortage should instead be solved by IPv6

Page 30: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

30

Dynamic Host Configuration Protocol (DHCP)

• Provides a method for dynamically assigning temporary IP addresses– Also allows clients to acquire IP configuration parameters they need

» e.g. subnet mask, broadcast IP address, default router etc.

– Based on BOOTP protocol, runs on top of UDP (client port 67, server 68)

– How can you use UDP if you don’t know your own IP address?

– Temporarily use 0.0.0.0; host identified by network (e.g. ethernet) address

• An ISP allocates IP addresses from its assigned set on a per-use basis– IP addresses leased for a time from a limited pool

– Address can be re-used for another client at a later time

Page 31: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

31

• Host broadcasts DHCP Discover message on its physical network

• Server replies with Offer message (IP address + configuration information)

• Host selects one offer and broadcasts DHCP Request message

• Server allocates IP address for lease time T– Sends DHCP ACK message with T, and threshold times T1 (=1/2 T) and T2 (=.875T)

• At T1, host attempts to renew lease by sending DHCP Request message to original server

• If no reply by T2, host broadcasts DHCP Request to any server

• If no reply by T, host must relinquish IP address and start from the beginning

DHCP Operation

Page 32: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

32

Introduced to address shortcomings of IPv4 and emerging applications– Designed to interoperate with IPv4 during transition period

Main features:– Longer addresses – 128 bits

– Simpler header format e.g. no header length or fragmentation fields

– Options provided by more flexible extension headers

– Flow label capability to identify a packet flow that needs certain QoS

– Security : supports authentication

– Large packets : jumbo packets longer than 64Kb

– Fragmentation at source only: intermediate routers not allowed to fragment

– No checksum field» Typically physical layers perform error detection» higher layers too

IP version 6

Page 33: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

33

Version : 6 for IPv6

Traffic class : priority of packet; zero means best-effortintended to support differentiated services – still experimental

Flow label : source desires special handling of this flow of packetsassigned by the source pseudo-randomlyflow requirements specified by a control protocol or within the packetsalso still experimental

Payload length : length of data excluding the header; larger packet though extension header option

Next header : Type of next header: extension or payload

Hop limit : replaces TTL field in IPv4; now means what it says!

Source and destination addresses : 128 bits

IPv6 Header Format

Version Traffic Class Flow LabelPayload Length Next Header Hop Limit

Source AddressDestination Address

0 4 12 16 24 31

Page 34: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

34

• Address Types– Unicast : denote a single host – the normal understanding of IP address– Multicast : a multicast enabled host can join a multicast address group– Anycast : like multicast with groups of hosts but only one host gets the packet –typically the closest host

» Share the same address space as multicast addresses

• Hexadecimal notation– Groups of 16 bits represented by 4 hex digits, separated by colons:

4BF5:AA12:0216:FEBC:BA5F:039A:BE9A:2176

• Hierarchical provider-based i.e. ISP, unicast addresses :

• IPv6 must be backwards compatible with IPv4 to be interoperable– e.g. IPv4-compatible IPv6 addresses:

» 96 bits of zeroes followed by 32 bits of IPv4 address

IPv6 Addressing

010 Registry ID Provider ID Subscriber ID Subnet ID Interface ID

n bits m bits o bits p bits (125-m-n-o-p) bits

Page 35: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

35

• An arbitrary number of daisy-chained headers to provide extra options– Each header has a type field describing what the next header is for

– Extension headers processed in order of appearance

IPv6 Extension Headers

Basic headerNext header =routing

Routing headerNext header =fragment

Fragment headerNext header =authentication

TCP segmentAuthentication headerNext header =TCP

Basic headerNext header =TCP

TCP segment

• Extension header types:– Large jumbo packets

» Packet size declared in basic header is replaced with this

– Fragmentation header» Fragmentation ID, fragment offset, etc

– Routing header» source routing i.e. the sequence of routers to be visited by each packet

Page 36: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

36

Migration from IPv4 to IPv6

• Gradual transition from IPv4 to IPv6

• Dual IP stacks: routers run both IPv4 & IPv6– Type field used to direct packet to IP version

• IPv6 islands can tunnel across IPv4 networks– Encapsulate user packet inside IPv4 packet

– Tunnel endpoint at source host, intermediate router, or destination host

– Tunneling can be recursive

Source Destination

IPv6 networkIPv4 network

IPv6 network

Tunnel

Tunnel head-end Tunnel tail-end

IPv6 headerIPv4 header

(a)

Page 37: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

37

Page 38: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

38

Routing in Packet Networks

• An objective function needed to determine the best route– e.g. minimum number of hops, minimum end-to-end delay, path with greatest available bandwidth etc.

• Algorithms should seek certain goals:– Rapid and accurate routing– Adaptability to network topology changes

» due to switch or link failures» must be able to quickly reconfigure routing tables

– Adaptability to varying loads» must be able to reconfigure best according to the current loads

– Ability to route packets away from temporarily congested links» load balancing over links desirable

– Ability to determine connectivity of the network– Low overhead of control message interchange between routers

Page 39: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

39

Classification of routing strategies

• Centralised routing– Single special host calculates shortest paths between all pairs of hosts

• Distributed routing– Each router does a part of the job

• Static routing

• Dynamic (or adaptive) routing– Routes change as a result of changes in the network

Page 40: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

40

Shortest-Path Algorithms

• Each link is associated with a cost value calculated using a cost function– Packet delay, congestion, link capacity,…

• Distance vector routing (e.g. Bellman-Ford algorithm)– Neighbouring routers exchange list of distances to destinations

– Routers process this to find better routes through the neighbour

– and adapt to changes in the network topology as information percolates through the network

• Link state routing (e.g. Dijkstra algorithm)– Each router broadcasts information about the state of its links to neighbours and other routers pass this information on further

– Each router can therefore construct a map of the entire network and derive a routing table

Page 41: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

41

Dijkstra’s Algorithm

• Input: the network graph with edges annotated with costs

• Iteratively find the next closest node from the sourcelet Di be the current minimum cost from source to node i

let Cij be the cost of the path from node i to node j

Initialisation: N = {s}

Dj = Csj ∀ j ≠ s ( = ∞ if no direct connection)Ds = 0

Find next closest node:

find node i ∉ N such that Di = min Dj , j ∉ Nadd i to Nif N contains all nodes, stop

Update minimum costs:

for each node j ∉ N , Dj = min { Dj , Di + Cij }

Page 42: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

42

Bellman-Ford Algorithm

• Initially, distance to self is 0, ∞ to all other destinations• Each node i periodically broadcasts its vector of costs { Di1, Di2, Di3 … } to its neighbours

• When an update is received, a node compares the minimum cost to each destination and selects the corresponding neighbour as the next hop:

Dij = min { Cik + Dkj } ∀ k ≠ i

+Good news travel fast

- Bad news don’t (count to infinity problem)

Page 43: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

43

Comparison of LS and DV algorithms

Message complexity• LS: with n nodes, E links, O(nE) msgs

sent

• DV: exchange between neighbors only

– convergence time varies

Speed of Convergence• LS: O(n2) algorithm requires O(nE)

msgs

– may have oscillations

• DV: convergence time varies

– may be routing loops

– count-to-infinity problem

Robustness: what happens if router malfunctions?

LS:– node can advertise incorrect link

cost

– each node computes only its owntable

DV:– DV node can advertise incorrect

path cost

– each node’s table used by others » error propagate thru network

Page 44: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

44

Specialised Routing - Flooding

• Each switch forwards incoming packets to all ports except the one the packet was received from

• Packet reaches the destination with minimum number of hops

• Unfortunately flooding may swamp the network with an exponentially increasing number of packets

• Useful when routing information not available or when survivability is required (e.g. MANETS: mobile ad-hoc networks)

• Effective when source needs to broadcast to all hosts in the network

• Flood control:– A time-to-live field set to some small number, decremented at each switch and the packet discarded when the count reaches zero

– Each switch adds its identifier to the packet header before it floods

– When a switch receives a packet, it records the source address and the sequence number

Page 45: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

45

Hierarchical routing in the Internet

• The Internet is a collection of Autonomous Systems (AS)– Sets of routers and networks each administered by a single organisation

• Stub AS : single connection to outside world

• Transit AS : has connections to more than one other AS– Allows itself to be used for transit traffic and needs its own ASN

– Most large ISP’s are transit AS’s

• Multihomed AS : has multiple AS connections – but does not allow through traffic

• Routing protocols– Interior Gateway Protocol (IGP)

» within an AS

– Exterior Gateway Protocol (EGP)» communication among ASs

Intra-ASRouting algorithm

Inter-ASRouting algorithm

Forwardingtable

Page 46: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

46

• IGP protocol based on the distance-vector Bellman-Ford algorithm– With split-horizon poisoned reverse

• Runs on top of UDP – port number 520

• Distance metric is the number of hops– Maximum number of hops limited to 15

– i.e. the diameter of the network must be no greater than 15

– 16 is regarded as infinity

– Small “infinity” number limits the count to infinity problem

• RIP is not flexible in choice of metric– e.g. cannot take account of network load conditions

• RIP-2 offers improvements:– Packets carry a variable-length subnet mask – allows CIDR to work

– and an authentication procedure for trusting distance vectors from other routers

Routing Information Protocol (RIP)

Page 47: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

47

• RIP router sends an update message to its neighbours every 30 seconds– The neighbours can then recalculate their shortest paths

• Router expects to receive an update message from each of its neighbours at least once every 180 seconds

– Allows more than 30 seconds since UDP is unreliable

• If a router does not receive an update within the time limit, it assumes thelink to its neighbour has failed

– Sets the corresponding cost to 16 (infinity)

– This can be replaced with a correct value if the neighbour eventually responds or another route to it is found

• Convergence of shortest paths can be slow when topology changes– Triggered updates can improve this

» update its neighbours immediately rather than wait for next update time

RIP (v1) Operation

Page 48: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

48

• Specification in RFC 2328

• IGP protocol based on link-state methods, using Dijkstra’s algorithm– Link-state is monitored and flooded to other routers

– Routers learn the complete network topology: each has an identical link-state database

– They can apply a shortest path algorithm locally to find optimal routes

– Link-state database is kept up to date when changes occur and periodically (30min)

• Designed to be better and much more flexible than RIP– Converges to a stable state faster

– Allows different optimal routes to be calculated for different types of service

– Allows load balancing over paths of equal cost

Open Shortest Path First (OSPF)

Page 49: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

49

Hierarchical OSPF

• Two-level hierarchy: local area, backbone− Link-state advertisements only in area

− each node has detailed area topology; only know direction (shortest path) to nets in other areas

• Area border routers: “summarize” distances to nets in own area, advertise to other Area Border routers

• Backbone routers: run OSPF routing limited to backbone.

• Boundary routers: connect to other AS’s

Page 50: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

50

• Phase 1 : neighbours are discovered using the Hello protocol– Router periodically broadcasts a hello packet onto each of its interfaces

– When a router receives a hello packet, it replies with a hello packet containing the ID of each neighbouring router it knows about

– Originating router sees a hello packet with its own ID, it knows there is a working bidirectional link between it and the sending router

– Hello protocol also elects designated routers and backup designated routers for multiaccess networks

• Phase 2 : Establishment of adjacencies and database synchronisation– Routers are chosen to become adjacent=keep link-state data synchronised

– Link State Advertisement (LSA) headers are exchanged using database description packets

– A neighbour can then request the full LSA database entry if it does not have it or it is out-of-date

OSPF Operation

Page 51: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

51

• Phase 3 : Maintenance and updating the database– A router wanting to update its link state database can send a link state request to its neighbour

– When a router has a change to propagate, it can update its neighbours with a link state update packet containing (full) LSAs

– When a router receives an update packet» It sends an acknowledgment» Updates its database» Propagates the information by flooding: forwards the LSAs to all its neighbours except the one it came from

– OSPF routers are obliged to refresh their LSAs every 30 minutes

OSPF Operation (cont)

Page 52: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

52

Border Gateway Protocol BGP

• Pairs of routers (BGP peers) exchange routing info over TCP connections

• BGP sessions do not correspond to physical links.• When AS2 advertises a prefix to AS1, AS2 is promising it will forward

any datagrams destined to that prefix towards the prefix.– AS2 can aggregate prefixes in its advertisement

• An internal BGP distributes the new info to AS’s routers

3b

1d

3a

1c2aAS3

AS1

AS21a

2c

2b

1b

3c

eBGP session

iBGP session

Page 53: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

53

Distributing reachability info

• With eBGP session between 3a and 1c, AS3 sends prefix reachabilityinfo to AS1.

• 1c can then use iBGP do distribute this new prefix reach info to all routers in AS1

• 1b can then re-advertise the new reach info to AS2 over the 1b-to-2a eBGP session

• When router learns about a new prefix, it creates an entry for the prefix in its forwarding table.

3b

1d

3a

1c2aAS3

AS1

AS21a

2c

2b

1b

3c

eBGP session

iBGP session

Page 54: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

54

Path attributes & BGP routes

• When advertising a prefix, advert includes BGP attributes – prefix + attributes = route advert

• Two important attributes:– AS-PATH: contains the ASs through which the advert for the prefix passed: AS

67 AS 17

– NEXT-HOP: Indicates the specific internal-AS router to next-hop AS. (There may be multiple links from current AS to next-hop-AS)

• Only path changes (new, withdrawn) are exchanged

• When gateway router receives route advert, uses import policy toaccept/decline

Page 55: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

55

Why different Intra- and Inter-AS routing ?

Policy:

• Inter-AS: admin wants control over how its traffic routed, who routes through its net.

• Intra-AS: single admin, so no policy decisions needed

Scale:

• Hierarchical routing saves table size, reduced update traffic

Performance:

• Intra-AS: can focus on performance

• Inter-AS: policy may dominate over performance

Page 56: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

56

Reading list

• LGW 7 – 7.5

• Tanenbaum 5 – 5.2.6

• Stallings 10.6, 12

Page 57: Lecture 4 The network layer: Forwarding, Routing, IP and Internet routing … · 2008. 10. 9. · The network layer: Forwarding, Routing, IP and Internet routing protocols. 2 ...

57

3b

1d

3a

1c2aAS3

AS1AS2

1a

2c2b

1b

3c

EGP routing tasks

• Suppose router in AS1 receives datagram for which dest is outside of AS1– Router should forward

packet towards one of the gateway routers, but which one?

AS1 needs:

1. to learn which dests are reachable through AS2 and which through AS3

2. to propagate this reachability info to all routers in AS1

Job of inter-AS routing!


Recommended