Sunteți pe pagina 1din 50

NIT5110 Networking Systems

Lecture 6: Routing, Static Routing, Distance


Vector Routing
Prof Yuan Miao
yuan.miao@vu.edu.au
Routing

NIT5110 - Networking System, 2015 2


Routing
• The router is a ‘computer’ that has at
least 2 network adapters.

• The router decides where to send


datagrams by examining header fields in
all IP datagrams passing through it.

• To do this, the datagram must be passed


up the protocol stack up to the Internet
layer (TCP/IP model) , or Network Layer
(OSI 7 layer model).

NIT5110 - Networking System, 2015 3


Routing
• If the destination address is on a network from where data
came, it is ignored

• If datagram is for a different network, it consults the routing


table to determine where to forward the data.

NIT5110 - Networking System, 2015 4


Routing
• Routers have two basic functions: forwarding and routing
– Forwarding: move packets from router’s input to appropriate router
output
– Routing: determine route taken by packets from source to destination.

Analogy:
– Routing: process of planning trip from source to destination
– Forwarding: process of getting through single interchange

NIT5110 - Networking System, 2015 5


Routing
• routers: each router knows about itself and its connections,
there is no state about end-to-end connections
– no network-level concept of “connection”
• packets forwarded using destination host address

application application
transport 1. send datagrams 2. receive datagrams transport
network network
data link data link
physical physical

NIT5110 - Networking System, 2015 6


Routing
• The routing table and the protocols that build the table are
distinguishing features of a router.

NIT5110 - Networking System, 2015 7


Routing
routing algorithm

Local routing table routing algorithm determines


header value output link end-end-path through network
0100 3
0101 2 routing table determines
0111 2
1001 1
local forwarding at this router

value in arriving
packet’s header
0111 1
3 2

NIT5110 - Networking System, 2015 8


Routing
routing algorithm
4 billion IP addresses, so
rather than list individual
Local routing table destination address
Dest address output link list range of addresses
Address-range 1 3 (aggregate table entries)
Address-range 2 2
Address-range 3 2
Address-range 4 1

IP destination address in
arriving packet’s header

0111 1
3 2

NIT5110 - Networking System, 2015 9


Building Routing Table
2 ways for the table to be built
– Static routing: a network administrator enters table information
manually
• okay for small networks but does not scale up due to effort required
• cannot adapt to system changes, a router going down etc.

– Dynamic routing: routing table is built dynamically based on routing


information obtained using a routing protocol.

NIT5110 - Networking System, 2015 10


Router Architecture Overview
Two key router functions:
• run routing algorithms/protocol (e.g. RIP, OSPF, BGP)
• forwarding datagrams from incoming to outgoing link

forwarding tables computed,


pushed to input ports routing routing, management
processor control plane (software)

forwarding data plane


(hardware)

high-seed
switching
fabric

router input ports router output ports


NIT5110 - Networking System, 2015 11
Static Routing
• Static Routing is to manually enter the routing information
into the router

• This information will remain until it is manually changed

• It does not respond to network changes

• It is tedious to set all the routing information

• It is used for some “static” routes: e.g. only one way to reach a
upper layer router

NIT5110 - Networking System, 2015 12


Static Routing (wikipedia reading)
• Static routing is a data communication concept describing one way of
configuring path selection of routers in computer networks. It is the type
of routing characterized by the absence of communication between
routers regarding the current topology of the network.[1] This is achieved
by manually adding routes to the routing table. The opposite of static
routing is dynamic routing, sometimes also referred to as adaptive
routing.

• In these systems, routes through a data network are described by fixed


paths (statically). These routes are usually entered into the router by the
system administrator. An entire network can be configured using static
routes, but this type of configuration is not fault tolerant. When there is a
change in the network or a failure occurs between two statically defined
nodes, traffic will not be rerouted. This means that anything that wishes to
take an affected path will either have to wait for the failure to be repaired
or the static route to be updated by the administrator before restarting its
journey. Most requests will time out (ultimately failing) before these
repairs can be made. There are, however, times when static routes can
improve the performance of a network.
NIT5110 - Networking System, 2015 13
Static Routing – How to?
• Setting a static routing information normally follows the
following format:

