Q: what are the code for the router, switch and the for the PC(ip add, subnet mask, default gateway) in order for the 3 PC to meet each other?
CODE NEEDED:
(TRUNKING, Mode access)

Router
    -enable secret class
    -line vty pass:CISCO ![packet1](/attachments/small/3/packet1.JPG "align-left") 
    -line console pass:CISCO
Switch
    -enable secret class
    -line vty pass:CISCO
    -line console pass:CISCO

Sounds very much like a homework assignment, which we do not answer unless the poster shows some kind of effort themselves. See the rules:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

Please find the detail configuration below:

Router Conf

Router#sh run
Building configuration...

Current configuration : 987 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
ip dhcp excluded-address 172.17.10.2 172.17.10.10
ip dhcp excluded-address 172.17.20.2 172.17.20.10
!
ip dhcp pool VLAN10
network 172.17.10.0 255.255.255.0
default-router 172.17.10.1
ip dhcp pool VLAN20
network 172.17.20.0 255.255.255.0
default-router 172.17.20.1
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.10
encapsulation dot1Q 10
ip address 172.17.10.1 255.255.255.0
!
interface FastEthernet0/0.20
encapsulation dot1Q 20
ip address 172.17.20.1 255.255.255.0
!
interface FastEthernet0/0.100
encapsulation dot1Q 100
ip address 192.168.0.1 255.255.255.0
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
!
end

*** Switch Conf:**

Switch#sh run
Building configuration...

Current configuration : 2144 bytes
!
version 12.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 100
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/4
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/5
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/6
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/8
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/9
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/10
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/11
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/12
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/13
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/14
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/15
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/16
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/17
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/18
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/19
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/20
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/21
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/22
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/23
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/24
switchport access vlan 10
switchport mode access
!
interface Vlan1
no ip address
shutdown
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end

Network diagram is same as you but I created DHCP in router so that we don't need to do anything in end user just tick the DHCP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.