Page 1 of 1

Two interfaces to same router, different costs

Posted: Mon Dec 03, 2018 8:12 pm
by gius64
Hello everyone,
I'm having an issue with one router, using OSPF.

This router (A) is connected to a gateway (G) using two other routers (B, C).
Both routers are 2 hops away, so there is another router in both path before the gateway (G).

So, router A has:
ether1 connected to G with one other hop, with different path than ether2
ether2 connected to G with one other hop, with different path than ether1

Router A has a tunnel to G for some specific traffic.

I would like to:
1) Send tunnel traffic to G using ether1 path
2) Send all other traffic to G using ether2 path

My issue is that if I set an higher cost of ether2 path, traffic tunnel will follow ether1 path to reach G because it has lower cost, and vice versa.

So, how can I achieve this in a simple way on OSPF without having to use static routes?

Thank you!

Re: Two interfaces to same router, different costs

Posted: Mon Dec 03, 2018 8:29 pm
by Redmor
You have to use mangle and mark (packet, connection and route, also only route) for tunnel and then make a static route with routing mark for the tunnel.
There's no other way to make what you want with OSPF, you can't simply take the path you want.
The only way to do that with OSPF is to have shortest paths for the traffic you need (only specific subnets) from one interface, and the rest from the other.

Or if this isn't a failover you can play with filters in middle hops, so G would reach A tunnel only from one interface and viceversa.
Hard to say without configuration and/or diagrams

Re: Two interfaces to same router, different costs

Posted: Mon Dec 03, 2018 9:28 pm
by gius64
Hi Redmor,
thank you very much for your quick answer.

Exactly, what do you mean by
The only way to do that with OSPF is to have shortest paths for the traffic you need (only specific subnets) from one interface, and the rest from the other.
Could you please show me an example?

I can play on middle hops, but this is also a failover, so I think I should add specific rules for tunnel traffic.

I thought it couldn't be possible with OSPF only, but I wanted to ask :-)

Re: Two interfaces to same router, different costs

Posted: Wed Dec 05, 2018 12:09 am
by Redmor
Hi Redmor,
thank you very much for your quick answer.

Exactly, what do you mean by
The only way to do that with OSPF is to have shortest paths for the traffic you need (only specific subnets) from one interface, and the rest from the other.
Could you please show me an example?

I can play on middle hops, but this is also a failover, so I think I should add specific rules for tunnel traffic.

I thought it couldn't be possible with OSPF only, but I wanted to ask :-)
Well... You can always filter routes in middle hops so specific subnets pass only in one way. You have to filter tunnel gateway in the next hop that G uses to reach ether2, so A sees the gateway for the tunnel only from the ether1, then for the next hop that A reaches from ether2 you have to input filter subnets that pass in the tunnel.
Assuming ether2 is the shortest path.

You could also use another area and another instance and make greater costs for ether2 path than ether1, and the older area with greater costs for ether1.
In this case all middle hops have to use another area and another maybe another instance, depending on what you want to redistribute in the middle.
After this you just have to specify subnets in network with another area and you should have a parallel OSPF network working in the opposite direction.
I'm just saying, never tried.

Edit: it's a really mad solution, and I don't know what will happen, you should have two default routes on router A, but I really don't know how OSPF will act in such conditions, try and let me know.