SUBINTERFACES
Subinterfaces: we need it when we have more vlans than physical links
As we know, we have setup a trunking port between the switch and router, then configure the configure the interface and sub interfaces in your router:
Switch(config)#interface fa0/2
Switch(config-if)#switchport mode trunk
Router(config)#interface fa0/1
Router(config-if)#no shutdown
Router(config)#interface fa0/1.1
Router(config-subif)#encapsulation dot1q 1
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
Router(config)#interface fa0/1.2
Router(config-subif)#encapsulation dot1q 15
Router(config-subif)#ip address 192.168.15.1 255.255.255.0
Router(config)#interface fa0/1.3
Router(config-subif)#encapsulation dot1q 35
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
We configure sub interfaces because we have 3 vlan and just one physical link, for this reason we need that all data passing through a single link, how do we fix that?
Creating 3 sub-interfaces, one for each vlan, however it reduces the bandwidth one third.
Physical Interfaces: we need it when we have more physical links than vlans
We configure a normal ip in each interface, (one per vlan), now in the switch instead of create trunk links, we create access links (one per vlan).
Router(config)#interface FastEthernet0/0
Router(config-subif)# ip address 10.10.10.1 255.255.255.0
Router(config)interface FastEthernet0/1
Router(config-subif)# ip address 10.10.20.1 255.255.255.0
Router(config)#interface FastEthernet0/3
Router(config-subif)#ip address 10.10.30.1 255.255.255.0
Switch(config)#interface range fa0/1, fa0/10
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config)#interface range fa0/5,fa0/20
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config)#interface range fa0/8, fa0/30
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 30
Here we have one link per vlan and we can use the full bandwidth of each interface.