IP routing - Al Akhawayn University

Download Report

Transcript IP routing - Al Akhawayn University

IP routing
routing daemon
netstat
command
route command
from adjacent
routers
(routing policy)
ICMP
redirections
routing table
routing
mechanism
IP output
IP layer
to network
interfaces
Simple Routing Table
svr 4% netstat –r n
Routing tables
Destination
140.252.13.65
127.0.0.1
default
140.252.13.32
Gateway
140.252.13.35
127.0.0.1
140.252.13.33
140.252.13.34
•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
Flags
UGH
UH
UG
U
Refcnt
0
1
0
4
Use
0
0
0
250034
Interface
emd0
lo0
emd0
emd0
Routing table (sun)
sun % netstat –rn
Routing tables
Destination
140.252.13.65
127.0.0.1
140.252.1.183
default
140.252.13.32
Gateway
140.252.13.35
127.0.0.1
140.252.1.29
140.252.1.183
140.252.13.34
Flags
UGH
UH
UH
UG
U
Refcnt
0
1
0
1
8
Use
170
766
0
2955
250034
Interface
le0
lo0
sl0
sl0
emd0
ICMP host unreachable
sun % traceroute 192.207.117.2
1- 140.252.1.183
2- 140.252.1.4
3- 140.252.104.2
4- 128.196.128.1
5- 192.80.43.2
6- 192.31.39.233
7- 192.31.39.21
8- 140.222.97.3
……etc
227 ms
233 ms
233 ms
264 ms
234 ms
263 ms
263 ms
293 ms
227 ms
229 ms
229 ms
228 ms
228 ms
258 ms
258 ms
258 ms
234 ms
234 ms
234 ms
234 ms
234 ms
264 ms
264 ms
264 ms
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
ICMP redirections (revisited)
solaris % netstat –rn
Routing tables
Destination
127.0.0.1
140.252.1.0
244.0.0.0
default
Gateway
127.0.0.1
140.252.1.32
140.252.1.32
140.252.1.4
Flags
UH
U
U
UG
Refcnt
0
3
3
0
Use
848
15042
0
5747
Interface
lo0
le0
le0
le0
Solaris % ping bsdi
solaris % netstat –rn
Routing tables
Destination
127.0.0.1
140.252.13.35
140.252.1.0
244.0.0.0
default
Gateway
127.0.0.1
140.252.1.183
140.252.1.32
140.252.1.32
140.252.1.4
Flags
UH
UGHD
U
U
UG
Refcnt
0
0
3
3
0
Use
848
2
15042
0
5747
Interface
lo0
le0
le0
le0
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)
Rules
1- 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.
ICMP redirect (cont.)
•
Router before sending ICMP redirection
checks the following
•
Before updating its table, host performs the
following checks.
– Kernel configured to send redirects.
–
The new router must be on a connected
network
– Outgoing interface = incoming
interface.
–
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
– 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?
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.
A Link-State Routing Algorithm
Dijkstra’s algorithm
Notation:
• net topology, link costs known
to all nodes
• 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
– 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
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
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.
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:
distributed:
• each node communicates
only with directly-attached
neighbors
X
D (Y,Z)
distance from X to
= Y, via Z as next hop
Z
= c(X,Z) + minw{D (Y,w)}
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
Each node:
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
Distance Vector Algorithm:
At all nodes, X:
1 Initialization:
2 for all adjacent nodes v:
3 D X(*,v) = infinity
/* the * operator means "for all rows" */
X
4 D (v,v) = c(X,v)
5 for all destinations, y
X
6 send min D (y,w) to each neighbor /* w over all X's neighbors */
w
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 */
X = D (y,V)
X +d
15 for all destinations y: D (y,V)
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)
*/
w
20 /* call this received new value is "newval" */
X = c(X,V) + newval
21 for the single destination y: D (Y,V)
22
X
23 if we have a new min Dw (Y,w)for
any destination Y
X
24 send new value of min Dw (Y,w) to all neighbors
25
26 forever
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)