Though actually this simple topic is covered in CCNA, as this week just finish the teaching of CCNA, I still find that this really deserve to discuss.
The problem is about the VLAN configuration. In the new CCNA course, there is a lab about the inter-vlan router using the following topology:

Objective of the lab is quite simple, just use the Router to do inter-vlan routing. PC1 will be put on VLAN 10, while PC2 will be put on VLAN 20.
Now in SW1, create VLAN 10, configure port 0/1 to be VLAN 10. While port 0/3 and 0/13 need to be configured as trunk and allow VLAN 10,20 traffic. Configuration as below:
hostname SW1
!
vlan 10
!
interf FastEthernet 0/1
switchport mode access
switchport access vlan 10
no shutdown
!
interf FastEthernet 0/3
switchport mode trunk
switchport trunk allowed vlan 1,10,20
no shutdown
!
interf FastEthernet 0/13
switchport mode trunk
switchport trunk allowed vlan 1,10,20
no shutdown
Similarly, in SW2, create VLAN 20, configure port 0/1 to be VLAN 20. While port 0/3 to be trunk, also allow VLAN 10,20 traffic. Configuration as below:
hostname SW2
!
vlan 20
!
interf FastEthernet 0/1
switchport access vlan 20
no shutdown
!
interf FastEthernet 0/3
switchport mode trunk
switchport trunk allowed vlan 1,10,20
no shutdown
!
Now go to the Router, create 2 subinterfaces in interface 0/0 with VLAN 10 and 20 respectively. Configure the corresponding IP addresses - VLAN 10 uses subnet 10.1.10.0/24, while VLAN 20 uses subnet 10.1.20.0/24.
interface GigabitEthernet 0/0
no shutdown
description Link to LAN Switch
ip address 10.1.1.1 255.255.255.0
!
interface GigabitEthernet 0/0.10
encapsulation dot1q 10
ip address 10.1.10.1 255.255.255.0
!
interface GigabitEthernet 0/0.20
encapsulation dot1q 20
ip address 10.1.20.1 255.255.255.0
!
Finally, for PC1 configure the corresponding IP address and default gateway as follows:
IP: 10.1.10.100 255.255.255.0
default gateway: 10.1.10.1
Similarly for PC2:
IP: 10.1.20.100 255.255.255.0
default gateway 10.1.20.1
OK, everything is ready? Should be able to ping between the PC1 and PC2.
Wait a miunte, lets first try to ping the default GW. In PC1, ping 10.1.10.1, perfectly works.
In PC2, ping 10.1.20.1. Hooops? Timeout!
So whats missing here? You may already able to figure it out. Problem is in SW1. It misses the VLAN 20. Though it doesn't has any access port on VLAN 20, it still needs to pass VLAN 20 traffic. Without the VLAN 20 definition, in fact, it won't carry VLAN 20 traffic on the trunk between it and the router. Thus VLAN 20 traffic is dropped and won't send to router.
To fix it:
sw1(config)# vlan 20