You are on page 1of 43

Ti liu thc hnh CCNA

VTP, VLAN Lab


I. M hnh bi Lab :

II. Cc bc thc hin :


1. Cu hnh VTP trn cc Switch :
- SW1 :
Switch> enable
Switch# configure terminal
Switch(config)#hostname SW1-VTPServer
SW1-VTPServer(config)#vtp domain TTG
SW1-VTPServer(config)#vtp password 123
SW1-VTPServer(config)#vtp version 2
SW1-VTPServer(config)#vtp mode server
127

Ti liu thc hnh CCNA

- SW2 :
Switch> enable
Switch# configure terminal
Switch(config)#hostname SW2-VTPClient
SW2-VTPClient(config)#vtp domain TTG
SW2-VTPClient(config)#vtp password 123
SW2-VTPClient(config)#vtp version 2
SW2-VTPClient(config)#vtp mode client
- SW3 :
Switch> enable
Switch# configure terminal
Switch(config)#hostname SW3-VTPClient
SW3-VTPClient(config)#vtp domain TTG
SW3-VTPClient(config)#vtp password 123
SW3-VTPClient(config)#vtp version 2
SW3-VTPClient(config)#vtp mode client
2. Cu hnh Trunking gia cc Switch :
- SW1 :
SW1-VTPServer(config)#interface g1/1
SW1-VTPServer(config-if)#switchport mode trunk
SW1-VTPServer(config-if)#exit
SW1-VTPServer(config)#interface g1/2
SW1-VTPServer(config-if)#switchport mode trunk
SW1-VTPServer(config-if)#exit

128

Ti liu thc hnh CCNA

- SW2 :
SW2-VTPClient(config)#interface g1/1
SW2-VTPClient(config-if)#switchport mode trunk
SW2-VTPClient(config-if)#exit
- SW3 :
SW3-VTPClient(config)#interface g1/2
SW3-VTPClient(config-if)#switchport mode trunk
SW3-VTPClient(config-if)#exit
3. Cc lnh kim tra cu hnh VTP, Trunking :
- SW1-VTPServer #show vtp password
VTP Password: 123
- SW1-VTPServer#show vtp status
VTP Version

:2

Configuration Revision

:0

Maximum VLANs supported locally : 255


Number of existing VLANs

:7

VTP Operating Mode

: Server

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x54 0xC1 0x71 0x3F 0x9B 0x83 0xAF 0x38

Configuration last modified by 0.0.0.0 at 3-1-93 01:44:06


- SW1-VTPServer#show interface trunk
Port

Mode

Encapsulation Status

Native vlan
129

Ti liu thc hnh CCNA

G1/1

on

802.1q

trunking

G1/2

on

802.1q

trunking

Port

Vlans allowed on trunk

G1/1

1-1005

G1/2

1-1005

Port

Vlans allowed and active in management domain

G1/1

1,2,3

G1/2

1,2,3

Port

Vlans in spanning tree forwarding state and not pruned

G1/1

1,2,3

G1/2

1,2,3

4. To VLAN trn SW1-VTPServer :


SW1-VTPServer(config)#vlan 2
SW1-VTPServer(config-vlan)#name KinhDoanh
SW1-VTPServer(config-vlan)#exit
SW1-VTPServer(config)#vlan 3
SW1-VTPServer(config-vlan)#name KeToan
SW1-VTPServer(config-vlan)#exit
SW1-VTPServer(config)#vlan 4
SW1-VTPServer(config-vlan)#name Giamdoc
SW1-VTPServer(config-vlan)#exit
SW1-VTPServer(config)#vlan 5
SW1-VTPServer(config-vlan)#name IT
SW1-VTPServer(config-vlan)#exit

130

Ti liu thc hnh CCNA

5. Kim tra li thng tin VLAN trn cc Switch VTP client :


- Switch# show vlan brief
- Switch# show vlan
6. Cu hnh cc cng thuc VLAN theo yu cu :
- SW2 :
SW2-VTPClient(config)#interface range fa0/1 6
SW2-VTPClient (config-if-range)#switchport access vlan 2
SW2-VTPClient (config-if-range)#exit
SW2-VTPClient(config)#interface range fa0/7 10
SW2-VTPClient (config-if-range)#switchport access vlan 3
SW2-VTPClient (config-if-range)#exit
SW2-VTPClient(config)#interface range fa0/11 15
SW2-VTPClient (config-if-range)#switchport access vlan 4
SW2-VTPClient (config-if-range)#exit
SW2-VTPClient(config)#interface range fa0/16 24
SW2-VTPClient (config-if-range)#switchport access vlan 5
SW2-VTPClient (config-if-range)#exit
- SW3 :
SW3-VTPClient(config)#interface range fa0/1 6
SW3-VTPClient (config-if-range)#switchport access vlan 2
SW3-VTPClient (config-if-range)#exit
SW3-VTPClient(config)#interface range fa0/7 10
SW3-VTPClient (config-if-range)#switchport access vlan 3
SW3-VTPClient (config-if-range)#exit
SW3-VTPClient(config)#interface range fa0/11 15
131

