CCNA 5.0 (CCNA R&S) Bài lab cấu hình switch – vlan – trunk ktcntn
Đề bài
Cấu hình S2
Switch>
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)#en
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)#loggin
S2(config-line)#logging s
S2(config-line)#logging synchronous
S2(config-line)#exit
S2(config)#li
S2(config)#line vty
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)#no ip do
S2(config)#no ip domain
S2(config)#no ip ?
access-list Named access-list
default-gateway Specify default gateway (if not routing IP)
dhcp Configure DHCP server and relay parameters
domain IP DNS Resolver
domain-lookup Enable IP Domain Name System hostname translation
domain-name Define the default domain name
ftp FTP configuration commands
hosts Add an entry to the ip hostname table
name-server Specify address of name server to use
ssh Configure ssh options
S2(config)#no ip domain-lo
S2(config)#no ip domain-lookup
S2(config)#ban
S2(config)#banner mo
S2(config)#banner motd “pass la cisco”
S2(config)#vlan
S2(config)#vlan 10
S2(config-vlan)#nam
S2(config-vlan)#name student
S2(config-vlan)#exit
S2(config)#vlan 20
S2(config-vlan)#name
S2(config-vlan)#name teacher
S2(config-vlan)#exit
S2(config)#vlan 30
S2(config-vlan)#nam
S2(config-vlan)#name admin
S2(config-vlan)#exit
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 f0/1
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 10
S2(config-if)#exit
S2(config)#int f0/2
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 ac v
S2(config-if)#sw ac vlan 20
S2(config-if)#exit
S2(config)#int f0/3
S2(config-if)#sw mo ac
S2(config-if)#sw ac vl
S2(config-if)#sw ac vlan 30
S2(config-if)#exit
S2(config)#int f0/6
S2(config-if)#sw m ac
S2(config-if)#sw m access
S2(config-if)#sw ac
S2(config-if)#sw access v
S2(config-if)#sw access vlan 30
S2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
S2(config-if)#exit
S2(config)#int ra
S2(config)#int range f0/4-5
S2(config-if-range)#sw
S2(config-if-range)#switchport m
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/4, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
S2(config-if-range)#exit
S2(config)#do wr
Building configuration…
[OK]
S2(config)#
Cấu hình 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)#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)#
R1(config-if)#des
R1(config-if)#description connect to lan10
R1(config-if)#ip add
R1(config-if)#ip address 192.168.10.1 255.255.255.0
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#des
R1(config-if)#description connect to lan 20
R1(config-if)#ip add
R1(config-if)#ip address 192.168.20.1 255.255.255.0
R1(config-if)#exit
R1(config)#int e0/0/0
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface Ethernet0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0/0, changed state to up
R1(config-if)#
R1(config-if)#des
R1(config-if)#description connect to lan 30
R1(config-if)#ip add 192.168.30.1 255.255.255.0
R1(config-if)#exit
R1(config)#
R1(config)#do wr
Building configuration…
[OK]
R1(config)#
Cấu hình S1
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)#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)#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)#exit
S1(config)#ban
S1(config)#banner “khong phan su mien vao”
^
% Invalid input detected at ‘^’ marker.
S1(config)#ban
S1(config)#banner m
S1(config)#banner motd “khong phan su mien vao”
S1(config)#vlan
S1(config)#vlan 10
S1(config-vlan)#nam
S1(config-vlan)#name studen
S1(config-vlan)#name student
S1(config-vlan)#exit
S1(config)#vlan 20
S1(config-vlan)#nam
S1(config-vlan)#name teacher
S1(config-vlan)#exit
S1(config)#vlan 30
S1(config-vlan)#nam
S1(config-vlan)#name admin
S1(config-vlan)#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 ahut
^
% Invalid input detected at ‘^’ marker.
S1(config-if)#no shut
S1(config-if)#ip add 192.168.30.11 255.255.255.0
S1(config-if)#exit
S1(config)#ip de
S1(config)#ip default-gateway 192.168.30.1
S1(config)#int f0/1
S1(config-if)#sw
S1(config-if)#switchport m
S1(config-if)#switchport mode tr
S1(config-if)#switchport mode trunk
S1(config-if)#exit
S1(config)#int f0/2
S1(config-if)#sw
S1(config-if)#switchport m a
S1(config-if)#switchport m access
S1(config-if)#sw ac v
S1(config-if)#sw ac vlan 10
S1(config-if)#int f0/3
S1(config-if)#sw m ac
S1(config-if)#sw ac vl 20
S1(config-if)#exit
S1(config)#
S1(config)#do wr
Building configuration…
[OK]
S1(config)#
Cấu hình S3
Switch>
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ho
Switch(config)#hostname S3
S3(config)#vlan 10
S3(config-vlan)#nam
S3(config-vlan)#name student
S3(config-vlan)#exit
S3(config)#vlan 20
S3(config-vlan)#nam
S3(config-vlan)#name teacher
S3(config-vlan)#exit
S3(config)#vlan 30
S3(config-vlan)#nam
S3(config-vlan)#name admin
S3(config-vlan)#exit
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 192.168.30.13 255.255.255.0
S3(config-if)#exit
S3(config)#ip d
S3(config)#ip de
S3(config)#ip default-gateway 192.168.30.1
S3(config)#int f0/1
S3(config-if)#sw
S3(config-if)#switchport m tr
S3(config-if)#exit
S3(config)#int f0/2
S3(config-if)#sw m ac
S3(config-if)#sw ac vl 20
S3(config-if)#int f0/3
S3(config-if)#sw m ac
S3(config-if)#sw ac vl 10
S3(config-if)#exit
S3(config)#do wr
Building configuration…
[OK]
S3(config)#
Đặt IP trên pc 192.168.10.10 telnet S2 thành công
Bài lab vlan-trunk-vtp TN 20/08/16
Switch>
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)#exit
S2(config)#li
S2(config)#line vt
S2(config)#line vty 0 4
S2(config-line)#pas
S2(config-line)#password cisco
S2(config-line)#exit
S2(config)#vtp mode
S2(config)#vtp mode server
Device mode already VTP SERVER.
S2(config)#vtp do
S2(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
S2(config)#vtp pas
S2(config)#vtp password cisco
Setting device VLAN database password to cisco
S2(config)#vtp ver
S2(config)#vtp version 2
S2(config)#vlan 10
S2(config-vlan)#na
S2(config-vlan)#name student
S2(config-vlan)#exit
S2(config)#vlan 20
S2(config-vlan)#na
S2(config-vlan)#name teacher
S2(config-vlan)#exit
S2(config)#vlan 30
S2(config-vlan)#na
S2(config-vlan)#name admin
S2(config-vlan)#exit
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 f0/1
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 v
S2(config-if)#switchport access vlan 10
S2(config-if)#exit
S2(config)#int f0/2
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 v
S2(config-if)#switchport access vlan 20
S2(config-if)#exit
S2(config)#in
S2(config)#interface fo/3
^
% Invalid input detected at ‘^’ marker.
S2(config)#int f0/3
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)#int r
S2(config)#int range f0/4-5
S2(config-if-range)#sw
S2(config-if-range)#switchport mo
S2(config-if-range)#switchport mode trunk
S2(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
S2(config-if-range)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#wr
Building configuration…
[OK]
S2#
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)#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)#exit
S1(config)#li
S1(config)#line vty 0 15
S1(config-line)#pas
S1(config-line)#password cisco
S1(config-line)#exit
S1(config)#vtp mo
S1(config)#vtp mode c
S1(config)#vtp mode client
Setting device to VTP CLIENT mode.
S1(config)#vtp d
S1(config)#vtp domain cisco
Domain name already set to cisco.
S1(config)#vt
S1(config)#vtp pas
S1(config)#vtp password cisco
Setting device VLAN database password to cisco
S1(config)#vt
S1(config)#vtp ver
S1(config)#vtp version 2
Cannot modify version in VTP client mode
S1(config)#int f0/1
S1(config-if)#sw
S1(config-if)#switchport mo
S1(config-if)#switchport mode trunk
S1(config-if)#exit
S1(config)#do show vlan
VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active 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/22, Fa0/23, Fa0/24, Gig0/1
Gig0/2
10 student active
20 teacher active
30 admin 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(config)#int vla
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 de
S1(config)#ip default-gateway 192.168.30.1
S1(config)#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 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 vlan 20
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#wr
Building configuration…
[OK]
S1#
Router>
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 p
R1(config)#enable password cisco
R1(config)#li
R1(config)#line co
R1(config)#line console 0
R1(config-line)#pas
R1(config-line)#password cisco
R1(config-line)#exit
R1(config)#li
R1(config)#line vt
R1(config)#line vty 0 4
R1(config-line)#pas
R1(config-line)#password cisco
R1(config-line)#exit
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)#ip add
R1(config-if)#ip address 192.168.10.1 255.255.255.0
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#n oshut
% Ambiguous command: “n oshut”
R1(config)#no shut
^
% Invalid input detected at ‘^’ marker.
R1(config)#int f0/1
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#ip add
R1(config-if)#ip address 192.168.20.1 255.255.255.0
R1(config-if)#exit
R1(config)#int e0/0/0
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface Ethernet0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0/0, changed state to up
R1(config-if)#ip add
R1(config-if)#ip address 192.168.30.1 255.255.255.0
R1(config-if)#exit
R1(config)#exit
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#wr
Building configuration…
[OK]
R1#