Khóa bảo mật mạng trên router Cisco là gì?
Trên router Cisco (ISR, ASR, Catalyst, Meraki, RV series...), "khóa bảo mật mạng" thường chỉ một trong hai thứ:
- Pre-Shared Key (PSK) / WPA2/WPA3 Passphrase: Mật khẩu Wi-Fi cho client kết nối SSID (trên AP/controller)
- Key String / Key Chain / ISAKMP Key / IPsec Pre-shared Key: Khóa dùng cho VPN (Site-to-Site, Remote Access), Routing Protocol Authentication (OSPF, BGP, EIGRP, RIP), NTP Authentication, HSRP/VRRP/GLBP Authentication
1. Tìm/Đặt khóa Wi-Fi (WPA2/WPA3 PSK) trên Cisco Wireless
Cisco WLC (Wireless LAN Controller) - GUI
- Đăng nhập WLC GUI (HTTPS)
- Vào WLANs → Click ID của WLAN → Tab Security → Layer 2
- Layer 2 Security: WPA+WPA2 → WPA2 Policy: Enable → PSK Format: ASCII / HEX → Pre-Shared Key: nhập mật khẩu (8-63 ký tự ASCII)
- Apply
Cisco WLC - CLI
config wlan security wpa wpa2 enable
config wlan security wpa akm psk enable
config wlan security wpa psk set-key ascii "MatKhauManh123!"
# Hoặc HEX (64 ký tự):
config wlan security wpa psk set-key hex "a1b2c3d4..."
Cisco Autonomous AP (IOS/IOS-XE) - CLI
configure terminal
dot11 ssid Ten_Mang_WiFi
authentication open
authentication key-management wpa version 2
wpa-psk ascii "MatKhauManh123!"
exit
interface Dot11Radio0
encryption mode ciphers aes-ccm
ssid Ten_Mang_WiFi
end
write memory
Cisco Meraki (Cloud Managed)
- Đăng nhập
dashboard.meraki.com - Wireless → Configure → Access control → SSID → Security: WPA2-PSK / WPA3
- Nhập PSK → Save
2. Key Chain / Key String – Cho Routing Protocol Auth, IPsec, NTP, HSRP
Cisco dùng **Key Chain** để quản lý nhiều khóa (key rotation, lifetime).
Tạo Key Chain (CLI)
configure terminal
key chain OSPF_KEYS
key 1
key-string MatKhauOSPF123!
accept-lifetime 00:00:00 Jan 1 2024 23:59:59 Dec 31 2024
send-lifetime 00:00:00 Jan 1 2024 23:59:59 Dec 31 2024
key 2
key-string MatKhauOSPF456@
accept-lifetime 00:00:00 Jan 1 2025 23:59:59 Dec 31 2025
send-lifetime 00:00:00 Jan 1 2025 23:59:59 Dec 31 2025
exit
exit
Áp dụng Key Chain cho OSPF
router ospf 1
area 0 authentication message-digest
interface GigabitEthernet0/0
ip ospf message-digest-key 1 md5 MatKhauOSPF123!
# Hoặc dùng key chain (IOS-XE 16.12+):
ip ospf authentication key-chain OSPF_KEYS
Áp dụng cho BGP
router bgp 65001
neighbor 192.168.1.2 remote-as 65002
neighbor 192.168.1.2 password MatKhauBGP123!
# Hoặc key chain (IOS-XE):
neighbor 192.168.1.2 key-chain BGP_KEYS
Áp dụng cho IPsec Site-to-Site VPN (ISAKMP)
crypto isakmp policy 10
encr aes 256
hash sha256
authentication pre-share
group 19
crypto isakmp key MatKhauIPsecVPN address 203.0.113.5
# Hoặc key chain cho IPsec profile (IOS-XE):
crypto ikev2 keyring KEYRING_VPN
peer PEER_ROUTER
address 203.0.113.5
pre-shared-key MatKhauIPsecVPN
Áp dụng cho NTP Authentication
ntp authenticate
ntp authentication-key 1 md5 MatKhauNTP123! 7
ntp trusted-key 1
ntp server 192.168.1.100 key 1
Áp dụng cho HSRP/VRRP/GLBP
interface Vlan10
standby 1 ip 192.168.10.1
standby 1 priority 110
standby 1 preempt
standby 1 authentication md5 key-string MatKhauHSRP123!
# Hoặc key chain:
standby 1 authentication md5 key-chain HSRP_KEYS
3. Xem khóa đã cấu hình (Show Commands)
| Mục đích | Lệnh Show |
|---|---|
| Xem Key Chain | show key chain / show key chain OSPF_KEYS |
| Xem Wi-Fi PSK (WLC) | show wlan (xem Pre-Shared Key) |
| Xem Wi-Fi PSK (Autonomous AP) | show running-config | section dot11 ssid (PSK hiển thị dạng encrypted: `7 1234...`) |
| Giải mã Password Type 7 (Cisco Type 7) | Dùng tool online (cisco-password-decoder) hoặc script Python. Lưu ý: Type 7 là encoding yếu (Vigenère), KHÔNG phải hashing. Không dùng cho bảo mật thực. |
| Xem IPsec SA | show crypto ipsec sa / show crypto ikev2 sa |
4. Best Practice quản lý Key trên Cisco
- Dùng Key Chain cho mọi giao thức hỗ trợ (OSPF, BGP, RIP, EIGRP, IS-IS, HSRP, VRRP, GLBP, NTP, IPsec IKEv2) – hỗ trợ key rotation, lifetime
- Dùng Algorithm mạnh: SHA-256/384/512 (HMAC) thay vì MD5/SHA-1. AES-256 cho IPsec encryption
- Không dùng Type 7 cho key nhạy cảm. Dùng Type 6 (AES) (cần `key config-key password-encrypt` + master key) hoặc Type 8 (PBKDF2) trên IOS-XE 17.x+
- Lưu trữ khóa an toàn: Password manager (1Password, Bitwarden, HashiCorp Vault), không ghi trong config text/plain
- Key Rotation: Lập lịch thay khóa định kỳ (6-12 tháng), dùng accept-lifetime/send-lifetime overlap
- Nguyên tắc Least Privilege: Key riêng cho từng giao thức, từng peer, từng mục đích
5. Cisco Router Gia đình (RV Series, Small Business) – Web GUI
- Truy cập
192.168.1.1→ đăng nhập admin - Wireless → Wireless Security → Security Mode: WPA2-Personal / WPA3-Personal
- Passphrase: nhập mật khẩu → Save
- VPN → IPsec / SSL VPN → Pre-shared Key: nhập key
Tóm tắt
Trên Cisco: "Khóa bảo mật" = **Wi-Fi PSK** (cho client) HOẶC **Key Chain/Key String** (cho VPN, Routing Auth, NTP, FHRP). Dùng CLI (`key chain`, `crypto isakmp key`, `ip ospf authentication key-chain`) hoặc GUI (WLC, Meraki, RV). Best practice: Key chain, algorithm mạnh (SHA-256+, AES-256), Type 6/8 encryption, key rotation, lưu trữ an toàn.