Ti liu thc hnh CCNA

SW3-VTPClient (config-if-range)#switchport access vlan 4


SW3-VTPClient (config-if-range)#exit
SW3-VTPClient(config)#interface range fa0/16 24
SW3-VTPClient (config-if-range)#switchport access vlan 5
SW3-VTPClient (config-if-range)#exit
7. Tin hnh t a ch IP cho cc PC theo ng lp mng ca mnh :
- Kt ni cc PC vo ng cc port thuc VLAN tng ng trn SW1 v SW2
- V d trng hp ca VLAN 5, lp mng c phn l 192.168.5.0/24 nn IP dng c l t
192.168.5.1 n 192.168.5.254, tng t cho cc VLAN khc
- Lu cu hnh v kt thc bi lab

132

Ti liu thc hnh CCNA

VTP,PVST+,PVRST LAB
I. M hnh bi lab :

II. Cc bc cu hnh bi lab:


Bc 1: Bc 2:Cu hnh cc loi mt khu cho cng console,vty,mode priviliege
Bc 3 : Cu hnh VTP trn 3 Switch
Bc 4 : Cu hnh Trunking
Bc 5 : To thng tin VLAN theo yu cu ca bi lab trn VTP server (SW1)
Bc 6 : Gn cc cng trn SW2,SW3 vo cc VLAN tng ng theo yu cu
Bc 7 : Cu hnh a ch IP cho cc Switch c th qun l t xa
Bc 8 : SW1 l RootBridge

133

Ti liu thc hnh CCNA

Bc 1: Xa thng tin VLAN v VTP trn cc Switch


- Kim tra switch c cu hnh hay cha bng cc lnh show start-up configure ,show vlan
brief nu c tin hnh xa thng tin VLAN v cu hnh
Switch#delete vlan.dat
Delete filename [vlan.dat]?
Delete flash:vlan.dat? [confirm]
- Do thng tin VTP v VLAN nm tp tin vlan.dat b nh Flash: nn lnh ny c tc dng
xa thng tin VLAN v VTP trn switch
SW1#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
Switch#reload
Proceed with reload? [confirm]
System configuration has been modified. Save? [yes/no]: n
Bc 2: Cu hnh mt khu cho cng Console,line vty ,mode privilege
SW1>enable
SW1#config terminal
Enter configuration commands, one
SW1(config)#enable secret cisco
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config)#line vty 0 15
SW1(config-line)#password cisco
SW1(config-line)#login
- Lp li bc 2 cho cc switch cn li v router

134

Ti liu thc hnh CCNA

Bc 3: Cu hnh VTP trn 3 Switch


- Mc nh cc Switch Cisco c cu hnh VTP nh sau :
VTP domain name: None
VTP mode: Server mode
VTP pruning: Enabled or disabled (model specific)
VTP password: Null
VTP version: Version 1
- ng b c thng tin VTP th i hi cc switch phi ging nhau v VTP Domain,
password
SW1:
Switch>enable
Switch#config terminal
Switch(config)#hostname SW1
SW1(config)#exit
- Xem thng tin VTP trn SW1 trc khi cu hnh bng lnh show vtp status
SW1#show vtp status
VTP Version

:2

Configuration Revision

:0

Maximum VLANs supported locally : 250


Number of existing VLANs

:5

VTP Operating Mode

: Server

VTP Domain Name

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Disabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x57 0xCD 0x40 0x65 0x63 0x59 0x47

Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00


Local updater ID is 0.0.0.0 (no valid interface found)
135

Ti liu thc hnh CCNA

SW1(config)#vtp version 2
SW1(config)#vtp domain TTG
Changing VTP domain name from NULL to TTG
SW1(config)#vtp password cisco
Setting device VLAN database password to cisco
SW1(config)#vtp mode server
Device mode already VTP SERVER.
- Thng tin VTP trn SW1 sau khi cu hnh
SW1#show vtp status
VTP Version

:2

Configuration Revision

:0

Maximum VLANs supported locally : 250


Number of existing VLANs

:5

VTP Operating Mode

: Server

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x14 0x8E 0xDA 0xC9 0x0A 0x42 0xAF 0xE7

Configuration last modified by 0.0.0.0 at 3-1-93 00:05:26


Local updater ID is 0.0.0.0 (no valid interface found)
SW1#show vtp password
VTP Password: cisco
SW2:
Switch>enable
Switch#config terminal
136

Ti liu thc hnh CCNA

