1
Introduction to Routing and
Switching Network
Nguyn Quc nh
Faculty of IT, Ho hi !inh ity "ni#er$ity of Indu$try
Se% &'()
2
*i$tance +ector
and
Router Infor,ation -rotocol .RI-/
!a0ority %art$ of thi$ %re$entation are co%ied fro,
1 -eter Steenki$te, lecture note$ in o,%uter Network, !"
1 2org 3ie4eherr, lecture note$ in Internet 5ngineering, +irginia "ni6
3
Routing
7ra%h a4$traction for routing
algorith,$8
gra%h node$ are router$
gra%h edge$ are %hy$ical link$
link co$t8 delay, 9 co$t, or
conge$tion le#el
:good; %ath8
ty%ically ,ean$ ,ini,u, co$t
%ath
other def<$ %o$$i4le
A
E D
C B
F
2
2
1
3
1
1
2
5
3
5
4
Routing =lgorith, la$$ification
7lo4al or decentrali>ed
infor,ation?
7lo4al8
all router$ ha#e co,%lete
to%ology, link co$t info
:link $tate; algorith,$
*ecentrali>ed8
router know$ %hy$ically1
connected neigh4or$, link co$t$ to
neigh4or$
iterati#e %roce$$ of co,%utation,
e@change of info with neigh4or$
:di$tance #ector; algorith,$
Static or dyna,ic?
Static8
route$ change $lowly o#er ti,e
*yna,ic8
route$ change ,ore Auickly
%eriodic u%date
in re$%on$e to link co$t
change$
5
*i$tance +ector =lgorith,
iterati#e8
continue$ until no node$ e@change info6
$elf1ter,inating8 no :$ignal; to $to%
a$ynchronou$8
node$ need not e@change infoBiterate in lock$te%C
di$tri4uted8
each node co,,unicate$ only with directly1
attached neigh4or$
6
*i$tance +ector =lgorith, .&/
*i$tance Ta4le data $tructure
each node ha$ it$ own
row for each %o$$i4le de$tination
colu,n for each directly1attached neigh4or to node
e@a,%le8 in node D, for de$tination E #ia neigh4or F8
* .E,F/
D
di$tance from D to E, via F a$ ne@t ho%
c.D,F/ G ,in H* .E,w/I
F
w
J
J
7
*i$tance Ta4le8 5@a,%le
A
E
D
C B
7
8
1
2
1
2
* ./
=
K
*
=
(
L
M
N
K
(N
O
P
((
*
Q
Q
N
&
5
co$t to de$tination #ia
d
e
$
t
i
n
a
t
i
o
n
* .,*/
5
c.5,*/ G ,in H* .,w/I
*
w
J
J &G& J N
* .=,*/
5
c.5,*/ G ,in H* .=,w/I
*
w
J
J &G) J Q
* .=,K/
5
c.5,K/ G ,in H* .=,w/I
K
w
J
J OGM J (N
loop!
loop!
8
*i$tance Ta4le gi#e$ Routing Ta4le
* ./
=
K
*
=
(
L
M
N
K
(N
O
P
((
*
Q
Q
N
&
5
co$t to de$tination #ia
d
e
$
t
i
n
a
t
i
o
n
=
K
*
=,(
*,Q
*,N
*,N
Rutgoing link
to u$e, co$t
d
e
$
t
i
n
a
t
i
o
n
Distance table
Routing table
9
*i$tance +ector Routing8 R#er#iew
Iterati#e, a$ynchronou$8 each
local iteration cau$ed 4y8
local link co$t change
,e$$age fro, neigh4or8 it$
lea$t co$t %ath change fro,
neigh4or
*i$tri4uted8
each node notifie$ neigh4or$
only when it$ lea$t co$t %ath to
any de$tination change$
neigh4or$ then notify their
neigh4or$ if nece$$ary
wait for .change in local link
co$t of ,$g fro, neigh4or/
recompute di$tance ta4le
if lea$t co$t %ath to any de$t
ha$ changed, notify neigh4or$
Each node:
10
*i$tance +ector =lgorith,
At all nodes !:
( Initiali>ation8
& for all ad0acent node$ #8
) * .S,#/ J infty BS the S o%erator ,ean$ Tfor all row$T SB
N * .#,#/ J c.D,#/
Q for all de$tination$, y
M $end ,in * .y,w/ to each neigh4or BS w o#er all DU$ neigh4or$ SB
D
D
D
w
E
+
D
11
O loop
P wait .until I $ee a link co$t change to neigh4or +
(' or until I recei#e u%date fro, neigh4or +/
((
(& if .c.D,+/ change$ 4y d/
() BS change co$t to all de$tU$ #ia neigh4or + 4y d SB
(N BS note8 d could 4e %o$iti#e or negati#e SB
(Q for all de$tination$ y8 * .y,+/ J * .y,+/ G d
(M
(L else if .u%date recei#ed fro, + wrt de$tination E/
(O BS $horte$t %ath fro, + to $o,e E ha$ changed SB
(P BS + ha$ $ent a new #alue for it$ ,in * .E,w/ SB
&' BS call thi$ recei#ed new #alue i$ Tnew#alT SB
&( for the $ingle de$tination y8 * .E,+/ J c.D,+/ G new#al
&&
&) if we ha#e a new ,in * .E,w/ for any de$tination E
&N $end new #alue of ,in * .E,w/ to all neigh4or$
&Q
&M forever
D D
w
+
D
D
w
D
w
12
*i$tance +ector =lgorith,8 5@a,%le
!
"
1 2
7
#
13
*i$tance +ector =lgorith,8 5@a,%le
!
"
1 2
7
#
* .E,F/
D
c.D,F/ G ,in H* .E,w/I
w
J
J LG( J O
F
* .F,E/
D
c.D,E/ G ,in H* .F,w/I
w
J
J &G( J )
E
14
*i$tance +ector8 3ink o$t hange
3ink co$t change$8
node detect$ local link co$t change
u%date$ di$tance ta4le .line (Q/
if co$t change in lea$t co$t %ath, notify
neigh4or$ .line$ &),&N/
!
"
1 $
5%
#
1
algo&ith'
te&'inates
(good
ne)s
t&a*els
+ast,
15
*i$tance +ector8 3ink o$t hange
3ink co$t change$8
good new$ tra#el$ fa$t
4ad new$ tra#el$ $low 1 :count to infinity;
%ro4le,C
!
"
1 $
5%
#
-%
algo&ith'
continues
on!
16
*i$tance +ector8 S%lit Hori>on
If F route$ through E to get to D 8
F doe$ not ad#erti$e it$ route to D 4ack to E
will thi$ $ol#e count to infinity %ro4le,?
!
"
1 $
5%
#
-%
algo&ith'
te&'inates
? ? ?
17
*i$tance +ector8 -oi$on Re#er$e
If F route$ through E to get to D 8
F tell$ E it$ .F<$/ di$tance to D i$ infinite .$o E won<t
route to D #ia F/
will thi$ co,%letely $ol#e count to infinity %ro4le,?
!
"
1 $
5%
#
-%
algo&ith'
te&'inates
18
Vhere -oi$on Re#er$e Fail?
Vhen link 4reak$, ,ark$ * a$
unreacha4le and re%ort$ that to =
and K
Su%%o$e = learn$ it fir$t
= now think$ 4e$t %ath to * i$
through K
= re%ort$ * unreacha4le to K and a
route of co$tJ) to
think$ * i$ reacha4le through = at
co$t N and re%ort$ that to K
K re%ort$ a co$t Q to = who re%ort$
new co$t to
etc666
(
(
(
(
=
D
K
*
19
7etting data fro, $ource to de$t .(/
&&)6(6(6(
&&)6(6(6&
&&)6(6(6)
&&)6(6(6N &&)6(6&6P
&&)6(6&6&
&&)6(6&6(
&&)6(6)6&
&&)6(6)6(
&&)6(6)6&L
A
B
E
*e$t6 Net6 ne@t router Nho%$
&&)6(6( (
&&)6(6& &&)6(6(6N &
&&)6(6) &&)6(6(6N &
routing ta4le in =
I- datagra,8
'isc
+ields
sou&ce
./ add&
dest
./ add&
data
W datagra, re,ain$
unchanged, a$ it tra#el$
$ource to de$tination
W addr field$ of intere$t here
20
7etting data fro, $ource to de$t .&/
&&)6(6(6(
&&)6(6(6&
&&)6(6(6)
&&)6(6(6N &&)6(6&6P
&&)6(6&6&
&&)6(6&6(
&&)6(6)6&
&&)6(6)6(
&&)6(6)6&L
A
B
E
*e$t6 Net6 ne@t router Nho%$
&&)6(6( (
&&)6(6& &&)6(6(6N &
&&)6(6) &&)6(6(6N &
routing ta4le in =
Starting at =, gi#en I- datagra,
addre$$ed to K8
W
look u% net6 addre$$ of K
W
find K i$ on $a,e net6 a$ =
W
link layer will $end datagra,
directly to K in$ide link1layer
fra,e
W
K and = are directly
connected
'isc
+ields
223010101 223010103 data
21
7etting data fro, $ource to de$t .)/
&&)6(6(6(
&&)6(6(6&
&&)6(6(6)
&&)6(6(6N &&)6(6&6P
&&)6(6&6&
&&)6(6&6(
&&)6(6)6&
&&)6(6)6(
&&)6(6)6&L
A
B
E
*e$t6 Net6 ne@t router Nho%$
&&)6(6( (
&&)6(6& &&)6(6(6N &
&&)6(6) &&)6(6(6N &
routing ta4le in =
'isc
+ields
223010101 223010202 data
Starting at =, de$t6 58
W look u% network addre$$ of 5
W 5 on different network
W
=, 5 not directly attached
W routing ta4le8 ne@t ho% router to
5 i$ &&)6(6(6N
W link layer $end$ datagra, to
router &&)6(6(6N in$ide link1layer
fra,e
W datagra, arri#e$ at &&)6(6(6N
W continuedX66
22
7etting data fro, $ource to de$t .N/
&&)6(6(6(
&&)6(6(6&
&&)6(6(6)
&&)6(6(6N &&)6(6&6P
&&)6(6&6&
&&)6(6&6(
&&)6(6)6&
&&)6(6)6(
&&)6(6)6&L
A
B
E
'isc
+ields
223010101 223010202 data
=rri#ing at &&)6(6N, de$tined for
&&)6(6&6&
W look u% network addre$$ of 5
W 5 on same network a$ router<$
interface &&)6(6&6P
W
router, 5 directly attached
W link layer $end$ datagra, to
&&)6(6&6& in$ide link1layer fra,e
#ia interface &&)6(6&6P
W datagra, arri#e$ at &&)6(6&6&CCC
.hoorayC/
network router Nho%$ interface
&&)6(6( 1 ( &&)6(6(6N
&&)6(6& 1 ( &&)6(6&6P
&&)6(6) 1 ( &&)6(6)6&L
*e$t6 ne@t
23
RI-8 Routing Infor,ation -rotocol
*i$tance #ector algorith,
Included in KS*1"NID *i$tri4ution in (PO&
*i$tance ,etric8 Y of ho%$ .,a@ J (Q ho%$/
*i$tance #ector$8 e@changed e#ery )' $ec #ia
Re$%on$e !e$$age .al$o called
ad#erti$e,ent/
5ach ad#erti$e,ent8 route to u% to &Q
de$tination net$
24
RI-
Destination Network Next Router Num. of hops
to dest.
w A 2
y B 2
z B 7
x -- 1
. . ....
)
1 2
3
A
C
D
B
Routing table in D
X
25
RI-8 3ink Failure and Reco#ery
If no ad#erti$e,ent heard after (O' $ec Z
neigh4orBlink declared dead
route$ #ia neigh4or in#alidated
new ad#erti$e,ent$ $ent to neigh4or$
neigh4or$ in turn $end out new ad#erti$e,ent$ .if
ta4le$ changed/
link failure info Auickly %ro%agate$ to entire net
%oi$on re#er$e u$ed to %re#ent %ing1%ong loo%$
.infinite di$tance J (M ho%$/
26
RI- Ta4le %roce$$ing
RI- routing ta4le$ ,anaged 4y a%%lication1
le#el %roce$$ called route1d .dae,on/
=d#erti$e,ent$ $ent in "*- %acket$,
%eriodically re%eated
27
RI- Ta4le e@a,%le
Three attached cla$$ network$ .3=N$/
Router only know$ route$ to attached 3=N$
*efault router u$ed to :go u%;
Route ,ultica$t addre$$8 &&N6'6'6'
3oo%4ack interface .for de4ugging/
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
127.0.0.1 127.0.0.1 UH 0 26492 lo0
192.16.2. 192.16.2.! U 2 1" fa0
19".!!.114. 19".!!.114.6 U " !!0" le0
192.16.". 192.16.".! U 2 2! #aa0
224.0.0.0 19".!!.114.6 U " 0 le0
$efa%lt 19".!!.114.129 UG 0 14"4!4
Router8 giroflee.eurocom.fr
28
RI-#( -acket For,at
IP header UDP header
RIP Message
Command Version Set to 00...0
32!it address
Un"sed #Set to 00...0$
address famil% Set to 00.00
Un"sed #Set to 00...0$
metri& #''($
o
n
e
r
o
"
t
e
e
n
t
r
%
#
2
0
!
%
t
e
s
$
Up to 2) more ro"tes #ea&h 20 !%tes$
32 !its
Rne RI- ,e$$age can
ha#e u% to &Q route entrie$
(8 reAue$t
&8 re$%on$e
&8 for I-
'X'8 reAue$t full
routing ta4le
=ddre$$ of de$tination
o$t .,ea$ured in ho%$/
(8 RI-#(
29
RI-#( ReAue$t For,at
30
RI-#&
RI-#& i$ an e@tend$ RI-#(8
Su4net ,a$k$ are carried in the route infor,ation
=uthentication of routing ,e$$age$
Route infor,ation carrie$ ne@t1ho% addre$$
5@%loit$ I- ,ultica$ting
5@ten$ion$ of RI-#& are carried in unu$ed
field$ of RI-#( ,e$$age$
31
RI-#& -acket For,at
IP header UDP header
RIPv2 Message
Command Version Set to 00.00
IP address
S"!net Mas*
address famil% ro"te tag
+e,t-op IP address
metri& #''($
o
n
e
r
o
"
t
e
e
n
t
r
%
#
2
0
!
%
t
e
s
$
Up to 2) more ro"tes #ea&h 20 !%tes$
32 !its
"$ed to carry infor,ation
fro, other routing
%rotocol$ .e6g6,
autono,ou$ $y$te,
nu,4er/
Identifie$ a 4etter ne@t1ho%
addre$$ on the $a,e
$u4net than the ad#erti$ing
router, if one e@i$t$
.otherwi$e 'X6'/
&8 RI-#&
Su4net ,a$k for I-
addre$$
32
RI- Security
I$$ue8 Sending 4ogu$ routing u%date$ to a router
RI-#(8 No %rotection
RI-#&8 Si,%le authentication $che,e
IP header UDP header
RIPv2 Message
Command Version Set to 00.00
Password #.%tes 0 3$
Password #.%tes ) /$
0,ffff 0"thenti&ation 1%pe
Password #.%tes 2 ''$
Password #.%tes '2 '3$
0
"
t
h
e
t
i
&
a
t
i
o
n
Up to 2) more ro"tes #ea&h 20 !%tes$
32 !its
&8 %lainte@t
%a$$word
33
RI- 3i,itation$
Ho% count li,it
Ina4ility to $u%%ort %ath$ longer than (Q ho%$
Va$ de$igned for u$ed in relati#ely $,all autono,ou$
$y$te,$ .early day$ of the Internet/
Reliance on fi@ ,etric to calculate route$
RI- cannot u%date the :co$t; in realti,e to acco,,odate
change$ in a network
RI- i$ %articularly un$uita4le for highly dyna,ic network
34
RI- 3i,itation$ .conUd/
Network inten$ity of ta4le u%date$
5ach node$ 4roadca$t it$ routing ta4le e#ery )' $econd$
In network with ,any node$, thi$ can con$u,e a fair
a,ount of 4andwidth
3ack of load 4alancing
35
RI- 3i,itation$ .conUd/
Relati#ely $low con#ergence after change$
)' $econd$ for an u%date
Hu,an #$ co,%uter .router/ $%eed?
(O' $econd$ to in#alidate a router
3onger for network can con#erge on a new to%ology
ounting to infinity
36
Ne@t %art8 3ink State 4a$ed routing and RS-F