OSPF distance x <IP Source Address>
I have 3 routers connected via a hub, they are all running ospf and adjacent in area 0. R1 and R2 are redistributing 10.10.10.10/32 into ospf. R3 is receiving the internal routes 1.1.1.1/32;2.2.2.2/32 and external route 10.10.10.10/32 from R1 and R2.
I want to use AD to prefer routes from R1, rather than using the metric.
Under ospf, i want to use the distance command coupled with the route source, but i doesn't work as expected. I've tried this on two different platforms and ios versions and i get similar results.
Can somebody explain the behavior seen below?
R3#sh runn | sec router ospf
router ospf 1
router-id 3.3.3.3
network 3.3.3.3 0.0.0.0 area 0
network 10.0.123.3 0.0.0.0 area 0
R3#
R3#sh ip ospf border
R3#sh ip ospf border-routers
OSPF Router with ID (3.3.3.3) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 1.1.1.1 [1] via 10.0.123.1, FastEthernet0/0, ASBR, Area 0, SPF 19
i 2.2.2.2 [1] via 10.0.123.2, FastEthernet0/0, ASBR, Area 0, SPF 19
R3#
R3#sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 10.0.123.1, 00:15:57, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:10:17, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:10:17, FastEthernet0/0
[110/1] via 10.0.123.1, 00:15:57, FastEthernet0/0
R3#
R3#
R3#sh ip ospf da
R3#sh ip ospf database exter 10.10.10.10
OSPF Router with ID (3.3.3.3) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1662
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.10.10.10 (External Network Number )
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0x3D4A
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1649
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.10.10.10 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0x1F64
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router ospf 1
R3(config-router)#distan
R3(config-router)#distance 80 1.1.1.1 0.0.0.0
R3(config-router)#do sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [80/2] via 10.0.123.1, 00:00:05, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:00:05, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:00:05, FastEthernet0/0
[110/1] via 10.0.123.1, 00:00:05, FastEthernet0/0
R3(config-router)#do sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [80/2] via 10.0.123.1, 00:00:15, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:00:15, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:00:15, FastEthernet0/0
[110/1] via 10.0.123.1, 00:00:15, FastEthernet0/0
R3(config-router)#
R3(config-router)#distance 80 2.2.2.2 0.0.0.0
R3(config-router)#do sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [80/2] via 10.0.123.1, 00:00:04, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [80/2] via 10.0.123.2, 00:00:04, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [80/1] via 10.0.123.2, 00:00:04, FastEthernet0/0
[80/1] via 10.0.123.1, 00:00:04, FastEthernet0/0
R3(config-router)#
I want to use AD to prefer routes from R1, rather than using the metric.
Under ospf, i want to use the distance command coupled with the route source, but i doesn't work as expected. I've tried this on two different platforms and ios versions and i get similar results.
Can somebody explain the behavior seen below?
R3#sh runn | sec router ospf
router ospf 1
router-id 3.3.3.3
network 3.3.3.3 0.0.0.0 area 0
network 10.0.123.3 0.0.0.0 area 0
R3#
R3#sh ip ospf border
R3#sh ip ospf border-routers
OSPF Router with ID (3.3.3.3) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 1.1.1.1 [1] via 10.0.123.1, FastEthernet0/0, ASBR, Area 0, SPF 19
i 2.2.2.2 [1] via 10.0.123.2, FastEthernet0/0, ASBR, Area 0, SPF 19
R3#
R3#sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 10.0.123.1, 00:15:57, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:10:17, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:10:17, FastEthernet0/0
[110/1] via 10.0.123.1, 00:15:57, FastEthernet0/0
R3#
R3#
R3#sh ip ospf da
R3#sh ip ospf database exter 10.10.10.10
OSPF Router with ID (3.3.3.3) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1662
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.10.10.10 (External Network Number )
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0x3D4A
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1649
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.10.10.10 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0x1F64
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router ospf 1
R3(config-router)#distan
R3(config-router)#distance 80 1.1.1.1 0.0.0.0
R3(config-router)#do sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [80/2] via 10.0.123.1, 00:00:05, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:00:05, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:00:05, FastEthernet0/0
[110/1] via 10.0.123.1, 00:00:05, FastEthernet0/0
R3(config-router)#do sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [80/2] via 10.0.123.1, 00:00:15, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:00:15, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:00:15, FastEthernet0/0
[110/1] via 10.0.123.1, 00:00:15, FastEthernet0/0
R3(config-router)#
R3(config-router)#distance 80 2.2.2.2 0.0.0.0
R3(config-router)#do sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [80/2] via 10.0.123.1, 00:00:04, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [80/2] via 10.0.123.2, 00:00:04, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [80/1] via 10.0.123.2, 00:00:04, FastEthernet0/0
[80/1] via 10.0.123.1, 00:00:04, FastEthernet0/0
R3(config-router)#
Comments
-
Starwars Member Posts: 12 ■□□□□□□□□□R3(config-router)#distance 80 1.1.1.1 0.0.0.0
1.1.1.1/32 AD 80
10.10.10.10/32 AD 80, no longer load-balanced, R1 should be next-hop -
silver145 Member Posts: 265 ■■□□□□□□□□How is the external route input on r1/r2? Redistribution from another protocol, or is there a NSSA area behind R1/R2?
Or did you just use the summary-address command?
The direction i am heading with this is that even with the lower AD you can still see it is using R2 as the gateway which is what you are not wanting. But because R2 has the lower router ID it may be where the LSA is been generated from and to into area 0.
Reason i asked how you are creating the external route was to confirm whether this could be taking place or not.
Hopefully you can make sense of my rambles -
silver145 Member Posts: 265 ■■□□□□□□□□Just seen that you have two show ip routes using two different distance commands,
The origination of the "external route" will be comming from R2 hence the distance command is only working for 2.2.2.2, change the router ID of router 1 to ensure this device creates the external route with its information (it becomes the advertiser or something) - Cant remember the terminology!!!
Once you have changed the R-ID restart the OSPF process and see how the distance command works this time for any routes comming from the old R1 (change the distance command as appropriate e.g if this device is now 100.100.100.100 to become higher than 2.2.2.2 but keep a nice naming format) -
Starwars Member Posts: 12 ■□□□□□□□□□Just seen that you have two show ip routes using two different distance commands,
The origination of the "external route" will be comming from R2 hence the distance command is only working for 2.2.2.2, change the router ID of router 1 to ensure this device creates the external route with its information (it becomes the advertiser or something) - Cant remember the terminology!!!
As per my original post, the database on R3 clearly shows a type 5 lsa originating from R1 and R2.
R3#sh ip ospf database exter 10.10.10.10
OSPF Router with ID (3.3.3.3) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1662
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.10.10.10 (External Network Number )
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0x3D4A
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1649
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.10.10.10 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0x1F64
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 0
As you can see below, the route has 2 next-hops due to it being learned from R1 and R2.
R3#sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 10.0.123.1, 00:15:57, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.123.2, 00:10:17, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.10.10.10/32 [110/1] via 10.0.123.2, 00:10:17, FastEthernet0/0
[110/1] via 10.0.123.1, 00:15:57, FastEthernet0/0
R3#
I expect when i issue the command "distance 80 1.1.1.1 0.0.0.0" the external route from R1 gets AD 80 while the same route from R2 still has AD 110. Hance the RIB should be updated with a next hop to R1 only for 10.10.10.10/32.
When i add the additional distance command for 2.2.2.2, i see both next-hops R1 and R2 have an AD of 80, even though the original distance command didn't appear to work on its own.
Just tested on (I86BI_LINUX-ADVENTERPRISEK9-M), Version 15.4(1)T still broken. -
Starwars Member Posts: 12 ■□□□□□□□□□After a lot of research it look's like this is by design, not because it's optimal, just lazy design. AD is supposed to be used as a tie breaker between different routing protocols not on the same protocol. So if you have a route learned via multiple neighbors it should always have the same AD.
Gosh, if this was thrown into the lab you could be screwed. During redistribution section you are told to lower ospf AD etc, everything works no mutual redist issues. Later on in another task, you redistribute a network which will cause R1 to have 2 paths via 2 neighbors, the new path from neighbor 2 isn't assigned the lower AD using the distance command, the AD of the original route will now change to 110, mutual redist is broken.