cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
796
Views
2
Helpful
11
Replies

OSPF between 2 routers with a L2 switch between

wwwlstr0707
Level 1
Level 1

I have a situation where I have to set up OSPF, the two routers are separated by a L2 switch. Is this feasible?

1 Accepted Solution

Accepted Solutions

Three steps 

1-enable ip routing in SW

2-config SVI for both vlan

3-run ospf for SVI

MHM

View solution in original post

11 Replies 11

@wwwlstr0707 

 Sure it is but they need to be on the same vlan on the L2 switch. The vlan id itself does not matter

You are reffering to this, right?

FlavioMiranda_0-1737151841915.png

 

wwwlstr0707
Level 1
Level 1

That’s the physical connection 100%. 
So the switch interfaces shown both need to be access ports on the same vlan, vlan200 for instance…?

So the router interfaces need to be on the same network?

Exactly

Adding a PacketTracer file in case you want to see it working.


@wwwlstr0707 wrote:

That’s the physical connection 100%. 
So the switch interfaces shown both need to be access ports on the same vlan, vlan200 for instance…?

So the router interfaces need to be on the same network?


Yes and yes, assuming you want the two routers to intercommunicate as OSPF neighbors.

Basically, the same requirements as for any two hosts you want to intercommunicate at L2 using L3, i.e. same L2 domain, common IP network.

Also, in principal, same as if you replaced the switch with a direct cable between the two routers or used a hub.

You can config this in two way

1- you use trunk in SW

Here in both router you need to use subinterface and config vlan 

2-you use access port

Here you need to config router port in both router (no need subinterface and no need to config vlan in both router)

For subnet both router must use same subnet 

When both router use different subnet? When SW have different vlan for each router and SW also participate in ospf

MHM

Both routers use separate networks.  So like the last config you mention, switch has different vlan for each router….which means the switch needs to participate in ospf…?  How to make that happen?

Three steps 

1-enable ip routing in SW

2-config SVI for both vlan

3-run ospf for SVI

MHM

I am a bit puzzled about what you are asking. But one thing is quite clear. The original post clearly says it is a layer 2 switch. So IP routing or OSPF are NOT possible on the switch.

You describe a L2 switch but do not tell us anything about it, other than the routers connect to it. If the routers are connected to the L2 switch and you want them to communicate then the switch ports to which they connect must be in the same vlan. If routerA is in one vlan and routerB is in a different vlan on L2 switch then the routers will not be able to communicate.

The OP describes 2 routers connected by L2 switch and asks about running OSPF. If you want to run OSPF and want the routers to be OSPF neighbors then the router interfaces connected to the switch must be in the same subnet. If routerA is connected to the switch and is in some subnet and router B is connected to the switch (in the same vlan) and is in some different subnet, then the routers can run OSPF but they will NOT become neighbors.

HTH

Rick

Thanks for the additional info. The post was purposefully vague as I was trying to hammer this out with little help. But fact is I’m having trouble working out the solution. So I was just going to go back to the drawing board

wwwlstr0707
Level 1
Level 1

Thanks everyone. Was trying to get a handle on an unexpected design challenge I came across in an old ccnp lab a friend forwarded me. It’s actually a L3 switch but was functioning as a L2. The missing piece was enable ip routing. Thanks as always. 


@wwwlstr0707 wrote:

Thanks everyone. Was trying to get a handle on an unexpected design challenge I came across in an old ccnp lab a friend forwarded me. It’s actually a L3 switch but was functioning as a L2. The missing piece was enable ip routing. Thanks as always. 


If you enable IP routing, it's no longer functioning as just a L2 switch, although it can continue to do that too.  But, if IP routing resolved an OSPF connection problem, with the two routers, then the routers are very likely not within the same L2 domain nor sharing a subnet.