Switch(config)#hostname SW2
SW2(config)#vtp version 2
Setting device to VTP CLIENT mode.
SW2(config)#vtp domain TTG
Changing VTP domain name from NULL to TTG
SW2(config)#vtp password cisco
Setting device VLAN database password to cisco
SW2(config)#vtp mode client
- Kim tra li thng tin VTP trn SW2
SW2#show vtp status
VTP Version

:2

Configuration Revision

:1

Maximum VLANs supported locally : 250


Number of existing VLANs

:5

VTP Operating Mode

: Client

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x14 0x8E 0xDA 0xC9 0x0A 0x42 0xAF 0xE7

Configuration last modified by 0.0.0.0 at 3-1-93 00:05:26


SW2#show vtp password
VTP Password: cisco
SW3:
Switch>enable
Switch#config terminal
Switch(config)#hostname SW3
137

Ti liu thc hnh CCNA

SW3(config)#vtp version 2
SW3(config)#vtp domain TTG
Changing VTP domain name from NULL to TTG
SW3(config)#vtp password cisco
Setting device VLAN database password to cisco
SW3(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW3#show vtp status
VTP Version

:2

Configuration Revision

:1

Maximum VLANs supported locally

: 250

Number of existing VLANs

:5

VTP Operating Mode

: Client

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x14 0x8E 0xDA 0xC9 0x0A 0x42 0xAF 0xE7

Configuration last modified by 0.0.0.0 at 3-1-93 00:12:56


SW3#show vtp password
VTP Password: cisco
Bc 4: Cu hnh Trunking cho 3 switch SW1,SW2,SW3 v Router
Ch : i vi Switch layer 3 do h tr c 2 chun 802.1Q v ISL nn trc khi cu hnh
Trunking cn thm lnh switchport trunk encapsulation dot1q mode interface ,Switch layer 2
th ch h tr 802.1Q nn khng cn nhp lnh trn
- SW1:
SW1(config)#interface fa0/20
SW1(config-if)#switchport trunk encapsulation dot1q //ch dng cho layer3 Switch
138

Ti liu thc hnh CCNA

SW1(config-if)#switchport mode trunk


SW1(config-if)#switchport nonegotiate

// v hiu ha chc nng DTP

SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface fa0/22
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport nonegotiate
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#interface fa0/23
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport nonegotiate
SW1(config-if)#no shutdown
- SW2:
SW2(config)#interface fa0/22
SW2(config-if)# switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport nonegotiate
SW2(config-if)#no shutdown
- SW3:
SW3(config)#interface fa0/23
SW3(config-if)# switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport nonegotiate
SW3(config-if)#no shutdown
139

Ti liu thc hnh CCNA

- S dng lnh show interfaces trunk kim tra li cu hnh Trunking


SW1#show interfaces trunk
Port

Mode

Encapsulation Status

Native vlan

Fa0/20

on

802.1q

trunking

Fa0/22

on

802.1q

trunking

Fa0/23

on

802.1q

trunking

Port

Vlans allowed on trunk

Fa0/20

1-4094

Fa0/22

1-4094

Fa0/23

1-4094

Port

Vlans allowed and active in management domain

Fa0/20

Fa0/22

Fa0/23

Port

Vlans in spanning tree forwarding state and not pruned

Fa0/20

none

Fa0/22

Fa0/23

Router:
Router#config terminal
Enter configuration commands, one per line. End with C
Router(config)#interface fa0/0
Router(config-if)#description Gateway cho VLAN1
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
140

Ti liu thc hnh CCNA

Router(config)#interface fa0/0.2
Router(config-subif)#description Gateway cho VLAN2
Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#exit
Router(config)#interface fa0/0.3
Router(config-subif)#description Gateway cho VLAN3
Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip address 192.168.3.1 255.255.255.0
Router(config-if)#exit
Router(config)#interface fa0/0.4
Router(config-subif)#description Gateway cho VLAN4
Router(config-subif)#encapsulation dot1Q 4
Router(config-subif)#ip address 192.168.4.1 255.255.255.0
Router#show ip interface brief
Interface

IP-Address

OK? Method Status

Protocol

FastEthernet0/0

192.168.1.1

YES

manual up

up

FastEthernet0/0.2

192.168.2.1

YES

manual up

up

FastEthernet0/0.3

192.168.3.1

YES

manual up

up

FastEthernet0/0.4

192.168.4.1

YES

manual up

up

FastEthernet0/1

unassigned

YES administratively down down

Serial0/1/0

unassigned

YES administratively down down

Serial0/1/1

unassigned

YES administratively down down

Bc 5: To VLAN trn VTP server SW1


- Kim tra thng tin VLAN hin ti trn SW1

141

Ti liu thc hnh CCNA

SW1#show vlan
VLAN Name

Status

Ports

---- -------------------------------- --------- ------------------------------1

default

active

Fa0/1, Fa0/2, Fa0/3, Fa0/4


Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11,Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/24, Gi0/1, Gi0/2

1002 fddi-default

act/unsup

1003 trcrf-default

act/unsup

1004 fddinet-default

act/unsup

1005 trbrf-default

act/unsup

- Tin hnh to VLAN


SW1(config)#vlan 2
SW1(config-vlan)#name Accounting_Network
SW1(config-vlan)#exit
SW1(config)#vlan 3
SW1(config-vlan)#name Engineering_Network
SW1(config-vlan)#exit
SW1(config)#vlan 4
SW1(config-vlan)#name Markeeting_Network
SW1(config-vlan)#exit
Kim tra lai thng tin trn SW1,SW2,SW3 sau khi cu hnh m bo thng tin VLAN v
VTP c ng b

142

Ti liu thc hnh CCNA

SW1#show vlan
VLAN Name

Status

Ports

---- -------------------------------- --------- ------------------------------1

default

active Fa0/1, Fa0/2, Fa0/3, Fa0/4


Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/21
Fa0/24, Gi0/1, Gi0/2

Accounting_Network

active

Engineering_Network

active

Markeeting_Network

active

1002 fddi-default

act/unsup

1003 trcrf-default

act/unsup

1004 fddinet-default

act/unsup

1005 trbrf-default

act/unsup

SW1#show vtp status


VTP Version

:2

Configuration Revision

:4

Maximum VLANs supported locally : 250


Number of existing VLANs

:8

VTP Operating Mode

: Server

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x23 0x1C 0x6A 0xEB 0x65 0xD2 0xA5 0x51


143

Ti liu thc hnh CCNA

Configuration last modified by 0.0.0.0 at 3-1-93 00:41:55


Local updater ID is 0.0.0.0 (no valid interface found)
SW2#show vlan
VLAN Name

Status

Ports

---- -------------------------------- --------- ------------------------------1

default

active

Fa0/1, Fa0/2, Fa0/3, Fa0/4


Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/23, Fa0/24, Gi0/1
Gi0/2

Accounting_Network

active

Engineering_Network

active

Markeeting_Network

active

1002 fddi-default

act/unsup

1003 trcrf-default

act/unsup

1004 fddinet-default

act/unsup

1005 trbrf-default

act/unsup

SW2#show vtp status


VTP Version

:2

Configuration Revision

:4

Maximum VLANs supported locally : 250


Number of existing VLANs

:8

VTP Operating Mode

: Client

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled
144

Ti liu thc hnh CCNA

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x23 0x1C 0x6A 0xEB 0x65 0xD2 0xA5 0x51

Configuration last modified by 0.0.0.0 at 3-1-93 00:41:55


SW3#show vtp status
VTP Version

:2

Configuration Revision

:4

Maximum VLANs supported locally : 250


Number of existing VLANs

:8

VTP Operating Mode

: Client

VTP Domain Name

: TTG

VTP Pruning Mode

: Disabled

VTP V2 Mode

: Enabled

VTP Traps Generation

: Disabled

MD5 digest

: 0x23 0x1C 0x6A 0xEB 0x65 0xD2 0xA5 0x51

Configuration last modified by 0.0.0.0 at 3-1-93 00:41:55


SW3#show vlan
VLAN Name

Status

Ports

---- -------------------------------- --------- ------------------------------1

default

active

Fa0/1, Fa0/2, Fa0/3, Fa0/4


Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/23, Fa0/24, Gi0/1
Gi0/2

Accounting_Network

active
145

Ti liu thc hnh CCNA

Engineering_Network

active

Markeeting_Network

active

1002 fddi-default

act/unsup

1003 trcrf-default

act/unsup

1004 fddinet-default

act/unsup

1005 trbrf-default

act/unsup

Bc 6: Gn cc port trn tng Switch vo VLAN tng ng


- SW1:
SW1(config)#interface range fa0/1 - 5
SW1(config-if-range)#switchport access vlan 2
SW1(config-if-range)#exit
SW1(config)#interface range fa0/6 - 10
SW1(config-if-range)#switchport access vlan 3
SW1(config-if-range)#exit
SW1(config)#interface range fa0/11 - 15
SW1(config-if-range)#switchport access vlan 4
SW1(config-if-range)#exit
- Lp li bc 6 trn cc Switch cn li
- Kim tra li bng lnh show vlan trn c 3 Switch
SW1#show vlan
VLAN Name

Status

Ports

---- -------------------------------- --------- -----------------------------1

default

active

Fa0/16, Fa0/17, Fa0/18, Fa0/19


Fa0/21, Fa0/24, Gi0/1, Gi0/2

Accounting_Network

active

Fa0/1, Fa0/2, Fa0/3, Fa0/4


Fa0/5

Engineering_Network

active

Fa0/6, Fa0/7, Fa0/8, Fa0/9


146

Ti liu thc hnh CCNA

Fa0/10
4

Markeeting_Network

active

Fa0/11, Fa0/12, Fa0/13, Fa0/14


Fa0/15

Bc 7 : Cu hnh a ch IP cho cc Switch c th qun l t xa


SW1(config)# interface VLAN1
SW1(config-if)#ip address 192.168.1.11 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#ip default-gateway 192.168.1.1
SW1#show ip interface brief
Interface

IP-Address

OK? Method Status

Protocol

Vlan1

192.168.1.11

YES manual

up

up

SW2(config)# interface VLAN1


SW2(config-if)#ip address 192.168.1.12 255.255.255.0
SW2(config-if)#no shutdown
SW2(config-if)#exit
SW2(config)#ip default-gateway 192.168.1.1
SW2#show ip interface brief
Interface

IP-Address

OK? Method Status

Protocol

Vlan1

192.168.1.12

YES manual

up

up

SW3(config)# interface VLAN1


SW3(config-if)#ip address 192.168.1.13 255.255.255.0
SW3(config-if)#no shutdown
SW3(config-if)#exit
SW3(config)#ip default-gateway 192.168.1.1

147

Ti liu thc hnh CCNA

SW3#show ip interface brief


Interface

IP-Address

OK? Method Status

Protocol

Vlan1

192.168.1.13

YES manual

up

up

- T cc Switch th ping n router


SW1#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/202/1000 ms
SW1#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/202/1000 ms
- Sau t router th telnet n cc Switch
Router#telnet 192.168.1.11
Trying 192.168.1.11 ... Open
User Access Verification
Password:
SW1>enable
Password:
SW1#

148

Ti liu thc hnh CCNA

Bc 8: Cu hnh cho SW1 l RootBrigde


- Tin hnh gn thm mt ng kt ni gia SW2 v SW3 nh m hnh bn di

- Cu hnh ng kt ni gia hai switch SW2 v SW3 l hot ng ch Trunk


- SW2:
SW2(config)#interface fa0/24
SW2(config-if)# switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport nonegotiate
SW2(config-if)#no shutdown
- SW3:
SW3(config)#interface fa0/24
SW3(config-if)# switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
149

Ti liu thc hnh CCNA

SW3(config-if)#switchport nonegotiate
SW3(config-if)#no shutdown
- Kim tra SW1 hin ti c phi l rootbridge cha bn lnh show spanning-tree
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee (Giao thc chy mc nh l PVST+)
Root ID Priority 32769
Address

(Roo tBrigdeID)

000a.b8f3.ec40

Cost

19

Port

22 (FastEthernet0/22) (Root Port ca SW1)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) (Priority mc nh ca W1)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Root FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority 32770
Address

