cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1475
Views
0
Helpful
6
Replies

How to act on the choice of routes on OSPF

josedunet
Level 1
Level 1

Hi all,

I have 6 router running OSPF. They get each two default route (0.0.0.0/0) from two other neighbors and execute SPF to choose one of the default route in the routing table.

But I would like to act on this choice and control the default route that should be chosen on each of the ospf router. How can I do it ?

I had to try the route map below that I applied to ospf config but this did not work. Tag 3333 is applied to one of the default routes before redistribution in the ospf domain and it is also have the best metric so chosen by default to all ospf routers. The second route have 4444 tag. I would like to use this tag to define the default route which will be choice on some ospf router.

road-map ajust-default-route allowed 5

match tag 3333

set metric + 20

road-map ajust-default-route allowed 10

router ospf 120

log-adjacency-changes

network 192.168.1.0 0.0.0.255 area 0

distribute-list route-map ajust-default-route in

6 Replies 6

John Blakley
VIP Alumni
VIP Alumni

How are you getting your default route in the table? Are you redistributing the default route into OSPF and then readvertising from OSPF? Are these E2 routes? Are they equal metrics meaning if you don't have the route-map applied do both default routes get into the database?

As a side note, you probably won't be able to change it with a distribute list. These are usually used to keep routes from getting into the routing table in ospf.

Without knowing a little more about how you're laid out, here's what you possibly could do. Get the default route to your ASBR before redistribution. Once it's there, you can configure OSPF to set your metric with using "default-information originate route-map "

For example, if I had router A and router B getting 2 default routes, on one of them I could configure a route-map that specifies setting the metric before advertising to my neighbors:

route-map SetMetric permit 10

metric +20

router ospf 1

default-information originate route-map SetTag

The default metric is going to be 1 for this type of route since it's locally originated and not seen to be an externally learned route which is 20 by default (E2 routes). In your table though, it's still going to show up as an E2 route because your ASBR advertised an externally learned route.

O E2    172.1.0.0/16 [110/20] via 10.1.34.3, 00:16:37, FastEthernet0/1

O*E2 0.0.0.0/0 [110/1] via 10.1.34.3, 00:00:53, FastEthernet0/1

Here's the route-map:

route-map SetTag, permit, sequence 10

  Match clauses:

  Set clauses:

    metric +42

    tag 121212

  Policy routing matches: 0 packets, 0 bytes

Because of the higher metric, the other route is preferred:

LS age: 129

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 0.0.0.0 (External Network Number )

  Advertising Router: 172.1.12.2

  LS Seq Number: 80000004

  Checksum: 0x8CE7

  Length: 36

  Network Mask: /0

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 42

        Forward Address: 0.0.0.0

        External Route Tag: 121212

  Routing Bit Set on this LSA