command target_Network Mask (size of the network) next_hop

With Cisco router, e.g.


ip route 200.1.1.0 255.255.255.0 200.2.2.1

With windows OS
route add 200.1.1.0 mask 255.255.255.0 200.2.2.1

NIT5110 - Networking System, 2015 14


Static Routing
D1 would like to reach D3; thus R104 needs to know the route to D3. Next hop
will be R105-S0/0/0:

IP route 130.111.4.0 255.255.255.128 130.111.4.130

130.111.4.128
130.111.4.132
255.255.255.252 .130
D6 D7 255.255.255.252
.129 s0/0/0 s0/0/1 .134
s0/1/0 .133 s0/0/0
.1 F0/0 .1
D1 F0/0 .1 D3
F0/1 .1
D4 F0/0 F0/1 D5
4
4 4 .1 4
4
5
5
5 5 5
D2

.2
.2
.2 .2
.2

130.111.0.0 130.111.2.0 130.111.4.0 130.111.5.0 130.111.6.0


255.255.254.0 255.255.254.0 255.255.255.128 255.255.255.0 255.255.254.0
NIT5110 - Networking System, 2015 15
Static Routing
Communication needs to be two ways. D3 needs to know how to reply to D1; thus
R105 needs to know the route to D1. Next hop will be R104-S0/1/0:

IP route 130.111.0.0 255.255.254.0 130.111.4.129

130.111.4.128
130.111.4.132
255.255.255.252 .130
D6 D7 255.255.255.252
.129 s0/0/0 s0/0/1 .134
s0/1/0 .133 s0/0/0
.1 F0/0 .1
D1 F0/0 .1 D3
F0/1 .1
D4 F0/0 F0/1 D5
4
4 4 .1 4
4
5
5
5 5 5
D2

.2
.2
.2 .2
.2

130.111.0.0 130.111.2.0 130.111.4.0 130.111.5.0 130.111.6.0


255.255.254.0 255.255.254.0 255.255.255.128 255.255.255.0 255.255.254.0
NIT5110 - Networking System, 2015 16
Static Routing Implementation
• Without routing, hosts in D1 cannot ping hosts in D3

NIT5110 - Networking System, 2015 17


Static Routing Implementation
• Enter the static routing info in R105, now the two way
communication shall be enabled.

NIT5110 - Networking System, 2015 18


Static Routing Implementation
• Verification, now D1 and D3 hosts can ping each other.

NIT5110 - Networking System, 2015 19


Static Routing Implementation
• The routing info can be checked with router: show IP route

NIT5110 - Networking System, 2015 20


Class Practice
• Static routing for D2 communicate with D3
• Static routing for D3 communicate with D4

130.111.4.128
130.111.4.132
255.255.255.252 .130
D6 D7 255.255.255.252
.129 s0/0/0 s0/0/1 .134
s0/1/0 .133 s0/0/0
.1 F0/0 .1
D1 F0/0 .1 D3
F0/1 .1
D4 F0/0 F0/1 D5
4
4 4 .1 4
4
5
5
5 5 5
D2

.2
.2
.2 .2
.2

130.111.0.0 130.111.2.0 130.111.4.0 130.111.5.0 130.111.6.0


255.255.254.0 255.255.254.0 255.255.255.128 255.255.255.0 255.255.254.0
NIT5110 - Networking System, 2015 21
Lab 6-1
• Static routing for D2 communicate with D5
• Static routing for D1 communicate with D5

130.111.4.128
130.111.4.132
255.255.255.252 .130
D6 D7 255.255.255.252
.129 s0/0/0 s0/0/1 .134
s0/1/0 .133 s0/0/0
.1 F0/0 .1
D1 F0/0 .1 D3
F0/1 .1
D4 F0/0 F0/1 D5
4
4 4 .1 4
4
5
5
5 5 5
D2

.2
.2
.2 .2
.2

130.111.0.0 130.111.2.0 130.111.4.0 130.111.5.0 130.111.6.0