000a.b8f3.ec40

Cost

19

Port

22 (FastEthernet0/22)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


150

Ti liu thc hnh CCNA

Bridge ID Priority 32770 (priority 32768 sys-id-ext 2)


Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Root FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 32771
Address

000a.b8f3.ec40

Cost

19

Port

22 (FastEthernet0/22)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Root FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

151

Ti liu thc hnh CCNA

VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 32772
Address

000a.b8f3.ec40

Cost

19

Port

22 (FastEthernet0/22)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 32772 (priority 32768 sys-id-ext 4)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Root FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

- cu hnh cho SW1 l Root Bridge cho tt c VLAN ta tin hnh thay i Priority ca SW1
thnh gi tr thp hn gi tr mc nh 32768 ca cc switch khc
Ch : Gi tr ca Priority phi l bi s ca 4096
SW1(config)#spanning-tree vlan 1-4 priority 4096
- Kim tra li thng tin STP sau khi i Priority
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4097
Address

0018.192e.ddc0

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
152

Ti liu thc hnh CCNA

Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)


Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority 4098
Address

0018.192e.ddc0

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4098 (priority 4096 sys-id-ext 2)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 4099
153

Ti liu thc hnh CCNA

Address

0018.192e.ddc0

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4099 (priority 4096 sys-id-ext 3)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 4100
Address

