CCNA 5.0 (CCNA R&S) Bài lab Vlan-trunk-vtp-intervlan-subint-router ktcntn
Đề bài
Cấu hình trên router R1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hos
Router(config)#hostname R1
R1(config)#ena
R1(config)#enable pas
R1(config)#enable password cisco
R1(config)#li
R1(config)#line con
R1(config)#line console 0
R1(config-line)#pas
R1(config-line)#password cisco
R1(config-line)#login
R1(config-line)#exit
R1(config)#li
R1(config)#line v
R1(config)#line vty 0 4
R1(config-line)#pas
R1(config-line)#password cisco
R1(config-line)#login
R1(config-line)#exit
R1(config)#ban
R1(config)#banner m
R1(config)#banner motd “khong phan su mien vao”
R1(config)#int f0/0
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#int f0/0.10
R1(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to up
R1(config-subif)#des
R1(config-subif)#description connect to vlan 10
R1(config-subif)#en
R1(config-subif)#encapsulation d
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip add
R1(config-subif)#ip address 192.168.10.1 255.255.255.0
R1(config-subif)#int f0/0.20
R1(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to up
R1(config-subif)#des
R1(config-subif)#description connect to vlan 20
R1(config-subif)#ip add
R1(config-subif)#ip address 192.168.20.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
R1(config-subif)#en
R1(config-subif)#encapsulation d
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#int f0/0.30
R1(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.30, changed state to up
R1(config-subif)#en
R1(config-subif)#encapsulation do
R1(config-subif)#encapsulation dot1Q 30
R1(config-subif)#des
R1(config-subif)#description connect to vlan 30
R1(config-subif)#ip add
R1(config-subif)#ip address 192.168.30.1 255.255.255.0
R1(config-subif)#exit
R1(config)#exit
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#wr
Building configuration…
[OK]
R1#
Cấu hình S2 là vtp server
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hos
Switch(config)#hostname S2
S2(config)#ena
S2(config)#enable pas
S2(config)#enable password cisco
S2(config)#li
S2(config)#line con
S2(config)#line console 0
S2(config-line)#pas
S2(config-line)#password cisco
S2(config-line)#login
S2(config-line)#exit
S2(config)#li
S2(config)#line vt
S2(config)#line vty 0 15
S2(config-line)#pas
S2(config-line)#password cisco
S2(config-line)#login
S2(config-line)#exit
S2(config)#ban
S2(config)#banner m
S2(config)#banner motd “khong phan su mien vao”
S2(config)#vlan 10
S2(config-vlan)#na
S2(config-vlan)#name student
S2(config-vlan)#exit
S2(config)#vlan 20
S2(config-vlan)#nam
S2(config-vlan)#name teacher
S2(config-vlan)#exit
S2(config)#vlan 30
S2(config-vlan)#name
S2(config-vlan)#name manager
S2(config-vlan)#exit
S2(config)#vtp m
S2(config)#vtp mode se
S2(config)#vtp mode server
Device mode already VTP SERVER.
S2(config)#vt
S2(config)#vtp d
S2(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
S2(config)#vtp pas
S2(config)#vtp password class
Setting device VLAN database password to class
S2(config)#int vlan
S2(config)#int vlan 30
S2(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
S2(config-if)#no shut
S2(config-if)#ip add
S2(config-if)#ip address 192.168.30.12 255.255.255.0
S2(config-if)#exit
S2(config)#ip de
S2(config)#ip default-gateway 192.168.30.1
S2(config)#int r
S2(config)#int range f0/1-3
S2(config-if-range)#sw
S2(config-if-range)#switchport mo
S2(config-if-range)#switchport mode tr
S2(config-if-range)#switchport mode trunk
S2(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
S2(config-if-range)#exit
S2(config)#int f0/4
S2(config-if)#sw
S2(config-if)#switchport mo
S2(config-if)#switchport mode ac
S2(config-if)#switchport mode access
S2(config-if)#sw
S2(config-if)#switchport ac
S2(config-if)#switchport access vl
S2(config-if)#switchport access vlan 30
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#wr
Building configuration…
[OK]
S2#
Cấu hình S1 là vtp client, chú ý không khai báo vlan
Switch>
Switch>
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hos
Switch(config)#hostname S1
S1(config)#en
S1(config)#ena
S1(config)#enable pas
S1(config)#enable password cisco
S1(config)#li
S1(config)#line con
S1(config)#line console 0
S1(config-line)#pas
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#exit
S1(config)#li
S1(config)#line vt
S1(config)#line vty 0 4
S1(config-line)#pas
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#exit
S1(config)#vtp mo
S1(config)#vtp mode cli
S1(config)#vtp mode client
Setting device to VTP CLIENT mode.
S1(config)#vt
S1(config)#vtp do
S1(config)#vtp domain cisco
Domain name already set to cisco.
S1(config)#vtp pas
S1(config)#vtp password class
Setting device VLAN database password to class
S1(config)#int f0/1
S1(config-if)#sw
S1(config-if)#switchport mo
S1(config-if)#switchport mode tr
S1(config-if)#switchport mode trunk
S1(config-if)#intf0/2
^
% Invalid input detected at ‘^’ marker.
S1(config-if)#int f0/2
S1(config-if)#sw
S1(config-if)#switchport mo
S1(config-if)#switchport mode ac
S1(config-if)#switchport mode access
S1(config-if)#sw
S1(config-if)#switchport ac
S1(config-if)#switchport access vl
S1(config-if)#switchport access vlan 10
S1(config-if)#int f0/3
S1(config-if)#sw
S1(config-if)#switchport mo
S1(config-if)#switchport mode ac
S1(config-if)#switchport mode access
S1(config-if)#sw
S1(config-if)#switchport ac
S1(config-if)#switchport access vl
S1(config-if)#switchport access vlan 20
S1(config-if)#exit
S1(config)#int vlan 30
S1(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
S1(config-if)#no shut
S1(config-if)#ip add
S1(config-if)#ip address 192.168.30.11 255.255.255.0
S1(config-if)#exit
S1(config)#ip
S1(config)#ip de
S1(config)#ip default-gateway 192.168.30.1
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#show vlan
VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active 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/22, Fa0/23
Fa0/24, Gig1/1, Gig1/2
10 student active Fa0/2
20 teacher active Fa0/3
30 manager active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1 enet 100001 1500 – – – – – 0 0
10 enet 100010 1500 – – – – – 0 0
20 enet 100020 1500 – – – – – 0 0
30 enet 100030 1500 – – – – – 0 0
1002 fddi 101002 1500 – – – – – 0 0
1003 tr 101003 1500 – – – – – 0 0
1004 fdnet 101004 1500 – – – ieee – 0 0
1005 trnet 101005 1500 – – – ibm – 0 0
Remote SPAN VLANs
——————————————————————————
Primary Secondary Type Ports
——- ——— —————– ——————————————
S1#show vtp sta
S1#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 255
Number of existing VLANs : 8
VTP Operating Mode : Client
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xC2 0x17 0xCB 0x5C 0x5E 0x2D 0xC6 0x82
Configuration last modified by 0.0.0.0 at 3-1-93 00:27:44
S1#wr
Building configuration…
[OK]
S1#
Cấu hình S3 là vtp client tương tự S1
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hos
Switch(config)#hostname S3
S3(config)#ena
S3(config)#enable pas
S3(config)#enable password cisco
S3(config)#li
S3(config)#line vty
S3(config)#line vty 0 15
S3(config-line)#pas
S3(config-line)#password cisco
S3(config-line)#login
S3(config-line)#exit
S3(config)#vtp
S3(config)#vtp mo
S3(config)#vtp mode cl
S3(config)#vtp mode client
Setting device to VTP CLIENT mode.
S3(config)#vtp
S3(config)#vtp do
S3(config)#vtp domain cisco
Domain name already set to cisco.
S3(config)#vtp
S3(config)#vtp pas
S3(config)#vtp password class
Setting device VLAN database password to class
S3(config)#int f0/1
S3(config-if)#sw
S3(config-if)#switchport mo
S3(config-if)#switchport mode tr
S3(config-if)#switchport mode trunk
S3(config-if)#int f0/2
S3(config-if)#sw
S3(config-if)#switchport mo
S3(config-if)#switchport mode ac
S3(config-if)#switchport mode access
S3(config-if)#sw
S3(config-if)#switchport ac
S3(config-if)#switchport access vl
S3(config-if)#switchport access vlan 10
S3(config-if)#int f0/3
S3(config-if)#sw
S3(config-if)#switchport mo
S3(config-if)#switchport mode a
S3(config-if)#switchport mode access
S3(config-if)#sw
S3(config-if)#switchport ac
S3(config-if)#switchport access v
S3(config-if)#switchport access vlan 20
S3(config-if)#exit
S3(config)#do show vlan
VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active 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/22, Fa0/23
Fa0/24, Gig1/1, Gig1/2
10 student active Fa0/2
20 teacher active Fa0/3
30 manager active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1 enet 100001 1500 – – – – – 0 0
10 enet 100010 1500 – – – – – 0 0
20 enet 100020 1500 – – – – – 0 0
30 enet 100030 1500 – – – – – 0 0
1002 fddi 101002 1500 – – – – – 0 0
1003 tr 101003 1500 – – – – – 0 0
1004 fdnet 101004 1500 – – – ieee – 0 0
1005 trnet 101005 1500 – – – ibm – 0 0
Remote SPAN VLANs
——————————————————————————
Primary Secondary Type Ports
——- ——— —————– ——————————————
S3(config)#int vlan 30
S3(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
S3(config-if)#no shut
S3(config-if)#ip add
S3(config-if)#ip address 192.168.30.13 255.255.255.0
S3(config-if)#exit
S3(config)#ip de
S3(config)#ip default-gateway 192.168.30.1
S3(config)#exit
S3#
%SYS-5-CONFIG_I: Configured from console by console
S3#wr
Building configuration…
[OK]
S3#
Telnet thành công từ pc 192.168.10.10 đến S3