I have a Layer-3 switch with three VLANs and a router, using OSPF routing protocol.

My current setting:

  • A router with router-id
  • An interface connect to L3 switch with
  • A L3 switch with router-id
  • VLAN 1 on L3 switch
  • VLAN 2 on L3 switch, a port connected to router
  • VLAN 10 on L3 switch

I didn't set VLANs on the router. So maybe that's why it doesn't aware there are VLANs from I have looked into InterVLAN routing and set same VLANs on router with switchport command. However, only VLAN 2 is working and I lost LSA of subnet of I guess I still don't know how to achieve that.

Under current setting, I can advertise a LSA of subset with a direct link on VLAN 2 to the router, and that makes OSPF network aware subnet of However, I want OSPF network know it can connect to subnet of and subnet of too. How do I do that? Or is it possible?

  • Is this a router or are you routing on a layer-3 switch?
    – Ron Maupin
    Commented Nov 25, 2015 at 2:16
  • A L3 switch support ospf and rip, and a router supports ospf and bgp.
    – Pue-Tsuâ
    Commented Nov 25, 2015 at 2:20

3 Answers 3


This is with some assumptions since you didn't include a drawing or configurations.

If you have a router connected to a layer-3 switch, you should probably make the link between the two a point-to-point routed link (use no switchport on the layer-3 switch port) and give the link a point-to-point address like /30 or /31.

On the layer-3 switch, you have SVIs with IP addresses for your VLANs, and you use network statements (or redistribute connected routes) in the OSPF configuration so that OSPF will share the networks with the router.

You probably want the router to send a default route to the layer-3 switch, so you use the default-information originate command on the router, and it will inject the default route into OSPF if it exists in the routing table.

  • Great answer so far. But is it normal that other subnets are advertised as AS externel?
    – Pue-Tsuâ
    Commented Nov 25, 2015 at 2:53
  • If you do a redistribution, yes. If you use network statements (you can use network area <area> to get all the interfaces, it won't do that. Another good practice is to use passive-interface default and then no passive-interface <interface> for interfaces with OSPF neighbors. This prevents OSPF from sending hellos on toward hosts.
    – Ron Maupin
    Commented Nov 25, 2015 at 2:58

may you create loopback interfaces on the router with ips in these ranges to advertise it on the OSPF.

  • Good idea but my router couldn't route paths to these VLANs yet.
    – Pue-Tsuâ
    Commented Nov 25, 2015 at 2:15
  • 1
    so you must configure sup interfaces in the range of the vlans IP from the side of the router and configure trunk from switch side
    – Gadeliow
    Commented Nov 26, 2015 at 8:26

You need to create subinterfaces on the router.
It's called "inter vlan routing" what you want to use.
After that you can tell OSPF to which vlans it should connect.

  • I have looked into it and updated my problem.
    – Pue-Tsuâ
    Commented Nov 25, 2015 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.