0018.192e.ddc0

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4100 (priority 4096 sys-id-ext 4)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p
154

Ti liu thc hnh CCNA

- Nh chng ta thy hin ti SW1 l Root Bridge cho c 4 VLAN


Bc 9: Kim tra li s nh tuyn gia cc VLAN
- Cu hnh Ip cho cc PC nh sau :
PC-VLAN1 :
IP : 192.168.1.10
SM : 255.255.255.0
GW : 192.168.1.1 (cng Fa0/0 trn router TTG1)
Port : Fa0/16
PC-VLAN2 :
IP : 192.168.2.10
SM : 255.255.255.0
GW : 192.168.2.1 (cng Fa0/0.2 trn router TTG1)
Port : Fa0/1
PC-VLAN3 :
IP : 192.168.3.10
SM : 255.255.255.0
GW : 192.168.3.1 (cng Fa0/0.3 trn router TTG1)
Port : Fa0/6
PC-VLAN4 :
IP : 192.168.4.10
SM : 255.255.255.0
GW : 192.168.4.1 (cng Fa0/0.4 trn router TTG1)
Port : Fa0/11
- T cc PC ca VLAN 1,2,3,4 phi ping c nhau ,c th s dng thm lnh tracert kim
tra ng i ca gi tin t VLAN ny qua VLAN khc

