Nội dung ° Cau hinh Switch ° Cau hinh VTP °- Cầu hinh VLANs - _ Định tuyến giữa các VLANs ° Tham khảo: — Cau hình Port Security — Cầu hình PortFast — Cau hình UplinkFast — Câu hì
Trang 1Lab Networking 2:
Cau hinh Switch, VLANs, VTP
› |Ìllllll((((lUlIIlllllIIIUIIIIll(lIIIUUIIIlIIIIIIUIIIIIIIIUUIU BACHKHOA NETWORKING ACADEMY
Cisco SYSTEMS
mm
NETWORKING
ACADEMY
Trang 2Nội dung
° Cau hinh Switch
° Cau hinh VTP
°- Cầu hinh VLANs
- _ Định tuyến giữa các VLANs
° Tham khảo:
— Cau hình Port Security
— Cầu hình PortFast
— Cau hình UplinkFast
— Câu hình BackboneFast
PDF created with pdfFactory trial version www.pdffactory.com
BACHKHOA NETWORKING ACADEMY
Trang 3So do mang ( Topology )
VTP version 2
domain name: bkacad R1 password: cisco
VLANT1: default, assign IP address VLANZ2: engineering, ports: FO/1-FO/5
YLANS: marketing ports: FQ/6-F 0/10 YVLAN&4: accounting, ports: FO/11- FO/15
PC12
T
PC14
PC13
FO/21
FO/22
-
—=¬
Ge)
VLANZ2
*
wy
F0/23 SW1 T
(server)
F023 PC34
(client) (client)
€
%
Trang 4
Cấu hình Switch
° Chọn console cable có số hiệu tương ứng với PC
e Bat dien
° Mo HyperTerminal:
— Port settings: chon Restore Defaults
— OK
* Khi co thong bao: configuration dialog [y/n] ? Nhap n va Enter,
switch sé chuyén vao User EXEC mode :
— Switch>
° Chuyén sang Privileged EXEC mode:
— Switch> enable
— Switch#
PDF created with pdfFactory trial version www.pdffactory.com
Trang 5Cấu hình Switch
¡ _ /IÍlll(IIIIÍl(lIIIlIIIllIIllIIlIIIlIIIllIIlIIIIllIIIUIM BACHKHOA NETWORKING ACADEMY
e Kiém tra cau hình cũ:
— Switch# show vian
° - Nếu có vlan đã tao thì xoá dữ liệu cũ và reload lai switch về câu hình
mặc định:
— Switch# erase startup-config
— Switch# delete flash: vian.dat
— Switch# reload
° Sau khi khdéi động lai, chuyén switch sang ché dé Privileged EXEC:
— Switch#
° Chuyén sang Global Configuration mode:
— Switch# configure terminal
— Switch(config)#
Trang 6Cấu hình Switch
¡ _. _ /iÍlll(IIIlIIIIllIIIl(IIIlIIIIIllIIIIIlIIIIIIllIIIIlllUII BACHKHOA NETWORKING ACADEMY
° Gan tên cho switch:
— Switch(config)# hostname SW1
— Dùng lệnh tương tự đề đặt tên cho cac switch con lai la SW2, SW3
° Dat password han ché truy nhap vao Privileged mode:
chưa được mã hoá)
— Hoặc sử dụng password mã hoá bằng thuật toán MD5:
— SWitch(config)# enable secret <oassword>
° Thiết lập password đăng nhập bằng giao thức Telnet:
— Switch(config)# line vty 0 4
— Switch(config-line)# password <password>
— Switch(config-line)# login
PDF created with pdfFactory trial version www.pdffactory.com
Trang 7Cấu hình Switch
Gan IP address va default gateway dé cho phép truy nhập tới switch bang Telnet va cac wng dung TCP/IP khác
Gan IP address (nên dùng VLANI):
— Switch(config)# interface VLAN1
— Switch(config-if)# ip address </p address> <subnet_mask>
— Switch(config-if)# no shutdown
Gan default gateway :
— Switch(config)# ip default-gateway </p address>
Kiém tra MAC address table:
— Switch# show mac-address-table
Ghi lai cau hinh:
— Switch# copy running-config startup-config
Thoát khỏi các mức cấu hình: nhập lệnh exit hoặc end hoặc ctrl+z
Trang 8Câu hình VTP SỐ
/IÍllIIÍIlIIIIlIIIIIIIlIIllII(IlllIlI(IIIlIIIlIIlUM
- - Cấu hình VTP trên SW1
° _ Cách:
— SW1(config)# vtp version 2
— SW1(config)# vtp domain <name>
— SW1(conftig)# vtp password <password>
— SW1(config)# vtp mode server
— SW1# vlan database
— SW1(vian)# vtp v2-mode
— SW1(vlan)# vtp domain <name>
— SW1(vlan)# vtp password <password>
— SW1(vian)# vtp server
PDF created with pdfFactory trial version www.pdffactory.com
BACHKHOA NETWORKING ACADEMY
Trang 9Câu hình VTP
/iÍlll(IIIlIIIIllIIIl(IIIlIIIIIllIIIIIlIIIIIIlIIIIIlllUI BACHKHOA NETWORKING ACADEMY
° Cau hinh VTP trén SW2, SW3:
— SW2(config)# vtp version 2
— SW2(conftig)# vtp domain <name>
— SW2(contig)# vtp password <password>
— SW2(config)# vtp mode client
— SW2# vlan database
— SW2(vlan)# vtp v2-mode
— SW2(vlan)# vtp domain <name>
— SW2(vlan)# vtp password <password>
— SW2(vlan)# vtp client
° Kiém tra câu hình VTP
— Switch# show vtp status
Trang 10Câu hình VLANs
._,ÌJIIIlllIIlIllIIIlIlIllIIIIIIIIIIU
° Tao VLAN2, VLAN3, VLAN4 trén SW1:
— SW1(config)# vlan <number>
— SW1(config-vlan)# name <name>
— SW1# vlan database
— SW1(vlan)# vlan <number> name <name>
PDF created with pdfFactory trial version www.pdffactory.com
BACHKHOA NETWORKING ACADEMY
10
Trang 11Câu hình VLANs
° Gan 1 day port:
— Vi du: gan port tu F0/1-F0/5 cho VLAN2
— Switch(config)# interface range F0/1 —5
— Switch(config-if-range)# switchport mode access
— Switch(config-if-range)# switchport access vlan 2
° Gan 1 port:
— Vi du: gan port F0/10 cho VLAN3
— Switch(config)# interface F0/10
— Switch(config-if)}# switchport mode access
— Switch(config-if)# switchport access vlan 3
Trang 12Cauhinh VLANS -
© Cau hinh VLAN Trunk:
° Mac dinh trên switch CISCO 2950, khi 2 switch kết nỗi với nhau, port
kêt nôi sẽ tự động chuyên thành Trunk mode Giao thuc tagging mac định là 802.1Q
° Cau hinh Trunk port:
— Vi du: gan port F0/21 thanh Trunk port
— Switch(config)# interface F0/21
— Switch(config-if)# switchport mode trunk
° Tham khao: néu switch hé tro ca 2 giao thức 802.1 va ISL thi can
chọn chinh xac 1 giao thuc :
— Switch(config-if)}# switchport trunk encapsulation <dot7g | is/>
12
PDF created with pdfFactory trial version www.pdffactory.com
Trang 13Câu hình VLANs
_ /IÍl(IIlIl/lIIlIIlllIIIIlIIIIlIIIIIlIIIIIIIIllIIM
e Kiém tra VLAN
— Switch# show vian
— Switch# show vlan brief
e Kiém tra port:
— Switch# show interface <interface> switchport
— Switch# show interface <interface> trunk
BACHKHOA NETWORKING ACADEMY
Trang 14Định tuyên giữa các VLANS
° - Ví dụ: Câu hình router lam default gateway
° Kích hoạt công vật lý:
— R1(coniig)# Interface FasfEthernet 0/0
— R1(config-if)# no shutdown
° (Cau hình sub-interface trên céng FastEthernet 0/0 tương ứng VLANI:
— R1(coniig)# Interface FasfEthernet 0/0 1
— R1(config-subif)# description management VLAN1
— R1(config-subif)# encapsulation đof1q ï
— R1(config-subif)# tp address 192.168.1.1 255.255.255.0
° Cau hinh tuong ty cho cac sub-interface khac:
— R1(config)# interface <FastEthernet 0/0.number>
— R1(config-subif)# description <management VLAN_number>
— R1(config-subif)# encapsulation <dotig> <vian_number>
— R1(config-subif)# ip address <192.168.1.1 255.255.255.0>
14
PDF created with pdfFactory trial version www.pdffactory.com
Trang 15Tham khảo
° (Cau hinh Port Security
° Cac cau hinh chung:
— Switch(config)# interface </nterface>
— Switch(config-if)}# switchport mode access
— Switch(config-if)# switchport port-security
° Xác định sô điạ chi MAC được phép kết nồi với interface của switch, tt
1-132, mac dinh là 1:
— Switch(config-if)# switchport port-security maximun <val/ue>
° Gan tinh mot dia chi MAC:
— Switch(config-if)# switchport port-security mac-address <mac- address>
° Hoc déng dia chỉ MAC và lưu trong file câu hình running-config:
— Switch(config-if)# switchport port-security mac-address sticky
¢ Kiém tra trang thai cia port security:
— Switch# show port security
Trang 16Tham khảo
,Ill((Í(IIllIlIlllIllIIIllIIlIIIlIIlIlIIIIIIIIllU BACHKHOA NETWORKING ACADEMY
° Cau hinh PortFast:
— Switch(config)# interface < interface>
— Switch(config-if)# spanning-tree portfast
° Cau hinh UplinkFast:
— Switch(config)# spanning-tree uplinkfast
° _ Câu hình BackboneFast:
— Switch(config)# spanning-tree backbonefast
16
PDF created with pdfFactory trial version www.pdffactory.com