255.255.254.0 255.255.254.0 255.255.255.128 255.255.255.0 255.255.254.0
NIT5110 - Networking System, 2015 22
Dynamic Routing
• Dynamic routing is a mechanism that routers exchange
information automatically, based the exchanged information
to build routing table.

• Each router only knows of its own routing table and does not
have a ‘network’ view. For networks with multiple routers,
and various paths between routers, there needs to be
mechanisms that ensure that one router knows what to do
with datagrams addressed to more distant networks.

• Routers may belong to different organisations, yet still be able


to exchange routing information to support the function of
the whole Internet.

NIT5110 - Networking System, 2015 23


Dynamic Routing
• host 223.1.2.1 wishes to
send a message to host
223.1.1.4

• There are 2 possible paths


between these hosts.
– Path A: through router A to
router C
– Path B: through router A to
router B to router C

• What should be in router


A’s routing table to cover
the 223.1.1.0 network?

NIT5110 - Networking System, 2015 24


Dynamic Routing
• Routers in this network
need to exchange
information so each can
build a table that handles
datagrams with all possible
delivery addresses.

• 2 main methods
– Distance vector routing (also
known as Bellman-Ford
routing)
– Link state routing

NIT5110 - Networking System, 2015 25


Distance Vector Routing
• Distance vector routing is designed to minimize the amount of
communication on the network and the amount of data in a
routing table.

• It works on the principle that a router doesn’t need to know


the complete pathway to another network, it only has to
know the direction to send datagrams in (the direction is
called a vector)

• The distance part is the number of network segments to


travel which is measured by the number of routers the
datagram must travel through. This is called the hop count.

• The hop count for any network directly connected to a router


is assigned 0.
NIT5110 - Networking System, 2015 26
Distance Vector Routing
• What is the least cost path between router u to router z?

• How do you go about working out the answer?

5
v 3 w
2 5
u z
2 1
3
1 2
x y
1

NIT5110 - Networking System, 2015 27


Distance Vector Routing
Bellman-Ford equation (dynamic programming)

let
dx(y) := cost of least-cost path from x to y
then
dx(y) = minv {c(x,v) + dv(y) }

cost from neighbor v to destination y

cost to neighbor v
min taken over all neighbors v of x

NIT5110 - Networking System, 2015 28


Distance Vector Routing
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3

5
v 3 w
B-F equation says:
2 5 du(z) = min { c(u,v) + dv(z),
u 2 z
3 1 c(u,x) + dx(z),
1 x 2 c(u,w) + dw(z) }
y
1 = min {2 + 5,
1 + 3,
5 + 3} = 4
node achieving minimum is next
hop in shortest path, used in forwarding table
NIT5110 - Networking System, 2015 29
Distance Vector Routing
• Dx(y) = estimate of least cost from x to y
– x maintains distance vector Dx = [Dx(y): y є N ]
• node x:
– knows cost to each neighbor v: c(x,v)
– maintains its neighbors’ distance vectors. For
each neighbor v, x maintains
Dv = [Dv(y): y є N ]

NIT5110 - Networking System, 2015 30


Distance Vector Routing
Key Idea:
• from time-to-time, each node sends its own distance vector
estimate to neighbours
• when x receives new DV estimate from neighbour, it updates
its own DV using B-F equation:

Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

• under minor, natural conditions, the estimate Dx(y) converge to


the actual least cost dx(y)

NIT5110 - Networking System, 2015 31


Distance Vector Routing
iterative, asynchronous:
each local iteration caused wait for (change in local link
by: cost or msg from neighbor)
 local link cost change
 DV update message from
neighbor recompute estimates
distributed:
 each node notifies neighbors if DV to any dest has
only when its DV changes changed, notify neighbors
 neighbors then notify their
neighbors if necessary

NIT5110 - Networking System, 2015 32


Problem solving illustration
• Networks connects to routers, a directly connected network
has a distance of 0. So we only need to work based on the
connection of routers.

• The distance is marked on the link. The distance can be actual


distance, can be the number of hops (routers in between
were not marked), can be bandwidth (higher stance means
less bandwidth), and etc. R2

2 4
R4
R1
1