155

Ti liu thc hnh CCNA

Bc 10: Cu hnh PVRST+

Chuyn cc Switch qua hot ng mode PVRST+


- SW1:
SW1(config)#spanning-tree mode rapid-pvst
SW1(config)#spanning-tree vlan 1-2 root primary
SW1(config)#spanning-tree vlan 3-4 root secondary
- SW2:
SW2(config)#spanning-tree mode rapid-pvst
SW2(config)#spanning-tree vlan 1-2 root secondary
SW2(config)#spanning-tree vlan 3-4 root primary

156

Ti liu thc hnh CCNA

- SW1:
SW3(config)#spanning-tree mode rapid-pvst
- Kim tra li cu hnh PVRST+ trn SW1
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address

0018.192e.ddc0

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0002
Spanning tree enabled protocol rstp
Root ID Priority 4098
Address

0018.192e.ddc0

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4098 (priority 4096 sys-id-ext 2)
Address

0018.192e.ddc0
157

Ti liu thc hnh CCNA

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0003
Spanning tree enabled protocol rstp
Root ID Priority 24579
Address

000a.b8f3.ee00

Cost

19

Port

23 (FastEthernet0/23)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 28675 (priority 28672 sys-id-ext 3)


Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Root FWD 19

128.23 P2p

VLAN0004
Spanning tree enabled protocol rstp
Root ID Priority 24580
158

Ti liu thc hnh CCNA

Address

000a.b8f3.ee00

Cost

19

Port

23 (FastEthernet0/23)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 28676 (priority 28672 sys-id-ext 4)
Address

0018.192e.ddc0

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/20

Desg FWD 19

128.20 P2p

Fa0/22

Desg FWD 19

128.22 P2p

Fa0/23

Root FWD 19

128.23 P2p

- Nh vy hin ti SW1 ang l Root Bridge cho VLAN 1 v 2


- Tng t nh vy trn SW2
SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address

0018.192e.ddc0

Cost

19

Port

23 (FastEthernet0/23)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 28673 (priority 28672 sys-id-ext 1)
Address

000a.b8f3.ee00

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
159

Ti liu thc hnh CCNA

Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/21

Desg FWD 19

128.21 P2p

Fa0/23

Root FWD 19

128.23 P2p

VLAN0002
Spanning tree enabled protocol rstp
Root ID Priority 4098
Address

0018.192e.ddc0

Cost

19

Port

23 (FastEthernet0/23)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 28674 (priority 28672 sys-id-ext 2)
Address

000a.b8f3.ee00

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/1

Desg FWD 19

128.1

P2p

Fa0/21

Desg FWD 19

128.21 P2p

Fa0/23

Root FWD 19

128.23 P2p

VLAN0003
Spanning tree enabled protocol rstp
Root ID Priority 24579
Address

000a.b8f3.ee00

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24579 (priority 24576 sys-id-ext 3)
160

Ti liu thc hnh CCNA

Address

000a.b8f3.ee00

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/6

Desg FWD 19

128.6

P2p

Fa0/21

Desg FWD 19

128.21 P2p

Fa0/23

Desg FWD 19

128.23 P2p

VLAN0004
Spanning tree enabled protocol rstp
Root ID Priority 24580
Address

000a.b8f3.ee00

This bridge is the root


Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24580 (priority 24576 sys-id-ext 4)
Address

000a.b8f3.ee00

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Aging Time 300
Interface

Role Sts Cost

Prio.Nbr Type

---------------- ---- --- --------- -------- -------------------------------Fa0/21

Desg FWD 19

128.21 P2p

Fa0/23

Desg FWD 19

128.23 P2p

161

Ti liu thc hnh CCNA

nh
nh Tuy
Tuyn S Dng
ng Switch Layer3
I. M hnh bi Lab :

II. Cc bc thc hin :


