15
IP routing routing table routing daem on route com m and netstat com m and ICM P IP output from adjacent routers (routing policy) redirections to netw ork interfaces IP layer routing m echanism

IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Embed Size (px)

Citation preview

Page 1: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

IP routing

routing table

routing daemon route commandnetstat

command

ICMP

IP output

from adjacentrouters

(routing policy)

redirections

to networkinterfaces

IP layer

routingmechanism

Page 2: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Simple Routing Table

svr 4% netstat –r nRouting tables Destination Gateway Flags Refcnt Use Interface140.252.13.65 140.252.13.35 UGH 0 0 emd0127.0.0.1 127.0.0.1 UH 1 0 lo0default 140.252.13.33 UG 0 0 emd0140.252.13.32 140.252.13.34 U 4 250034 emd0

•If destination is 140.252.13.33•If destination is host 140.252.13.65•If destination is host 192.207.117.2•If destination is own host

•ftp svr4•ftp 127.0.0.1

Page 3: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Routing table (sun)

sun % netstat –rnRouting tables Destination Gateway Flags Refcnt Use Interface140.252.13.65 140.252.13.35 UGH 0 170 le0127.0.0.1 127.0.0.1 UH 1 766 lo0140.252.1.183 140.252.1.29 UH 0 0 sl0default 140.252.1.183 UG 1 2955 sl0140.252.13.32 140.252.13.34 U 8 250034 emd0

Page 4: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

ICMP host unreachablesun % traceroute 192.207.117.2 1- 140.252.1.183 227 ms 227 ms 234 ms2- 140.252.1.4 233 ms 229 ms 234 ms3- 140.252.104.2 233 ms 229 ms 234 ms4- 128.196.128.1 264 ms 228 ms 234 ms5- 192.80.43.2 234 ms 228 ms 234 ms6- 192.31.39.233 263 ms 258 ms 264 ms7- 192.31.39.21 263 ms 258 ms 264 ms8- 140.222.97.3 293 ms 258 ms 264 ms……etc

sun % ping 192.82.148.1 (do not exist)ICMP host unreachable from 192.31.32.21

Reaches NSFNET, CIX, NSI, SprintLink, or Ebone backbones

Page 5: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

ICMP redirections (revisited)

solaris % netstat –rnRouting tables Destination Gateway Flags Refcnt Use Interface127.0.0.1 127.0.0.1 UH 0 848 lo0140.252.1.0 140.252.1.32 U 3 15042 le0244.0.0.0 140.252.1.32 U 3 0 le0default 140.252.1.4 UG 0 5747 le0

solaris % netstat –rnRouting tables Destination Gateway Flags Refcnt Use Interface127.0.0.1 127.0.0.1 UH 0 848 lo0140.252.13.35 140.252.1.183 UGHD 0 2140.252.1.0 140.252.1.32 U 3 15042 le0244.0.0.0 140.252.1.32 U 3 0 le0default 140.252.1.4 UG 0 5747 le0

Solaris % ping bsdi

Page 6: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

ICMP redirect (cont.)

• Solaris after receiving a redirect message should

– Check the IP address that caused the redirect (contained in the IP header of the ICMP redirect)

– Check the IP address of the IP router that sends the redirect (source IP address of IP datagram)

– Check the IP address of the router that should be used (contained in the ICMP message)

Rules1- Redirects only generated by routers, not hosts.2- Intended to be used by hosts, not routes.3- A router running a routing protocol should prevent the use of redirection.

Page 7: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

ICMP redirect (cont.)

• Router before sending ICMP redirection checks the following

– Kernel configured to send redirects.

– Outgoing interface = incoming interface.

– Route must not be the router’s default route.

– Route must not have been created by an ICMP redirect.

– Datagram must not be source routed?

• Before updating its table, host performs the following checks.

– The new router must be on a connected network

– The modified route must be an indirect route

– The redirect must be from the specified router

– The redirect cannot set the router to use as the asking host

Page 8: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

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

• No router has complete knowledge of all network links

• “distance vector” algorithms

Static or dynamic?Static: • routes change slowly over time

Dynamic: • routes change more quickly

– periodic update

– in response to link cost changes

• Susceptible to routing loops and oscillation in routes.

Page 9: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

A Link-State Routing Algorithm

Dijkstra’s algorithm

• net topology, link costs known to all nodes

– accomplished via “link state broadcast”

– all nodes have same info

• computes least cost paths from one node (‘source”) to all other nodes

– gives routing table for that node

• iterative: after k iterations, know least cost path to k dest.’s

Notation:

• c(i,j): link cost from node i to j. cost infinite if not direct neighbors

• D(v): current value of cost of path from source to dest. V

• p(v): predecessor node along path from source to v, that is next v

• N: set of nodes whose least cost path definitively known

Page 10: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Dijsktra’s Algorithm

1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) 6 else D(v) = infinity 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N: 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N

Page 11: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Distance Vector Routing Algorithm

iterative:• continues until no nodes

exchange info.• self-terminating: no

“signal” to stop

asynchronous:• Not all nodes need to

exchange info/iterate at the same time.

distributed:• each node communicates

only with directly-attached neighbors

Distance Table data structure • each node has its own• row for each possible destination• column for each directly-attached

neighbor to node• example: in node X, for dest. Y via

neighbor Z:

D (Y,Z)X

distance from X toY, via Z as next hop

c(X,Z) + min {D (Y,w)}Z

w

=

=

Page 12: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Distance Vector Routing: overview

Iterative, asynchronous: each local iteration caused by:

• local link cost change • message from neighbor: its

least cost path change from neighbor

Distributed:• each node notifies

neighbors only when its least cost path to any destination changes– neighbors then notify their

neighbors if necessary

wait for (change in local link cost of msg from neighbor)

recompute distance table

if least cost path to any dest has

changed, notify neighbors

Each node:

Page 13: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Distance Vector Algorithm:

1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infinity /* the * operator means "for all rows" */ 4 D (v,v) = c(X,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */

XX

Xw

At all nodes, X:

Page 14: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Distance Vector Algorithm (cont.):8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D (y,V) = D (y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its min DV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination y: D (Y,V) = c(X,V) + newval 22 23 if we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all neighbors 25 26 forever

w

XX

XX

X

w

w

Page 15: IP routing. Simple Routing Table svr 4% netstat –r n Routing tables DestinationGatewayFlagsRefcntUseInterface 140.252.13.65140.252.13.35UGH00emd0 127.0.0.1127.0.0.1UH10lo0

Inter-AS vs. Intra-AS Routing

• Inter-AS: unique standard for inter-AS routing: BGP

• Intra-AS:• Also known as Interior Gateway Protocols (IGP)• Most common Intra-AS routing protocols:

– RIP: Routing Information Protocol

– OSPF: Open Shortest Path First

– IGRP: Interior Gateway Routing Protocol (Cisco proprietary)