Lecture 2
Lecture 2
Lecture 2
Routing Protocols
Computer network II
Network Layer
2
Computer network II
Cont’
3 application
transport
network
Network layer protocols in data link
physical
network network
every host, router examines network
data link
physical
data link
physical
data link
physical network network
header fields in all IP data link data link
physical
physical
Computer network II
What is Routing?
4
Computer network II
Cont’
5
Computer network II
How to determine “best” path?
6
cost” routing.
IP routing table.
Computer network II
Cont’
7
Fields on IP table
Destination/Mask: indicates the destination network address
and mask of a specific route.
Proto (Protocol): indicates the protocol type of the route, that
is, the protocol through which a router learns the route.
Pre (Preference): Indicates the routing protocol preference of
the route.
There may be multiple routes to the same destination,
which have different next hops and outbound interfaces.
A router selects the route with the highest preference (with
the lowest preference value) as the optimal route.
Computer network II
Cont’
8
1
3
2 5
4
Mathematically, we often write G = (V,E)
V: set of vertices, so |V| = number of vertices
E: set of edges, so |E| = number of edges
Computer network II
Cont’
10
Friendship
Computer network II
Real-time example- Graph application
11
3 Hospital
4
Maraki
1 5
Arada
College
5
Azezo
7 1
Mesgid
5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y
Graph: G = (N,E)
♪ N = set of routers = { u, v, w, x, y, z }
♪ E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
Computer network II
Graph abstraction: costs
14
5
c(A,A’) = cost of link (A,A’)
3
v w 5
2
u Example: c(w,z) = 5
2
3
1 z
1 2
x 1
y
Computer network II
Routing protocols-classification
15
Routing protocols
Adaptive(dynamic) Non-Adaptive(static)
Most Important !
Computer network II
Static vs Dynamic routing protocols
16
networks
changes dynamically
Computer network II
Dynamic routing protocols
17
Routers using this method know the distance between any two points in
the network, but they do not know the exact topology of an internetwork.
Distance vector uses regular updates and sends the whole routing table
every time.
Basic idea: From time-to-time, each node sends its own distance vector estimate
to neighbors.
B-F equation:
Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
Computer network II
Link-State (LS) Routing
21
Computer network II
Cont’
22
Computer network II
Cont’
23
The router then advertises this set of link costs to all other
Example
IS-IS
Dijkstra’s algorithm:
“Find the shortest path from a given source node to all other
nodes by developing the paths for increasing path length.”
Computer network II
How Link state Routing works?
24
1 Initialization:
2 N = {S}
3 for all nodes v
4 if v adjacent to S
5 then D(v) = c(S,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
Computer network II
Example
25
5
3
B C 5
2
A 2 1 F
3
1 2
D E
1
Computer network II
Example…
26
Resulting shortest-path tree from A:
B C
A F
D E
B (A,B)
D (A,D)
C (A,D,E,C)
E (A,D,E)
F (A,D,E,F)
Computer network II
Comparisons
27
Calculates the best route based on Calculates the best route on the basis
Computer network II
Routing Information Protocol(RIP)
28
Computer network II
Open Shortest Path First (OSPF)
30
Computer network II
OSPF-cost
31
OSPF Cost values are the values, that shows the feasibility of a link.
According to the link cost that are calculated with this formula,
Here, all the link cost are added and the total cost of the link through
the destination is determined. The way, that has the lowest cost value,
is elected as best path.
Computer network II
Cont’
32
Example
Computer network II
RIP vs OSPF
33
RIP OSPF
DV routing protocol LS routing protocol
Metric is hop count Metric is BW
Update timer is 30 seconds Update timer: Only
Hop count limit: 15 changes made
Slow convergence Hop count limit: none
Works on B-F Algorithm Fast convergence
Works on Dijkstra’s
algorithm
Computer network II
EIGRP(Enhanced Interior Gateway Routing
Protocol)
34
Computer network II
BGP(Boarder Gateway Protocol)
36
Computer network II
Cont’
38
IGP vs EGP
Computer network II
Access Control List (ACL)
39
Computer network II
Standard vs Extended access list
40
Computer network II
ACL-Configuration
41
General Steps:
Step 1: Create access list(standard or extended)
Step 2: Apply the access list to the interface (inbound or
outbound)- outbound is coming out from the route.
Example:
Static routes: ip route detn IP, mask, next hop ip
R1(config)#ip route 192.168.1.0 255.255.255.0 10.0.0.3
R2(config)#ip route 192.168.2.0 255.255.255.0 10.0.0.2
Assume: ACL=R2 and interface =fa0/0 - outbound
Step 1.
R2(config)# access-list 1 deny 192.168.2.2
R2(config)#access-list 1 permit any
Step 2. R2(config)#int fa0/0
R2(config-if)#ip access-group 1 out
Computer network II
Cont’
42
Computer network II
Cont’
43
Computer network II
45
Computer network II