02-09-2015 07:33 AM - edited 03-07-2019 10:34 PM
I want to add a cost to the SVI on SWI-1 (on right of diagram) 10.0.255.11, so that OSPF prefers to route via 10.0.255.12, which is an SVI on SWI-2 (on left)
Below is sh ip route from R01 (at top)
O E2 10.10.0.0/16 [110/20] via 10.0.255.11, 00:27:17, GigabitEthernet0/0
[110/20] via 10.0.255.12, 00:27:17, GigabitEthernet0/0
O E2 10.20.0.0/16 [110/20] via 10.0.255.11, 00:27:17, GigabitEthernet0/0
[110/20] via 10.0.255.12, 00:27:17, GigabitEthernet0/0
O E2 10.30.0.0/16 [110/20] via 10.0.255.11, 00:27:17, GigabitEthernet0/0
[110/20] via 10.0.255.12, 00:27:17, GigabitEthernet0/0
Note that route metrics are identical for 10.0.255.11 & 12, despite me adding a route cost of 65000 added to the SVI for vlan 997 on on SWI-1
interface Vlan997
ip address 10.0.255.11 255.255.255.248
ip ospf cost 65000
I would expect this route cost to be reflected in the sh ip route above, yet this does not seem to be the case. Am I missing something?
Config for SVI 997 for SWI-2 (on left) below, for reference:
interface Vlan997
ip address 10.0.255.12 255.255.255.248
Full packet tracer configs are attached in ZIP.
Thanks
Solved! Go to Solution.
02-10-2015 06:49 AM
Cost is used inbound on an interface not outbound.
So by setting it on the SVIs on the switches you are not affecting what the router will use.
You would need to set the cost on the router connection to the switch ie. inbound.
But the problem is you only have one interface.
Using the "neighbor <IP address> cost ..." command would solve it but this is not supported on broadcast networks so you can't use it.
The best way to achieve what you want is when you redistribute connected assign a higher metric to the switch you don't want to be used.
Jon
02-09-2015 09:38 AM
There isn't any redundant link in your diagram. There is only one link from 2911(g0/0) to Sw1 and one link from Sw1 to Sw2. So there is only one way for OSPF to get to Sw2. Changing cost will not have any effect.
HTH
02-09-2015 10:17 AM
That's not the case.
Both SVIs are on the same network segment, with the router interface - so either can be used as next hop.
sh ip route from R01 shows that 10.10.0.0/16, 10.20.0.0/16 and 10.30.0.0/16 are all route-able via either 10.0.255.11 or 10.0.255.12
O E2 10.10.0.0 [110/20] via 10.0.255.11, 03:10:52, GigabitEthernet0/0
[110/20] via 10.0.255.12, 03:10:52, GigabitEthernet0/0
O E2 10.20.0.0 [110/20] via 10.0.255.11, 03:10:52, GigabitEthernet0/0
[110/20] via 10.0.255.12, 03:10:52, GigabitEthernet0/0
O E2 10.30.0.0 [110/20] via 10.0.255.11, 03:10:52, GigabitEthernet0/0
[110/20] via 10.0.255.12, 03:10:52, GigabitEthernet0/0
See traceroutes below from R01 to all workstations. Exact same set up, but OSPF is now using 10.0.255.12 as preferred route.
R01#traceroute 10.10.10.10
Type escape sequence to abort.
Tracing the route to 10.10.10.10
1 10.0.255.12 1 msec 0 msec 1 msec
2 10.10.10.10 1 msec 0 msec 1 msec
R01#traceroute 10.10.10.11
Type escape sequence to abort.
Tracing the route to 10.10.10.11
1 10.0.255.12 0 msec 0 msec 0 msec
2 10.10.10.11 0 msec * 1 msec
R01#traceroute 10.20.20.20
Type escape sequence to abort.
Tracing the route to 10.20.20.20
1 10.0.255.12 1 msec 0 msec 1 msec
2 10.20.20.20 0 msec 0 msec 0 msec
R01#traceroute 10.20.20.21
Type escape sequence to abort.
Tracing the route to 10.20.20.21
1 10.0.255.12 0 msec 0 msec 0 msec
2 10.20.20.21 0 msec 1 msec 0 msec
R01#traceroute 10.30.30.30
Type escape sequence to abort.
Tracing the route to 10.30.30.30
1 10.0.255.12 1 msec 0 msec 1 msec
2 10.30.30.30 4294967295 msec0 msec 1 msec
R01#traceroute 10.30.30.31
Type escape sequence to abort.
Tracing the route to 10.30.30.31
1 10.0.255.12 0 msec 0 msec 0 msec
2 10.30.30.31 1 msec 0 msec 0 msec
My goal is to reliably control this with a cost, rather than letting OSPF decide.
02-09-2015 10:45 AM
The costs of E2 (external type 2) routes do not change whithin an OSPF domain once they are injected by an ASBR (=>Link).
You should be able to see the different cost when you issue a 'show ip ospf border-routers' (if PT supports this command).
When you use the 'redistribute ... metric-type 1' option instead (type 2 is default), the internal path cost will be added up, and the routes should appear with the costs as you expect them.
HTH
Rolf
02-10-2015 05:53 AM
Hi Rolf,
Thanks for your reply.
Your suggestion sounded very promising, however, it didn't appear to work when I tried it.
To confirm, have added highlighted lines:
Switch 1:
interface Vlan997
ip address 10.0.255.11 255.255.255.248
ip ospf cost 65000
!
router ospf 1
log-adjacency-changes
redistribute connected metric-type 1 subnets
network 10.0.255.8 0.0.0.7 area 0
Switch 2
interface Vlan997
ip address 10.0.255.12 255.255.255.248
ip ospf cost 10
!
router ospf 1
log-adjacency-changes
redistribute connected metric-type 1 subnets
network 10.0.255.8 0.0.0.7 area 0
RO1
R01(config)#do sh ip ospf border
OSPF Process 1 internal Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 3.3.3.3 [1] via 10.0.255.12, GigabitEthernet0/0, ASBR, Area 0, SPF 1
i 2.2.2.2 [1] via 10.0.255.11, GigabitEthernet0/0, ASBR, Area 0, SPF 1
R01(config)#do sh ip route ospf
2.0.0.0/32 is subnetted, 1 subnets
O E1 2.2.2.2 [110/21] via 10.0.255.11, 00:04:49, GigabitEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O E1 3.3.3.3 [110/21] via 10.0.255.12, 00:02:46, GigabitEthernet0/0
10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
O E1 10.10.0.0 [110/21] via 10.0.255.11, 00:04:49, GigabitEthernet0/0
[110/21] via 10.0.255.12, 00:02:46, GigabitEthernet0/0
O E1 10.20.0.0 [110/21] via 10.0.255.11, 00:04:49, GigabitEthernet0/0
[110/21] via 10.0.255.12, 00:02:46, GigabitEthernet0/0
O E1 10.30.0.0 [110/21] via 10.0.255.11, 00:04:49, GigabitEthernet0/0
[110/21] via 10.0.255.12, 00:02:46, GigabitEthernet0/0
Note the cost has incremented from 100/20 to 100/21, although both interfaces are still available and are still equal cost. Any ideas?
After some reading, I was wondering if adding neighbour 2.2.2.2 cost 10 to R01 might work, although this command does not appear to be supported on PT.
Thanks.
02-10-2015 06:49 AM
Cost is used inbound on an interface not outbound.
So by setting it on the SVIs on the switches you are not affecting what the router will use.
You would need to set the cost on the router connection to the switch ie. inbound.
But the problem is you only have one interface.
Using the "neighbor <IP address> cost ..." command would solve it but this is not supported on broadcast networks so you can't use it.
The best way to achieve what you want is when you redistribute connected assign a higher metric to the switch you don't want to be used.
Jon
02-10-2015 08:39 AM
Thanks for your reply, Jon.
All sorted!!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide