萬盛學電腦網

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

Cisco 路由器配置命令全攻略:ACL、DCE 時鐘、PPP、NAT、VTY、Routing 核心指令速查

彙整 Cisco IOS 核心配置指令,按功能模組分類:標準/擴展/命名 ACL、DCE 時鐘速率、PPP 封裝與 CHAP/PAP 認證 (單向/雙向)、NAT 動態靜態、VTY 遠端管理、動態路由啟用。每模組提供可直接套用的配置片段與關鍵參數說明。

1. 存取控制列表 (ACL)

標準 ACL (1~99, 1300~1999)

access-list 10 permit 192.168.1.0 0.0.0.255
interface Gig0/1
 ip access-group 10 in

擴展 ACL (100~199, 2000~2699)

access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 1.1.1.1 eq 80
access-list 101 deny ip any any log
interface Gig0/1
 ip access-group 101 out

命名 ACL (支援刪除單條、較易讀)

ip access-list extended WEB_ALLOW
 permit tcp any host 1.1.1.1 eq 80
 permit tcp any host 1.1.1.1 eq 443
 deny ip any any log
interface Gig0/1
 ip access-group WEB_ALLOW in

2. DCE 序列埠時鐘速率

show controllers Serial0/0   ! 確認 DCE
interface Serial0/0
 clock rate 64000             ! bps,常見 64k/128k/256k/2M

3. PPP 封裝與認證

全域用戶資料庫

username RouterB password Secret123

PAP 單向認證 (Server 驗證 Client)

! Server 端
interface Serial0/0
 encapsulation ppp
 ppp authentication pap
! Client 端
interface Serial0/1
 encapsulation ppp
 ppp pap sent-username RouterA password Secret123

CHAP 雙向認證 (雙邊互驗)

! Router A
username RouterB password Secret123
interface Serial0/0
 encapsulation ppp
 ppp authentication chap
 ppp chap hostname RouterA
 ppp chap password Secret123

! Router B
username RouterA password Secret123
interface Serial0/1
 encapsulation ppp
 ppp authentication chap
 ppp chap hostname RouterB
 ppp chap password Secret123

4. NAT 配置

動態 PAT (Overload)

access-list 1 permit 192.168.1.0 0.0.0.255
interface Gig0/0
 ip nat inside
interface Gig0/1
 ip nat outside
ip nat inside source list 1 interface Gig0/1 overload

靜態 Port Mapping

ip nat inside source static tcp 192.168.1.10 80 203.0.113.5 8080 extendable

5. VTY 遠端管理

line vty 0 15
 password VtyPass
 login local
 transport input ssh
 exec-timeout 10 0
 access-class 23 in

6. 動態路由快速啟用

! OSPF
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

! EIGRP
router eigrp 100
 network 10.0.0.0
 no auto-summary

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

7. 基礎系統指令

hostname R1
enable secret StrongPass
service password-encryption
no ip domain-lookup
ip domain-name corp.local
crypto key generate rsa modulus 2048
ip ssh version 2
ntp server 192.168.100.10
logging host 192.168.100.50
logging trap notifications
copyright © 萬盛學電腦網 all rights reserved