萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 路由器知識 >> 路由器設定 >> Cisco 思科路由器

Cisco 路由器與交換機常用指令大全:ACL、VLAN、Routing、VPN、Debug、File Ops 百條彙整

彙整 Cisco IOS/IOS-XE 最常用的 100+ 指令,按功能分類:存取控制、介面封裝、路由協議、VPN、除錯、檔案操作、系統管理。每條指令附簡短說明,適合網管工程師速查與考證複習。

存取控制列表 (ACL)

access-list 1 permit 192.168.1.0 0.0.0.255        ! 標準 ACL
access-list 101 permit tcp any host 1.1.1.1 eq 80 ! 擴展 ACL
ip access-group 101 in                           ! 套用至介面入向
access-class 23 in                               ! 套用至 VTY

介面與封裝

interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 no shutdown
encapsulation ppp
encapsulation frame-relay
encapsulation dot1Q 10           ! 子介面 VLAN 標記
bandwidth 100000                 ! 影響路由度量,非實際限速
clock rate 64000                 ! DCE 端序列埠時鐘

VLAN 與 Trunk (Switch)

vlan 10
 name Management
interface FastEthernet0/1
 switchport mode access
 switchport access vlan 10
interface GigabitEthernet0/1
 switchport mode trunk
 switchport trunk allowed vlan 10,20,30
spanning-tree mode rapid-pvst
spanning-tree portfast
spanning-tree bpduguard enable

路由協議

router ospf 1
 router-id 1.1.1.1
 network 192.168.1.0 0.0.0.255 area 0
 passive-interface default
 no passive-interface Gig0/0

router eigrp 100
 network 10.0.0.0
 no auto-summary

router bgp 65001
 neighbor 1.1.1.2 remote-as 65002
 address-family ipv4
  network 192.168.1.0 mask 255.255.255.0

VPN / IPsec

crypto isakmp policy 10
 encryption aes 256
 hash sha
 authentication pre-share
 group 14
crypto ipsec transform-set AES_SHA esp-aes 256 esp-sha-hmac
crypto map VPN_MAP 10 ipsec-isakmp
 set peer 2.2.2.2
 set transform-set AES_SHA
 match address 101
interface Gig0/1
 crypto map VPN_MAP

除錯指令 (慎用,高 CPU)

debug ip rip
debug ip ospf adj
debug ip bgp updates
debug ppp negotiation
debug ppp authentication
debug crypto ipsec
debug crypto isakmp
no debug all          ! 關閉所有 debug

檔案操作與系統管理

copy running-config startup-config
copy running-config tftp
copy tftp flash
copy flash tftp
dir flash:
delete flash:old_ios.bin
erase startup-config
reload
config-register 0x2102
show version
show flash
show memory
show processes cpu
show logging
clear logging

其他高頻指令

cdp run / no cdp run
cdp enable / no cdp enable
show cdp neighbors detail
ntp server 192.168.1.100
clock timezone CST 8
logging host 192.168.1.50
logging trap informational
snmp-server community public RO
snmp-server community private RW
snmp-server host 192.168.1.50 version 2c public
banner motd # Authorized Access Only #
username admin privilege 15 secret Pass
aaa new-model
aaa authentication login default local group tacacs+
tacacs server TACACS1
 address ipv4 192.168.1.10
 key TacacsKey
copyright © 萬盛學電腦網 all rights reserved