4 2
NIT5110 - Networking System, 2015 R3 33
Problem solving illustration
• Distance vector routing only exchange info with neighbours
• R1 built initial knowledge of the network, forming a distance
vector
R2

2 4
R4
R1
1

R1: [R1, R2, R3, R4] 4 2


R3
= [0, 2, 4, inf]
Here inf means the distance is infinite: does not know how to
reach the router.
NIT5110 - Networking System, 2015 34
Problem solving illustration
• Similarly, all the other routers built their routing information
when they initial started (here let’s assume they are
sychronised; it is thus easier to understand. Synchronisation is
not necessary, and often should avoid).
R2

2 4
R4
R1
1

R2: [R1, R2, R3, R4] 4 2


R3
= [2, 0, 1, 4]
Important: although you can see R2 has a shorter path to R4, but
routers cannot “See”.
NIT5110 - Networking System, 2015 35
Class Practice
• R3

R3: [R1, R2, R3, R4]


= [ ] R2
2
4
R4
R1
1
4
2
R3

NIT5110 - Networking System, 2015 36


Class Practice
• R3

R3: [R1, R2, R3, R4]


= [ 4, 1, 0, 2 ] R2
2
4
R4
R1
1
4
2
R3

NIT5110 - Networking System, 2015 37


Class Practice
• R4

R4: [R1, R2, R3, R4]


= [ ] R2
2
4
R4
R1
1
4
2
R3

NIT5110 - Networking System, 2015 38


Class Practice
• R4

R4: [R1, R2, R3, R4]


= [ inf, 4, 2, 0 ] R2
2
4
R4
R1
1
4
2
R3

NIT5110 - Networking System, 2015 39


Round 1 updates
• R1 has two neighbours: R2 and R3
R2: [R1, R2, R3, R4] R3: [R1, R2, R3, R4]
= [2, 0, 1, 4] = [4, 1, 0, 2]
R2
R1: [R1, R2, R3, R4] here is what we had 2 4
R1 R4
= [0, 2, 4, inf] 1
Based on input from the neighbour R2 4
(1) R1 never update R1 (itself) routes 2
R3
(2) R2 will not provide better information on R2
(3) R3: check if (go to R2) + (R2 to R3) is a better path
d(R1,R2)+d(R2,R3) = 2 (my routing table) + 1 (R2 reported) = 3
my current knowledge to R3 with a distance of 4, so the new info is
better.  update my routing table distance vector [ 0, 2, 3(R2),
inf]
NIT5110 - Networking System, 2015 40
Round 1 updates
• R1 has two neighbours: R2 and R3
R2: [R1, R2, R3, R4] R3: [R1, R2, R3, R4]
= [2, 0, 1, 4] = [4, 1, 0, 2]
R2
2
R1: [R1, R2, R3, R4] It is now updated (R3) 4 R4
R1 1
= [0, 2, 3(R2), inf]
4
2
Based on input from the neighbour R2 R3
(4) R4: check if (go to R2) + (R2 to R4) is a better path
d(R1,R2)+d(R2,R4) = 2 (my routing table) + 4 (R2 reported) = 6
my current knowledge to R4 is infinite, so the new info is better. 
update my routing table distance vector [ 0, 2, 3(R2), 6 (R2)]
NIT5110 - Networking System, 2015 41
Round 1 updates- Class Practice
• R1 has two neighbours: R2 and R3
R2: [R1, R2, R3, R4] R3: [R1, R2, R3, R4]
= [2, 0, 1, 4] = [4, 1, 0, 2]
R2
2
R1: [R1, R2, R3, R4] It is now updated 4 R4
R1 1
= [0, 2, 3(R2), 6(R2)] 4
2
R3
Based on input from the neighbour R3

NIT5110 - Networking System, 2015 42


