1. Cấu hình cơ bản ban đầu
Đặt tên và mật khẩu quản lý:
enable
configure terminal
hostname [Tên_Switch]
enable secret [Mật_khẩu_enable]
Tắt tìm kiếm DNS:
no ip domain-lookup
Đặt banner cảnh báo:
banner motd #Welcome to [Tên_Switch]! Unauthorized access is prohibited.#
________________________________________
2. Cấu hình VLAN
Tạo VLAN:
vlan [VLAN_ID]
name [Tên_VLAN]
Gắn VLAN vào cổng:
interface [Giao_diện]
switchport mode access
switchport access vlan [VLAN_ID]
Cấu hình Trunk:
interface [Giao_diện]
switchport mode trunk
switchport trunk allowed vlan [Danh_sách_VLAN]
________________________________________
3. Cấu hình quản lý
Đặt địa chỉ IP quản lý:
interface vlan [VLAN_ID]
ip address [IP_Address] [Subnet_Mask]
no shutdown
Cấu hình Default Gateway:
ip default-gateway [Gateway_IP]
________________________________________
4. Cấu hình Spanning Tree Protocol (STP)
Cấu hình chế độ STP:
spanning-tree mode [pvst | rapid-pvst | mst]
Đặt Switch làm Root Bridge:
spanning-tree vlan [VLAN_ID] root primary
Tối ưu hóa STP PortFast:
interface [Giao_diện]
spanning-tree portfast
________________________________________
5. Cấu hình bảo mật cổng
Bảo mật cổng (Port Security):
interface [Giao_diện]
switchport port-security
switchport port-security maximum [Số_mac_tối_đa]
switchport port-security mac-address sticky
switchport port-security violation [protect | restrict | shutdown]
Tắt cổng không sử dụng:
interface range [Danh_sách_Cổng]
shutdown
________________________________________
6. Cấu hình QoS (nếu cần)
Bật QoS:
mls qos
Gắn QoS cho VLAN:
interface vlan [VLAN_ID]
service-policy input [Tên_chính_sách]
________________________________________
7. Cấu hình SSH
Tạo người dùng SSH:
username [Tên_người_dùng] privilege 15 secret [Mật_khẩu]
ip domain-name [domain_name]
crypto key generate rsa
# Chọn kích thước khóa: 1024 hoặc 2048 bit
line vty 0 15
transport input ssh
login local
________________________________________
8. Kiểm tra và lưu cấu hình
Kiểm tra trạng thái cổng:
show running-config
show vlan brief
show ip interface brief
Lưu cấu hình:
copy running-config startup-config
________________________________________
9. Một số lệnh hữu ích
• Kiểm tra STP:
show spanning-tree
• Kiểm tra trạng thái VLAN:
show vlan brief
• Kiểm tra bảo mật cổng:
show port-security interface [Giao_diện]
Nhận xét
Đăng nhận xét