Solved

Help creating OSPF export with static routes, with specific tags and cost.

  • 2 October 2020
  • 4 replies
  • 94 views

Userlevel 6
Badge

Hi

The static routes are as follows:

configure iproute add 10.1.0.0 255.255.0.0 172.16.2.10
configure iproute add 20.150.27.0 255.255.255.0 172.16.2.10

What I would like to do is redistribute those examples into OSPF with the first route using a tag of 2 and the other as a tag of 102, both with a cost of 8.

I’m likely going to need a .pol file to do this, maybe something along the line of the below but not sure it would work or is the best way to do it?

#### static-redist.pol file ####
entry static_first
{
if match any
{
nlri 10.1.0.0/16;
}
then
{
next-hop 172.16.2.10
tag 2
cost 8
}
}

entry static_second
{
if match any
{
nlri 20.150.27.0/24;
}
then
{
next-hop 172.16.2.10
tag 102
cost 8
}
}

enable ospf export static static-redist

The export command below has various options of which ‘tag’ is one component, but due to requiring different static routes with different tags I assume I will need a policy

enable ospf export [bgp | direct | e-bgp | i-bgp | rip | static | isis |
isis-level-1 | isis-level-1-external | isis-level-2 | isis-level-2-
external | host-mobility] [cost cost type [ase-type-1 | ase-type-2] {tag
number} | policy-map]

The bit I’m stuck on is how to get the routes, to their specific destinations, with their specific tags using a policy?

Appreciate any support in advance.

 

 

icon

Best answer by Christopher Thompson 3 October 2020, 20:29

Hi Martin,

 

I think I got it working below I did have to make some syntax changes to the ACL(see below):

static-redirect.pol

entry static_first
{
if match any
{
nlri 10.1.0.0/16;
}
then
{
next-hop 172.16.2.10;
tag 2;
cost 8;
permit;
}
}

entry static_second
{
if match any
{
nlri 20.150.27.0/24;
}
then
{
next-hop 172.16.2.10;
tag 102;
cost 8;
permit;
}
}

From there I configured the policy with the syntax below:

configure ospf area 0.0.0.0 external-filter static-redirect

On the OSPF neighbor I now see the proper tags:

EXOS-VM.37 # show ospf lsdb as-external

AS External LSAs
Link State ID Adv Router Seq# Age Chksum Tag
-------------------------------------------------------------
10.1.0.0 172.16.2.1 0xffffffff80000001 213 0x9edf 2
20.150.27.0 172.16.2.1 0xffffffff80000001 213 0xfd61 102
EXOS-VM.38 #

Thanks,

Chris Thompson

View original

4 replies

Userlevel 3

Hi Martin,

I am still reviewing but that looks to be the correct way but also adding an “else permit” statement at the end with no other action modifier.

Thanks,

Chris Thompson

 

Userlevel 6
Badge

Thanks for looking Chris. Will keep an eye on the post. 

Userlevel 3

Hi Martin,

 

I think I got it working below I did have to make some syntax changes to the ACL(see below):

static-redirect.pol

entry static_first
{
if match any
{
nlri 10.1.0.0/16;
}
then
{
next-hop 172.16.2.10;
tag 2;
cost 8;
permit;
}
}

entry static_second
{
if match any
{
nlri 20.150.27.0/24;
}
then
{
next-hop 172.16.2.10;
tag 102;
cost 8;
permit;
}
}

From there I configured the policy with the syntax below:

configure ospf area 0.0.0.0 external-filter static-redirect

On the OSPF neighbor I now see the proper tags:

EXOS-VM.37 # show ospf lsdb as-external

AS External LSAs
Link State ID Adv Router Seq# Age Chksum Tag
-------------------------------------------------------------
10.1.0.0 172.16.2.1 0xffffffff80000001 213 0x9edf 2
20.150.27.0 172.16.2.1 0xffffffff80000001 213 0xfd61 102
EXOS-VM.38 #

Thanks,

Chris Thompson

Userlevel 6
Badge

Hi Chris,

Really appreciate the support and the trouble of testing it.

Many thanks

Martin

Reply