Round 1 updates- Class Practice
• R1 has two neighbours: R2 and R3
R2: [R1, R2, R3, R4] R3: [R1, R2, R3, R4]
= [2, 0, 1, 4] = [4, 1, 0, 2]
R2
2
R1: [R1, R2, R3, R4] It is now updated 4 R4
R1 1
= [0, 2, 3(R2), 6(R2)]
4
2
Based on input from the neighbour R3 R3
1) R1 never update R1 (itself) routes
2) check if (go to R3) + (R3 to R2) is a better path
d (R1,R3) + d(R3, R2) = 3 + 1 =4 it is not a better path, no
updates
NIT5110 - Networking System, 2015 43
Round 1 updates- Class Practice
• R1 has two neighbours: R2 and R3
R2: [R1, R2, R3, R4] R3: [R1, R2, R3, R4]
= [2, 0, 1, 4] = [4, 1, 0, 2]
R2
2
R1: [R1, R2, R3, R4] It is now updated 4 R4
= [0, 2, 3(R2), 6(R2)] R1 1
4
2
Based on input from the neighbour R3 R3
3) R1 never update R3 based on R3 reports, won’t be any better
4) check if (go to R3) + (R3 to R4) is a better path
d (R1,R3) + d(R3, R4) = 3 + 2 =5 it is a better distance. So
update. But note as R1 is reaching R3 via R2, so it is still via R2
but distance updated. = [0, 2, 3(R2), 5(R2)]
NIT5110 - Networking System, 2015 44
Round 1 updates (R2) - Class
Practice
• R2 has three neighbours: R1, R3, R4
• Based on their reports, let’s check if update can be made to R2
distance vector R2
2
R1: [R1, R2, R3, R4] 4 R4
R1 1
= [0, 2, 4, inf]
4
2
R3
• As R2 shall have received the updates from R1 earlier. While
R1 is working, R2 is working in parallel. So we assume R2 has
the update of R1 of the un-updated distance vector. Though, it
does not make a difference in term of the process.
• Current R2 distance vector is: R2: [R1, R2, R3, R4]
• Start class practice = [2, 0, 1, 4]
NIT5110 - Networking System, 2015 45
Round 1 updates (R2) - Class
Practice
• R2 updates with R1 reported distances

R1: [R1, R2, R3, R4] R2


2
= [0, 2, 4, inf] 4 R4
R1 1
4
2
(1) No update R1, won’t be any better. R3
(2) Never update itself distance (R2)
(3) d(R2,R1) + D(R1, R3) = 2+4=6, it is not better than current 1.
(4) R1 has no distance to R4 so no updates R2: [R1, R2, R3, R4]
= [2, 0, 1, 4]

NIT5110 - Networking System, 2015 46


Round 1 updates (R2)
• R2 updates with R3 reported distances R2
2
4 R4
R3: [R1, R2, R3, R4] R1 1
= [4, 1, 0, 2] 4
2
R3
(1) d(R2,R3) + d(R3,R1) = 1+4=5. It is not better than the current
distance 2. No update.
(2) Never update itself distance (R2)
(3) Won’t update R3 based on R3 reports, won’t be any better.
(4) d(R2,R4) + d(R3,R4) =1 +2 =3 This is better than the current
4: update! R2: [R1, R2, R3, R4] R2: [R1, R2, R3, R4]
= [2, 0, 1, 4] = [2, 0, 1, 3(R3)]
NIT5110 - Networking System, 2015 47
Round 1 updates (R2)
• R2 updates with R4 reported distances R2
2
4 R4
R4: [R1, R2, R3, R4] R1 1
= [inf, 4, 2, 0] 4
2
R3
(1) No path to R1, no updates
(2) Never update itself distance (R2)
(3) d(R2,R4) + d(R4,R3) =4 +2 =6 This is better than the current 1. no
update.
(4) Won’t update R4 based on R4 reports, won’t be any better.
Now all the reports from the three neighbour has been processed and
the distance vector is updated to:
R2: [R1, R2, R3, R4]
= [2, 0, 1, 3(R3)]
NIT5110 - Networking System, 2015 48
Class practice or lab 6-2
• Keep updating until R3, R4 all finished the first round of
updating

• After that, routers will send their new distance vector to their
neighbours, thus another round of updates will start.

• This process will continue, and normally routing information


will stabilise.

• Continue with class practice and connect to lab to finish two


round of updates for all routers.

NIT5110 - Networking System, 2015 49


Assignment

Next Week

NIT5110 - Networking System, 2015 50

S-ar putea să vă placă și