Configuration of L2sw1-
L2sw1>enable
L2sw1#conf t
L2sw1(config)#vlan 10
L2sw1(config-vlan)#exit
L2sw1(config)#vlan 20
L2sw1(config-vlan)#exit
L2sw1(config)#interface fastEthernet 0/1
L2sw1(config-if)#switchport mode access
L2sw1(config-if)#switchport access vlan 10
L2sw1(config-if)#no shutdown
L2sw1(config-if)#ex
L2sw1(config)#interface fastEthernet 0/2
L2sw1(config-if)#switchport mode access
L2sw1(config-if)#switchport access vlan 20
L2sw1(config-if)#no shutdown
L2sw1(config-if)#exit
L2sw1(config)#interface range fastEthernet 0/3 -4
L2sw1(config-if-range)#switchport mode trunk
L2sw1(config-if-range)#no shutdown
L2sw1(config-if-range)#exit
---------------------------------------------
Configuration of L2sw2-
L2sw2>enable
L2sw2#conf t
L2sw2(config)#vlan 10
L2sw2(config-vlan)#exit
L2sw2(config)#vlan 20
L2sw2(config-vlan)#exit
L2sw2(config)#interface fastEthernet 0/2
L2sw2(config-if)#switchport mode access
L2sw2(config-if)#switchport access vlan 10
L2sw2(config-if)#no shutdown
L2sw2(config-if)#ex
L2sw2(config)#interface fastEthernet 0/3
L2sw2(config-if)#switchport mode access
L2sw2(config-if)#switchport access vlan 20
L2sw2(config-if)#no shutdown
L2sw2(config-if)#exit
L2sw2(config)#interface fastEthernet 0/1
L2sw2(config-if-range)#switchport mode trunk
L2sw2(config-if-range)#no shutdown
L2sw2(config-if-range)#exit
-------------------------------------------------------
Configuration of Router-
Router>enable
Router#conf t
Router(config)#interface fastEthernet 0/0
Router(config-if)#no ip address
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface fastEthernet 0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 10.0.0.10 255.0.0.0
Router(config-subif)#no shutdown
Router(config-subif)#ex
Router(config)#interface fastEthernet 0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 20.0.0.10 255.0.0.0
Router(config-subif)#no shutdown
Router(config-subif)#ex
Router(config)#
----------------------------------------------
After doing the configuration, try to ping the PCs in different vlans.
PC1>ping 20.0.0.1
Pinging 20.0.0.1 with 32 bytes of data:
Reply from 20.0.0.1: bytes=32 time=80ms TTL=127
Reply from 20.0.0.1: bytes=32 time=80ms TTL=127
Reply from 20.0.0.1: bytes=32 time=90ms TTL=127
Reply from 20.0.0.1: bytes=32 time=80ms TTL=127
Ping statistics for 20.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 80ms, Maximum = 90ms, Average = 82ms
PC1>ping 20.0.0.2
Pinging 20.0.0.2 with 32 bytes of data:
Reply from 20.0.0.2: bytes=32 time=100ms TTL=127
Reply from 20.0.0.2: bytes=32 time=100ms TTL=127
Reply from 20.0.0.2: bytes=32 time=90ms TTL=127
Reply from 20.0.0.2: bytes=32 time=90ms TTL=127
Ping statistics for 20.0.0.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 90ms, Maximum = 100ms, Average = 95ms
PCs in different vlans are communicating.