In the previous vlog, I explained why you would use a loopback interface and I gave you one reason.
Let's look at another reason.
Another reason why you wanna use a loopback is because routing protocols such as OSPF use the loopback
to determine the router IDs of the routers in the OSPF network.
So on these routers
show IP interface brief.
I've configured loopback 0 with this IP address and I've also configured the loopbacks on each
router, so router 1 is 192 168 1.1, router 2 is .2, router 3 is .3
Now why is that important?
It's important for routing protocols.
So when we enable a routing protocol such as OSPF it selects a router ID for itself.
So I'm gonna enable OSPF on all interfaces on this router and just simply put them in area 0.
So show IP OSPF interface brief, OSPF is enabled on all interfaces on the router show IP OSPF interface.
Notice here show loopback is 0
has this IP address configured in area 0 but the router ID is 192 168 1.2.
In other words, the router ID selected is the highest IP address of any interface
and if they are loopbacks the loopback override the physical interfaces.
So the router ID is selected on the highest loopback address.
In this case 192 168 1.2.
Now that's important because in OSPF a router is identified by its router ID it's kinda like your name.
So my name is David.
It would be terrible if my name changed every day, whenever there was a problem.
And that's the issue with OSPF.
If you don't use a loopback interface and the router ID was selected off a physical interface and that
interface went down the router ID would change but here it's consistent.
Notice on gigabit 01 the router ID is still 192 168 1.2
So let's have a look at the problem.
On router 1
we've got two IP addresses configured on physical interfaces and then we've got these loopback interfaces.
But what I'm gonna do now is remove the loopback interfaces of router 1.
So show IP interface brief, do that again.
We only have IP addresses on the physical interfaces.
So now router, OSPF, 1 network and I'll just enable OSPF on all interfaces once again, notice a neighbor relationship
has established.
We've actually got two.
But notice the neighbor ID is 192 168 1.2 whereas on this side the neighbor I.D. is 10.1.
2.1 the highest IP address of a physical interface.
This loopback doesn't exist on router 1, so on router 2 show IP OSPF neighbor, neighbor relationship
is full and established to 10.1.2.1, on router 1 show IP OSPF neighbor notice the difference.
Neighbor ID is 192 168 1.2 IP address on the interface that the neighbor is using is 10.1
.2.2
and on this interface gigabit 00, it's 10.1.1.2.
So the same neighbor ID the loopback
and just to make sure that it's not confusing I'll add that here as well, we've got this loopback configured on
router 2
in addition to 2.2.2.2. On router 2 now, when we look at the neighbor relationship
with router 1, neighbor ID is 10.1.2.1 that's this interface
gigabit 01 the IP addresses and the physical interfaces are those on router 1.
So why is the router ID important?
Well when an interface goes down and the routers rebooted the router ID will change and in certain cases
in OSPF we specify the router ID in commands. One of those cases which you don't need to know
for CCNA is a virtual links. In this command
we're specifying the router ID of a remote router. A virtual link allows us to create a virtual transit
across an area.
In this example a backbone area is on the left, area 1 is in the middle and area 2 is on the right.
Area 2
is separated from the backbone area by area 1 but a virtual link allows us to tunnel area 0
across area 1 and fulfill one of the requirements of OSPF which states that all areas have to
be adjacent to area 0.
Now the problem is in our topology at the moment on router 1, show IP OSPF interface
notice the router ID is 10.1.2.1.
So that's the router ID of the router and you can see that on both interfaces. What I'm gonna do however
is shut gigabit
01 down so currently show IP OSPF interface shows that this is the router ID. If the router
rebooted the router ID would change and instead of rebooting the router.
I'm gonna type clear IP OSPF, process and I'm gonna clear all OSPF processes
so show IP OSPF interface.
In this case the router ID didn't change
so what I'll do is save the configuration and reboot the router.
So why is that a problem.
If the interface that you're using was selected by the router at the router ID and you configured that
router ID in this command and the interface went down and the router rebooted this command would no
longer work because the router ID had changed.
Notice Cisco tell you the router ID is usually the highest IP address on the box or the highest loopback
address if one exists.
The router ID is only calculated at boot time or at any time when the OSPF process is restarted.
So what's the recommendation.
For OSPF specify a loopback address and then manually configure the router ID.
So the routers rebooted, show IP OSPF interface.
Notice the router ID has changed.
It's now 10.1.1.1 that means if you're using a virtual link as an example the virtual
link would break and your network would break.
OK that concludes this vlog entry.
Thanks Pedro for the question.
Please feel free to send me questions and I'll do my best to answer all of them.
I'll see you tomorrow.
All the very best.