Inter-VLAN Routing

VLAN creates a logical broadcast domain, therefore hosts on different vlan couldn't communicate to each other directly. for the hosts to communicate, their traffic must be routed.

Inter-vlan routing ways
in traditional way. a switch is physically connected to a router with some physicall connection and each connection is assigned to each vlan, giving the ability for the router to receive different vlan traffic and route it to other vlan interface (each vlan is associated with a subnet address).
configuring the router is simply just by adding physical interfaces between the router and the switch and giving the ip address associated with the default gateway of each vlan. each physicall interface is connected to a access port on the switch.
this way is limited to the number of ports available on the switch as vlan increase.

new technology, some routers software permits configuring its interfaces as a trunk link and making subinterfaces of the physical interface with each subinterface associated with each vlan. permitting a single physical connection to the switch while still able to route for inter-vlan traffic. (this usually called router-on-a-stick)
functionally, the router on a stick is the same with the traditional inter vlan routing. but instead of using physical interfaces, router on a stick uses the combination of a trunk link and some subinterfaces. subinterfaces must be specified to work on what vlan (using the command "encapsulation dot1q vlan-id").
because a single physicall connection is shared over many vlans, bandwidth used for inter-vlan traffic is shared among all other vlans.

some switches able to do layer 3 switching. replacing the needs of a router to perform basic routing. layer 3 switch use Switched Virtual Interface (SVI) with each SVI is associated with different vlan, giving the ability to perform routing inter vlan with a single physical connection. (SVI is much like a layer 3 physical interface).

Traditional way
configure each switch ports. configure each switch port connected to the router as a access port for different vlan on each connection.
add the corresponding default gateway ip address for each vlan at each physical interface (you don't need to configure the vlan id that the interface is working on).

you must configure each switch ports. configure the switch connecting to the router as a trunk link. You cannot use the switchport mode dynamic auto or switchport mode dynamic desirable commands because the router does not support dynamic trunking protocol.
at the router, you don't need to give an ip address, just perform no shutdown at the physical interface. you assign the ip address at each subinterface. and remember to specify on which vlan does the subinterface is working on by entering the command "encapsulation dot1q vlan-id" (this command is for subinterfaces only) with vlan-id is the id of the vlan. you don't have to perform the "no sh" command at each subinterface, all subinterfaces will be enabled when the physical interface is enabled.