- Cu hnh trunking giaa cc Switch
- Etherchannel tng
bng
ng thng v chia tti t cc Switch Access n
n Layer3 Switch
- S dng giao thc VTP ng
ng bb thng tin VLAN gia cc Switch
- Too thng tin VLAN trn switch VTP Server ggm 4 VLAN:
+VLAN 2 : K Ton s ddng lp mng 192.168.2.0
+VLAN
VLAN 3 : Kinh Doanh ss dng lp mng 192.168.3.0
+VLAN 4 : Gim c s
dng lp mng 192.168.4.0
+VLAN 5 : IT s dng l
p mng 192.168.5.0
- Trn cc Switch Access ln l
t c cc cng thuc VLAN nh sau :
+fa0/5 n fa0/9 thucc VLAN 2
+fa0/10 n fa0/14 thucc VLAN 3

162

Ti liu thc hnh CCNA

+fa0/15 n fa0/19 thuc VLAN 4


+fa0/20 n fa0/24 thuc VLAN 5
- m bo Layer3 Switch l RootBrdge trong STP
- S dng cc Layer3 Switch nh tuyn gia cc VLAN
- nh tuyn gia Layer3 Switch v Router
1. Cu hnh trunking gia cc Switch
- Layer3SW:
Switch(config)#hostname Layer3SW
Layer3SW(config)#interface range fa0/1 - 4
Layer3SW(config-if-range)#switchport mode trunk
- AccessSW1:
Switch(config)#hostname AccessSW1
AccessSW1(config)#interface range fa0/1 - 2
AccessSW1(config-if-range)#switchport mode trunk
- AccessSW2:
Switch(config)#hostname AccessSW2
AccessSW2(config)#interface range fa0/1 - 2
AccessSW2(config-if-range)#switchport mode trunk
2.S dng Etherchannel tng bng thng v chia ti t cc Switch Access n Layer3 Switch
- Layer3SW:
Layer3SW(config)#interface port-channel 1
Layer3SW(config-if)#exit
Layer3SW(config)#interface range fa0/1 2
Layer3SW(config-if-range)#channel-group 1 mode active
Layer3SW(config-if)#exit
Layer3SW(config)#interface port-channel 2
Layer3SW(config-if)#exit
163

Ti liu thc hnh CCNA

Layer3SW(config)#interface range fa0/3 4


Layer3SW(config-if-range)#channel-group 2 mode active
- AccessSW1:
AccessSW1(config)#interface port-channel 1
AccessSW1(config-if)#exit
AccessSW1(config)#interface range fa0/1 2
AccessSW1(config-if-range)#channel-group 1 mode active
- AccessSW2:
AccessSW2(config)#interface port-channel 2
AccessSW2(config-if)#exit
AccessSW2(config)#interface range fa0/1 2
AccessSW2(config-if-range)#channel-group 2 mode active
3. S dng giao thc VTP ng b thng tin VLAN gia cc Switch:
- Layer3SW:
Layer3SW(config)#vtp domain TTG
Layer3SW(config)#vtp password 123
Layer3SW(config)#vtp mode server
- AccessSW1:
AccessSW1(config)#vtp domain TTG
AccessSW1(config)#vtp password 123
AccessSW1(config)#vtp mode client
- AccessSW2:
AccessSW2(config)#vtp domain TTG
AccessSW2(config)#vtp password 123
AccessSW2(config)#vtp mode client
4. To thng tin VLAN trn switch VTP Server gm 4 VLAN:
+VLAN 2 : K Ton s dng lp mng 192.168.2.0
164

Ti liu thc hnh CCNA

+VLAN 3 : Kinh Doanh s dng lp mng 192.168.3.0


+VLAN 4 : Gim c s dng lp mng 192.168.4.0
+VLAN 5 : IT s dng lp mng 192.168.5.0
Do chng ta ang s dng giao thc VTP ng b thng tin VLAN cho ton b Switch trong
h thng nn to thng tin VLAN bt buc phi lm trn Switch VTP Server trong trng
hp ny Layer3SW
- Layer3SW :
Layer3SW(config)#vlan 2
Layer3SW(config-vlan)#name KeToan
Layer3SW(config-vlan)#exit
Layer3SW(config)#vlan 3
Layer3SW(config-vlan)#name KinhDoanh
Layer3SW(config-vlan)#exit
Layer3SW(config)#vlan 4
Layer3SW(config-vlan)#name GiamDoc
Layer3SW(config-vlan)#exit
Layer3SW(config)#vlan 5
Layer3SW(config-vlan)#name IT
Layer3SW(config-vlan)#exit
Sau kim tra li vic ng b thng tin VLAN trn cc AccessSW1 v AccessSW2 bng lnh
show vlan brief m bo chc chn c thng tin v cc VLAN mi to trn
5. Trn cc Switch Access ln lt c cc cng thuc VLAN nh sau :
- AccessSW1:
AccessSW1(config)#interface range fa0/5 - 9
AccessSW1(config-if-range)#switchport access vlan 2
AccessSW1(config-if-range)#exit
AccessSW1(config)#interface range fa0/10 - 14
AccessSW1(config-if-range)#switchport access vlan 3

165

Ti liu thc hnh CCNA

AccessSW1(config-if-range)#exit
AccessSW1(config)#interface range fa0/15 19
AccessSW1(config-if-range)#switchport access vlan 4
AccessSW1(config-if-range)#exit
AccessSW1(config)#interface range fa0/20 - 24
AccessSW1(config-if-range)#switchport access vlan 5
- AccessSW2:
AccessSW2(config)#interface range fa0/5 - 9
AccessSW2(config-if-range)#switchport access vlan 2
AccessSW2(config-if-range)#exit
AccessSW2(config)#interface range fa0/10 - 14
AccessSW2(config-if-range)#switchport access vlan 3
AccessSW2(config-if-range)#exit
AccessSW2(config)#interface range fa0/15 19
AccessSW2(config-if-range)#switchport access vlan 4
AccessSW2(config-if-range)#exit
AccessSW2(config)#interface range fa0/20 - 24
AccessSW2(config-if-range)#switchport access vlan 5
6. m bo Layer3 Switch l RootBrdge trong STP:
Layer3SW(config)#spanning-tree vlan 1-5 root primary
7. S dng cc Layer3 Switch nh tuyn gia cc VLAN:
nh tuyn gia cc VLAN trn switch Layer3 ta s t a ch cho cc interface VLAN
2,3,4,5 v dng cc interface ny lm gateway cho cc PC bn di (cc interface VLAN gi
l SVI: Switch Virtual Interface)
-Bt tnh nng nh tuyn
Layer3SW(config)#ip routing
-t a ch Ip cho cc interface VLAN theo lp mng tng ng phn trn, c th nh sau:
Layer3SW(config)#interface vlan 2
166

Ti liu thc hnh CCNA

Layer3SW(config-if)#ip address 192.168.2.1 255.255.255.0


Layer3SW(config-if)#no shutdown
Layer3SW(config-if)#exit
Layer3SW(config)#interface vlan 3
Layer3SW(config-if)#ip address 192.168.3.1 255.255.255.0
Layer3SW(config-if)#no shutdown
Layer3SW(config-if)#exit
Layer3SW(config)#interface vlan 4
Layer3SW(config-if)#ip address 192.168.4.1 255.255.255.0
Layer3SW(config-if)#no shutdown
Layer3SW(config-if)#exit
Layer3SW(config)#interface vlan 5
Layer3SW(config-if)#ip address 192.168.5.1 255.255.255.0
Layer3SW(config-if)#no shutdown
Layer3SW(config-if)#exit
-t a ch Ip cho cc PC kim tra vic nh tuyn gia cc VLAN thnh cng hay cha:
PCVLAN2 :
Ip Address

: 192.168.2.10

Subnet Mask: 255.255.255.0


Gateway

: 192.168.2.1

PCVLAN3 :
Ip Address

: 192.168.3.10

Subnet Mask: 255.255.255.0


Gateway

: 192.168.3.1

PCVLAN4 :
Ip Address

: 192.168.4.10

Subnet Mask: 255.255.255.0


167

Ti liu thc hnh CCNA

Gateway

: 192.168.4.1

PCVLAN5 :
Ip Address

: 192.168.5.10

Subnet Mask: 255.255.255.0


Gateway

: 192.168.5.1

- Sau t cc PC s dng lnh Ping kim tra qu trnh nh tuyn thnh cng hay khng, kt
qu cc PC phi Ping c ln nhau
8.nh tuyn gia Layer3 Switch v Router:
- Layer3SW:
Layer3SW(config)#interface fa0/5
Layer3SW(config-if)#no switchport
Layer3SW(config-if)#ip address 192.168.6.1 255.255.255.0
Layer3SW(config-if)#no shutdown
Layer3SW(config-if)#exit
- Cu hnh giao thc nh tuyn RIPv2
Layer3SW(config)#router rip
Layer3SW(config-router)#version 2
Layer3SW(config-router)#network 192.168.2.0
Layer3SW(config-router)#network 192.168.3.0
Layer3SW(config-router)#network 192.168.4.0
Layer3SW(config-router)#network 192.168.5.0
Layer3SW(config-router)#network 192.168.6.0
- Router DNG :
Router(config)#hostname DNG
DNG(config)#interface fa0/0
DNG(config-if)#ip address 192.168.6.2 255.255.255.0
DNG(config-if)#no shutdown
DNG(config-if)#exit
168

Ti liu thc hnh CCNA

DNG(config)#router rip
DNG(config-router)#version 2
DNG(config-router)#network 192.168.6.0
- Kim tra bng nh tuyn ca Router v Layer3Switch s dng lnh show ip route

169

You might also like