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)#