01-17-2025 01:58 PM
I have a situation where I have to set up OSPF, the two routers are separated by a L2 switch. Is this feasible?
Solved! Go to Solution.
01-18-2025 08:06 AM
Three steps
1-enable ip routing in SW
2-config SVI for both vlan
3-run ospf for SVI
MHM
01-17-2025 02:11 PM
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?
01-17-2025 02:25 PM
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?
01-17-2025 03:16 PM - edited 01-17-2025 03:59 PM
01-17-2025 03:48 PM
@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.
01-17-2025 10:35 PM
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
01-18-2025 07:59 AM
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?
01-18-2025 08:06 AM
Three steps
1-enable ip routing in SW
2-config SVI for both vlan
3-run ospf for SVI
MHM
01-18-2025 08:59 AM
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.
01-18-2025 12:42 PM - edited 01-18-2025 12:47 PM
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
01-18-2025 08:50 AM
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.
01-18-2025 09:35 AM
@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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide