1
00:00:00,000 --> 00:00:06,000
However, what happens when the subnet masks are different?

2
00:00:06,000 --> 00:00:08,000
Let’s expand on our previous example

3
00:00:08,000 --> 00:00:11,000
in this example, we have 4 routers

4
00:00:11,000 --> 00:00:18,000
router 4 is learning about network 10.1.1.0/27

5
00:00:18,000 --> 00:00:21,000
from router 1 via RIP version 2

6
00:00:21,000 --> 00:00:30,000
router 4 is learning about network 10.1.0.0/16 from router 2 via BGP

7
00:00:30,000 --> 00:00:39,000
and router 4 is learning about network 10.0.0.0/8 from router 3 via OSPF.

8
00:00:39,000 --> 00:00:43,000
Notice the administrative distances RIP is 120

9
00:00:43,000 --> 00:00:48,000
BGP is 200 in this example, OSPF is 110

10
00:00:48,000 --> 00:00:57,000
which way will router 4 send traffic if you ping 10.1.1.1 on router 4.

11
00:00:57,000 --> 00:01:01,000
Will it go to router 1? Because of the routes received via RIP

12
00:01:01,000 --> 00:01:04,000
or  will it let go to router 2 or will it go to router 3?

13
00:01:04,000 --> 00:01:10,000
Notice OSPF has a lower administrative distance than RIP

14
00:01:10,000 --> 00:01:13,000
and RIP has a lower administrative distance than BGP.

15
00:01:13,000 --> 00:01:17,000
Which path is chosen by router 4?

16
00:01:17,000 --> 00:01:21,000
The important lesson here is that the length of the route

17
00:01:21,000 --> 00:01:25,000
takes precedence over administrative distance.

18
00:01:25,000 --> 00:01:28,000
In other words, administrative distance is only used

19
00:01:28,000 --> 00:01:32,000
if multiple routing protocols are trying to put

20
00:01:32,000 --> 00:01:35,000
the same route into the routing table.

21
00:01:35,000 --> 00:01:40,000
Router 4 is learning about network 10.1.1.0/27

22
00:01:40,000 --> 00:01:47,000
10.1.0.0/16 and 10.0.0.0/8

23
00:01:47,000 --> 00:01:53,000
the router will see this as 3 separate and distinct routes.

24
00:01:53,000 --> 00:01:59,000
the 3 routes will be put into the routing table as they are seen as separate routes

25
00:01:59,000 --> 00:02:09,000
but out of the 3 of them, network 10.1.1.0/27 is chosen as it has the longest match.

26
00:02:09,000 --> 00:02:15,000
So, in other words, the ping from router 4 will go via router 1

27
00:02:15,000 --> 00:02:19,000
because it’s the best match or longest match in the routing table

28
00:02:19,000 --> 00:02:25,000
even though RIP has a high administrative distance than OSPF

29
00:02:25,000 --> 00:02:30,000
longest match routes take precedence over administrative distance.
