保護 Cisco 路由器本身安全,是網路防禦第一道關卡。本文實務整理:密碼分級管理 (Console/VTY/Enable/Enable Secret/加密)、ACL 報文過濾 (標準/擴充/命名、入向/出向、埠號/協定匹配)、管理存取控制 (限制來源 IP、SSH 替代 Telnet、AAA 認證),構建纵深防禦體系。
| 指令 | 保護對象 | 加密方式 | 建議 |
|---|---|---|---|
line console 0 password CISCO123 login | Console 埠本地登入 | Type 7 (可逆弱加密) | 設定強密碼,配合 exec-timeout 5 0 |
line vty 0 4 password CISCO123 login | Telnet/SSH 遠端登入 | Type 7 | 必須改用 SSH,見下文 |
enable password CISCO123 | 特權模式 (舊式) | Type 7 | 棄用,改用 enable secret |
enable secret CISCO123 | 特權模式 (現代) | MD5 / SHA-256 (Type 5/8/9) | **強制使用**,16+ 字元亂數 |
service password-encryption | 配置檔中所有明文密碼 | Type 7 | 啟用,防備份檔洩露 (非絕對安全) |
ip domain-name corp.example.com
crypto key generate rsa modulus 2048
ip ssh version 2
ip ssh time-out 60
ip ssh authentication-retries 3
line vty 0 4
transport input ssh
access-class MGMT_ACL in
exec-timeout 10 0
!
ip access-list standard MGMT_ACL
permit 10.10.10.0 0.0.0.255 ! 僅允許管理網段
deny any log
1-99、1300-1999:標準 ACL (僅來源 IP)100-199、2000-2699:擴充 ACL (來源/目的 IP、協定、埠、TCP 旗標、ICMP 類型、DSCP、時間範圍)1100-1199:擴充 48-bit MAC ACL200-299:協定類型碼 ACL (舊 AppleTalk/IPX 等)700-799:48-bit MAC ACLip access-list extended WEB_ALLOW
permit tcp any host 192.168.10.10 eq 80
permit tcp any host 192.168.10.10 eq 443
deny ip any any log
!
interface GigabitEthernet0/1
ip access-group WEB_ALLOW in
ip access-list extended DNS_QUERY
permit udp any gt 1023 host 192.168.10.10 eq 53
deny ip any any log
deny any any 於末尾,必須明確 permit 合法流量。ip access-list resequence)。service password-encryption。logging 至 Syslog 伺服器,保留登入/配置變更/ACL 命中日誌。copy running-config tftp 異地備份,測試還原演練。路由器安全非一次設定即完成,需持續審計、修補、演練,方能守住網路核心。