Classful vs. Classless Routing: The first thing I wanted to understand was why I was getting the following error on my Cisco routers when I would run the "redistribute connected" command:
lab3640rtr#conf t
lab3640rtr(config)#router ospf 42
lab3640rtr(config-router)#redistribute connected
% Only classful networks will be redistributed
lab3640rtr(config-router)#
Ummm...what? I would understand that error on RIPv1, since it's a classful protocol, but why am I getting it in OSPF?!?! I tried adding the "ip classless" command in global config mode since maybe the router wasn't operating in classless mode, but that made no difference.
Apparently, this isn't just a nuisance message either, because my lab2651rtr router (the one with 192.168.1.0/24 divided into multiple /27 and /28 subnets), isn't propagating those 192.168.1.x routes to the other routers:
lab3640rtr#sho ip route
<...snip...>
Gateway of last resort is not set
100.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 100.64.1.0/24 [110/128] via 192.168.3.5, 00:09:29, Serial0/1
O E2 100.64.1.22/32 [110/20] via 192.168.3.5, 00:09:29, Serial0/1
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O IA 10.254.254.0/30 [110/129] via 192.168.3.5, 00:09:29, Serial0/1
O E2 10.100.64.2/32 [110/20] via 192.168.3.5, 00:09:29, Serial0/1
O E2 10.100.64.1/32 [110/20] via 192.168.3.5, 00:09:29, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.4 is directly connected, Serial0/1
lab3640rtr#
After poking around with OSPF configurations, and with the help of the friendly "?" character on the CLI ;) I managed to find an additional parameter on the "redistribute connected" command:
lab3640rtr(config-router)#no redistribute connected
lab3640rtr(config-router)#redistribute connected subnets
lab3640rtr(config-router)#
Hey, what do you know! No error message! I applied the command on my routers, then checked my routing tables:
lab3640rtr#sho ip route
<...snip...>
100.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 100.64.1.1/32 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O IA 100.64.1.0/24 [110/128] via 192.168.3.5, 00:02:43, Serial0/1
O E2 100.64.1.22/32 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O IA 10.254.254.0/30 [110/129] via 192.168.3.5, 00:02:43, Serial0/1
O E2 10.100.64.2/32 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 10.100.64.1/32 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
192.168.1.0/24 is variably subnetted, 7 subnets, 2 masks
O E2 192.168.1.96/28 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 192.168.1.112/28 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 192.168.1.64/28 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 192.168.1.80/28 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 192.168.1.32/27 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 192.168.1.0/27 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
O E2 192.168.1.128/27 [110/20] via 192.168.3.5, 00:02:43, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.4 is directly connected, Serial0/1
lab3640rtr#
w00t! There are my subnets!
As an aside, there is also a "redistribute static subnets" as well, which I assume serves the same purpose.
Router ID's: One other concept I had difficulty with is how a router running OSPF automatically assigns a router ID. Conceptually, it is simple -- if the administrator doesn't statically assign a router ID, then the router ID is chosen from the IP addresses configured on the router. Unfortunately, between the multiple websites I visited, the numerous CCNA prep books I read, and the various practice tests I used to study, I got thoroughly confused as to which IP address the router will use as its router ID. I could always search for the most popular answer among my numerous resources, but...it's more fun (and it will stick with me better) if I actually test it on live equipment. To that end, I took my trusty 2651 router and one of the 3640 routers, configured OSPF, and left the router-id statement out of the config. Then, I mucked about with the various interfaces until I understood how the routers assign a router ID.
I started by removing all of the IP addresses from the lab3640rtr router, except for the serial interface connecting to the lab2651rtr (192.168.3.6/30), then ran the "sho ip ospf int" command:
lab3640rtr#sho run | inc address
no ip address
no ip address
ip address 192.168.3.6 255.255.255.252
lab3640rtr#sho ip ospf int
Serial0/1 is up, line protocol is up
Internet Address 192.168.3.6/30, Area 3
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
<...snip...>
No surprise, there. The router ID is the one IP address available on the router, 192.168.3.6. What happens if I put an IP address back on Fa0/0, but leave the interface shut down? Well, there's only one way to find out:
lab3640rtr#conf t
lab3640rtr(config)#int fa0/0
lab3640rtr(config-if)#ip address 192.168.2.1 255.255.255.0
lab3640rtr(config-if)#shut
lab3640rtr(config-if)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf intSerial0/1 is up, line protocol is up
Internet Address 192.168.3.6/30, Area 3
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
<...snip...>
It's still using the address of the serial interface; not entirely unexpected. What if we enable Fa0/0?
lab3640rtr#conf t
lab3640rtr(config)#int fa0/0
lab3640rtr(config-if)#no shut
lab3640rtr(config-if)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf int
Serial0/1 is up, line protocol is up
Internet Address 192.168.3.6/30, Area 3
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
<...snip...>
Still using the 192.168.3.6 address for the router ID. Is that just because Fa0/0 is not up (there's no device connected to it)? Let's connect an Ethernet cable to the 2924 switch and see what happens:
lab3640rtr#sho ip int brief | inc FastEthernet0/0
FastEthernet0/0 192.168.2.1 YES manual up down
lab3640rtr#sho ip int brief | inc FastEthernet0/0
00:25:13: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
lab3640rtr#sho ip int brief | inc FastEthernet0/0
FastEthernet0/0 192.168.2.1 YES manual up up
lab3640rtr#sho ip ospf int
Serial0/1 is up, line protocol is up
Internet Address 192.168.3.6/30, Area 3
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
Apparently not; 192.168.3.6 is still the router ID. Maybe it's because 192.168.2.0/24 is not in the OSPF configuration?
lab3640rtr#sho ip ospf int | inc ID
Process ID 42, Router ID 192.168.3.6, Network Type BROADCAST, Cost: 1
Designated Router (ID) 192.168.3.6, Interface address 192.168.2.1
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
lab3640rtr#
Maybe the router is picking the highest IP address for the router ID?
lab3640rtr(config)#int fa0/0
lab3640rtr(config-if)#no ip address
lab3640rtr(config-if)#ip address 192.168.168.192 255.255.255.0
lab3640rtr(config-if)#router ospf 42
lab3640rtr(config-router)#no network 192.168.2.0 0.0.0.255 area 3
lab3640rtr(config-router)#network 192.168.168.192 0.0.0.255 area 3
lab3640rtr(config-router)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf int | inc ID
Process ID 42, Router ID 192.168.3.6, Network Type BROADCAST, Cost: 1
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
lab3640rtr#
Hmmm...I really thought the router ID would have changed at some point now. Let's try restarting the OSPF process, and see what happens:
lab3640rtr(config)#no router ospf 42
lab3640rtr(config)#router ospf 42
lab3640rtr(config-router)# log-adjacency-changes
lab3640rtr(config-router)# redistribute connected subnets
lab3640rtr(config-router)# network 192.168.3.4 0.0.0.3 area 3
lab3640rtr(config-router)# network 192.168.168.0 0.0.0.255 area 3
lab3640rtr(config-router)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf int | inc ID
Process ID 42, Router ID 192.168.168.192, Network Type BROADCAST, Cost: 1
Designated Router (ID) 192.168.168.192, Interface address 192.168.168.192
Process ID 42, Router ID 192.168.168.192, Network Type POINT_TO_POINT, Cost: 64
lab3640rtr#
And we have a winner!!! Restarting OSPF with a higher numbered interface did the trick. What if we configure a loopback interface? Will OSPF use a loopback interface for a router ID over a FastEthernet or Serial interface? We'll configure a low-numbered loopback0 and see if OSPF grabs it or sticks with the high-numbered Fa0/0:
lab3640rtr(config)#int loopback0
lab3640rtr(config-if)#ip address 192.168.2.1 255.255.255.255
lab3640rtr(config-if)#no router ospf 42
lab3640rtr(config)#router ospf 42
lab3640rtr(config-router)# log-adjacency-changes
lab3640rtr(config-router)# redistribute connected subnets
lab3640rtr(config-router)# network 192.168.3.4 0.0.0.3 area 3
lab3640rtr(config-router)# network 192.168.168.0 0.0.0.255 area 3
lab3640rtr(config-router)# network 192.168.2.1 0.0.0.0 area 3
lab3640rtr(config-router)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf int | inc ID
Process ID 42, Router ID 192.168.2.1, Network Type LOOPBACK, Cost: 1
Process ID 42, Router ID 192.168.2.1, Network Type BROADCAST, Cost: 1
Designated Router (ID) 192.168.2.1, Interface address 192.168.168.192
Process ID 42, Router ID 192.168.2.1, Network Type POINT_TO_POINT, Cost: 64
lab3640rtr#
Weird...I didn't expect that. I can see why a router might prefer a loopback interface for an OSPF router ID (a loopback interface never goes down, for one thing). Let's just double-check the preference for the loopback by swapping the networks for the loopback and Fa0/0:
lab3640rtr(config)#int loopback0
lab3640rtr(config-if)#no ip address
lab3640rtr(config-if)#int fa0/0
lab3640rtr(config-if)#no ip address
lab3640rtr(config-if)#ip address 192.168.2.1 255.255.255.0
lab3640rtr(config-if)#int loopback0
lab3640rtr(config-if)#ip address 192.168.168.192 255.255.255.255
lab3640rtr(config-if)#no router ospf 42
lab3640rtr(config)#router ospf 42
lab3640rtr(config-router)#log-adjacency-changes
lab3640rtr(config-router)#redistribute connected subnets
lab3640rtr(config-router)#network 192.168.3.4 0.0.0.3 area 3
lab3640rtr(config-router)#network 192.168.168.192 0.0.0.0 area 3
lab3640rtr(config-router)#network 192.168.2.0 0.0.0.255 area 3
lab3640rtr(config-router)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf int | inc ID
Process ID 42, Router ID 192.168.168.192, Network Type BROADCAST, Cost: 1
Designated Router (ID) 192.168.168.192, Interface address 192.168.2.1
Process ID 42, Router ID 192.168.168.192, Network Type LOOPBACK, Cost: 1
Process ID 42, Router ID 192.168.168.192, Network Type POINT_TO_POINT, Cost: 64
lab3640rtr#
Yep, it still preferred to use the loopback. Okay, that makes sense. But that raises a question: I didn't get Fa0/0's IP address to become the router ID until I restarted the OSPF process. Did Fa0/0's IP address become the router ID because its IP address was greater than Serial0/0's address, or because it was a FastEthernet interface? Let's find out:
lab3640rtr(config)#no int loopback0
lab3640rtr(config)#no router ospf 42
lab3640rtr(config)#router ospf 42
lab3640rtr(config-router)# log-adjacency-changes
lab3640rtr(config-router)# redistribute connected subnets
lab3640rtr(config-router)# network 192.168.2.0 0.0.0.255 area 3
lab3640rtr(config-router)# network 192.168.3.4 0.0.0.3 area 3
lab3640rtr(config-router)#exit
lab3640rtr(config)#exit
lab3640rtr#sho ip ospf int | inc ID
Process ID 42, Router ID 192.168.3.6, Network Type POINT_TO_POINT, Cost: 64
Process ID 42, Router ID 192.168.3.6, Network Type BROADCAST, Cost: 1
Designated Router (ID) 192.168.3.6, Interface address 192.168.2.1
lab3640rtr#
There you have it: if a loopback interface is present, OSPF will use it as the router ID, and if not, OSPF will use the highest IP address configured on the system. HOWEVER, OSPF will NOT change the router ID until the OSPF process is restarted, which makes sense if you think about it.
And now...it's late. I'm going to bed ;)
No comments:
Post a Comment