This document provides the configuration and troubleshooting steps for creating layer 3 interfaces. VLANs divide broadcast domains into a LAN environment. Whenever hosts on one VLAN need to communicate with hosts on another VLAN, traffic must be routed between them. This is known as VLAN routing. In Catalyst switches is achieved by creating layer 3 interfaces (virtual switch interfaces (SVI)).
As we have learned, devices within a VLAN can communicate with each other without the need for routing layer 3. However, devices in separate VLANs require a layer 3 routing device to communicate with each other. For example, in the topology below, host A and B can communicate with each other without a router in the same VLAN 10; host C and D can communicate on the same VLAN 20. But host A can not communicate with host C or D because they are in different VLANs.
To allow hosts on different VLANs to communicate with each other, we need a Layer 3 device (such as a router) for routing:
Routing traffic from one VLAN to another VLAN is called InterVLAN routing.
Now host A can easily communicate with host C or D. Now let's see how traffic is sent from host A to host D. First, host A knows that the destination host is in a different VLAN, so which sends traffic to your default gateway (on the router) through the switch. The switch marks the frame as originating from VLAN 10 and sends it to the router. In turn, the router makes the decision to routing VLAN 10 to VLAN 20 and sends that traffic back to the switch, where it is forwarded to host D.
Note that the decision to route to another VLAN is made by the router, not by the switch. When the frames leave the router (step 3 in the image above), they are tagged with VLAN 20.
Note also that the receiving ends (host A & D in this case) do not know any VLAN information. The switch assigns VLAN information when receiving frames from host A and deletes the VLAN information before forwarding it to host D.
But there is a disadvantage in the previous topology: for each VLAN we need a physical connection from the router to the switch, but in practice, the router interfaces are very limited. To overcome this problem, we can create many logical interfaces in a physical interface. For example, from a fa0 / 0 physical interface we can create many sub-interfaces like fa0 / 0.0, fa0 / 0.1 ... Now this router is often called "router on a stick" (perhaps because there is only one link physical looks like a router on a stick ^^).
The router treats each subinterface as a separate physical interface in routing decisions -> data can be sent and received on the same physical interface (but different subinterfaces) without being removed by the split horizon rule in case you want to send updates of routing through the router from one VLAN to another.