cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2206
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

  LS age: 509

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 0.0.0.0 (External Network Number )

  Advertising Router: 172.1.13.3

  LS Seq Number: 80000005

  Checksum: 0xFD87

  Length: 36

  Network Mask: /0

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

        TOS: 0

        Metric: 1

        Forward Address: 0.0.0.0

        External Route Tag: 535353

The bolded numbers in the LSA are the router-ids that correlate with the routing table (172.1.13.3 = 10.1.34.3 real address)

HTH,

John

HTH, John *** Please rate all useful posts ***

Thank you John, let me explain a little more.

I have two ISP router (router ISPA and router ISPB). These two router have a  BGP session with my ISP and receives default route from them.

Both ISP router running also OSPF with my other internal router and generates a default route in ospf if the bgp default route received is available. I don't redistribute bgp into OSPF but I use "default-information originate" of ospf to generate the default route in ospf if bgp default route is available. The default route is seen as an E2 route by my other internal routers.

I also use route-map with the default-information originate command to do this before generating the default route in ospf:

    - Router ISPA set the metric of its default route to 10 and tag it 1111.

    - Router ISPB set it default route to 15 and tag it 2222.

My internal router choose so by default the router ISPA as it default route because of its smaller metric. What I want is to act on some other internal router so that it choose router ISPB as it default route.

So All internal router have two default route with metric 10 and 15, the metric of 10 is selected by default. But on the some other router,I would like to make manipulation to select the router ISPB as default route.

How can i do it ?

Thanks a lot.

Setting up IP SLA would be a better way of doing this. You can configure it, so that it will ping the interface on ISPA and if it fails it will automatically move the default route to ISPB.

IP sla does not solve my problem because the interface on ISPB is never down and what i need, it's is making a decision based on the default route from ISPB which is tagger 2222 (its existence or not for example).

It's there possible to use route-map  and say "If the default route with tag 2222 exists, set next - hop to ISPB otherwise uses normal routing? for example)

Thanks.

I think I understand now. Are the routers that you're wanting to manipulate in the same area as the routers that are handing over the default route? How many routers are you talking about? The reason that I ask is that if the routers are in a different area, you might be able to do something with distribution lists, but if they're in the same area I would probably recommend using static routes to point to the default router that you want to use.

On one router you could specify the primary and then a floating to its backup, and then vice versa for the other router.

In all actuality, you'd really only need to do this on the router that you want to use different from the route that you're learning. For example, if you want router B going to .3 instead of .2, but the default route is .2 because of the lower metric, you could put a static route on router B and then let it override the ospf learned route. If the router that you're pointing to were to fail, the ospf route would be put into the table redirecting you to the original learned route.

HTH,

John

HTH, John *** Please rate all useful posts ***

Hi,

See attached the topology. Know i would like to use two area (area0 nad area1).

Router5 is ISPA and Router6 ISPB

I simulate a default route by configuration a static default route to router7.

Router1, 2, 5 and 6 is on area 1

Router 3, 4, 5 and 6 is on area0

What  i need is generate a default route on area0 with area0 router choose  router5 as best next-hop and generate default route on area1 with area1  router choose router6 as best next-hop.

Review Cisco Networking for a $25 gift card